I'm attempting to enable some debug drawing features after calling playdate.stop()
. I'm either failing to understand how playdate.display.flush()
works, or perhaps there's some internal logic for performing debug drawing that depends on update
being called.
I have implemented playdate.debugDraw()
, which works, and keyboard input via playdate.keyPressed()
, which also works. I have one key set up to "pause" the game, calling either playdate.stop()
or playdate.start()
accordingly and setting a local paused
variable, which works.
Inside my keyPressed
handler I'm doing the following in an attempt to execute the debug drawing logic and update the display:
if paused then
playdate.debugDraw()
playdate.display.flush()
end
I'd expect this to update the display with new debug drawing. Instead, none of the new debug draws appear. However, I do get a ghosted image wherever I would have expected the debug draw layer to appear. It's as though the system thinks it's drawing the debug draw layer but renders it in kColorWhite rather than the debug color, and it also doesn't redraw the underlying game graphics once the debug drawing in that area stops either.
Here' what it looks like. You can see some bounding box rects leftover where debug drawing would have happened, but never appears.
Can someone help me understand what's going on here?
Also, one related point of confusion. I see this in the docs for playdate.wait
(which I assume also applies to playdate.stop
):
Animation during this wait period is possible, but you will need to explicitly call
playdate.display.flush()
once per frame.
I realize that animators still run in the background, but I don't see how one would call flush
every frame, since there seems to be no per-frame callback while waiting/stopped. update
won't be called, by definition, and timers won't fire either, so as far as I can tell there's no opportunity to even call flush
until the animation ends apart from interrupts like button/key presses. What am I missing?