I'm porting some code from elsewhere to run on the Playdate, and part of the graphics layer requires us to be able to create a 'blitter': a device that copies a section of the screen away so we can either redraw it back in its original position (e.g. to redraw after something has been scrolled across the top) or elsewhere (like a sort of sprite).
To do this, I think I need to use one or other of
getDisplayBufferBitmap() (for the live display) or
copyFrameBufferBitmap() (for the working buffer) to grab the current contents of the screen, and then using the mask/display/unmask trick in Redrawing only a portion of LCDBitmap with the C api on linux? to draw the requested subset of the bitmap onto the requested bit of the screen.
But the trouble is, neither of these functions seems to be working for me (in the simulator; I've not tried them on a real device). They're both returning an all-black bitmap: if I fetch the bitmap and then immediately display it back on the screen, the whole screen turns black. This also happens for me in the
bach.mid example code (
C_API/Examples/bach.mid): this uses a similar trick to shift the display buffer left by one pixel whenever the MIDI sequence increments, but if I compile and run the code (unmodified), all I see is a black screen with one white column at the right-hand edge.
Is there something I'm missing about the operation of these functions? The example code not running makes me think that maybe it's not just me... Is the idea that you have to use the
getDebugBitmap() function iff you're running in the simulator, and the other functions only if you're running on real hardware? I'm using v1.12.3 of the SDK.