I am using the Mac SDK and am trying to draw some text in my game. I create a new font using playdate.graphics.font.new() and verify that it is properly set. In my update function, I then set the font and draw the text. I can see that the text is being drawn because the area where it should be is highlighted when I select 'Highlight Screen Updates'. However, the text is not there. I have removed the background to verify that it isn't behind any of the other sprites as well. Any thoughts on what may be going on?
In order for text to coexist with all sprites you need to draw it into a sprite of its own. That could be the spirte background, or something else.
There are some other threads on this
1 Like
What's happening here is it's drawing the text, then gfx.sprite.update() sees a dirty area and clears it before drawing sprites. If you call playdate.graphics.setBackgroundColor(gfx.kColorClear)
the sprite update won't clear the background, which may or may not be what you want--you'll have to clear that area yourself if the contents change. It's usually easier to do what Matt suggests and either draw the text into an image and set that on a sprite, or draw the text in a sprite's draw() callback.
1 Like