How to use clear without updating the entire screen

I'm having an issue with the function. I just want to set the background color to black. only sets the background color of sprites, but I want to set the background of the entire screen. Is there anything I can do to fix this, or I'll just have to wait until the entire game world is made of sprites?

The example here should show you how to make this work:

Inside Play date example game


(note: I'm using gfx = here to keep things concise :slight_smile:)

If you do gfx.clear(gfx.kColorBlack) at the top level (outside of any functions) in main.lua, it will clear the screen to black on startup. You can also put that at the start of playdate.update() to clear the screen to black at the start of every frame.

If you're using sprites, then you'd want to do gfx.setBackgroundColor(gfx.kColorBlack) so that the sprite system will clear the background to black in the areas it needs to redraw when sprites move--and you probably wouldn't want to call gfx.clear() in that case, because the sprite system is already handling the background.