Behavior/necessity of `playdate.display.flush()`

Based on the documentation, it sounds like playdate.stop() should no longer call the frame callback, and that any modifications to the frame buffer shouldn't become visible until playdate.display.flush() is called.

I wrote a program in C to test this (attached to this post), since in C the frame callback explicitly notifies the runtime when it should refresh the display:

flush.zip (3.8 KB)

The controls are as follows:

  • Up: Clear frame buffer to white
  • Down: Clear frame buffer to black
  • B: Clear frame buffer to 50% black/white
  • A: Flush frame buffer to display

If you don't press A, you'll never see any changes on-screen. Well, I should clarify that this is the behavior when running on the hardware.

Here's the kicker: the simulator is wrong. If you run this program in the simulator, the display will refresh immediately when pressing up, down and B. It seems like the simulator is always showing the contents of the frame buffer, not the contents of the... I was gonna say LCD, but whatever the display hardware is made of.

Try running your test on the hardware. You may find it behaves the way you expect.