How to set the clear color when using updateAndDrawSprites from the C API?

I am using C API to develop my game. In my main update loop, I wanted to draw backgrounds and then draw the sprites. However when I call playdate->sprite->updateAndDrawSprites() the backgrounds are replaced by a white color.

So I created a sprite whose update loop calls playdate->graphics->clear(kColorBlack) and draw the backgrounds. It works but I don't really like having to know which layer is the farthest and have it clear the screen.

Am I missing something? Is there a way to choose which color will be used by playdate->sprite->updateAndDrawSprites()?

1 Like

In Lua we can set a sprite backing which is just one big sprite the size of the screen with the lowest z-order.

I'm not familiar with the C SDK but there doesn't seem to be anything equivalent.

1 Like

Thanks. It seems that using a sprite for the background is the way to go then.

1 Like