Hello,
I am trying to capture a screenshot of the sprites currently being displayed and only them.
Creating a "plain" screenshot is straightforward using playdate->graphics->getDisplayBufferBitmap()
. However this also contains any drawn text, which is not what I'm looking for.
Is there any way to get sprites to draw themselves in an LCDBitmap? I tried with
LCDBitmap* bitmap = playdate->graphics->newBitmap(DISPLAY_WIDTH, DISPLAY_HEIGHT, kColorClear);
playdate->graphics->pushContext(bitmap);
playdate->sprite->drawSprites();
playdate->graphics->popContext();
and many variations of bitmap background color, re-adding sprites, marking them dirty, marking a rect dirty, updating and drawing, etc. to no avail.
Edit: I found the following alternative using the display buffer:
p->graphics->clear(kColorClear);
p->sprite->drawSprites();
p->graphics->display();
LCDBitmap* screenshot = p->graphics->getDisplayBufferBitmap();
So essentially forcing a redraw of the screen with sprites only. Given that it's a very punctual thing I guess it's fine, but still curious about the possibility of drawing sprites in a bitmap.