Text stopped rendering?

It's probably something incredibly simple i'm missing here, but... all the text in my project stopped rendering? anything you know that may cause that? cheers ;-;

Did you start using the Sprite system?

i was using text a few days ago fine, but at some point between then and now it stopped working... i'm pretty sure that I was already using sprites at that point, however.

is there a way to change the layer that text renders on?

You can draw it to an image within its own context and then draw the image.

can strings be passed into playdate.graphics.pushContext()? er, is that even what you would use? playdate's the first time i've actually worked with images/graphics in code outside of mods so i don't really understand the conventions of how the image stuff works :smiling_face_with_tear:

No, you first create a new (empty but with certain size) image, push that onto the context, do whatever configuring you want to do, drawText, then pop the context. The result should be an image object with text drawn on it, then you draw the image wherever you like.

will that copy everything on-screen? do i need to clear the whole screen each time i want to write text?

It will not. If you’re using sprites then put the image into a sprite and it’ll be dealt with same as everything else.

ah, okay! is the image solution efficient? If so i'll probably just use this for all of the text in the program

It can be! Check out this thread: Any tricks for optimizing text drawing?

ooh, alright!

one more thing; is there any way w/ this solution to do stuff like text scroll? i'll probably be using this for dialogue and such and it does feel a little strange to have entire bodies of text just... appear, lol

I would imagine you could use a clip rect on the bounds where the text is shown, then move it as you would any other sprite.

My text stopped rendering. I think the problem was that I changed the draw mode in some code before the text was rendered, but I forgot to change it back.

1 Like

See this topic Text/dialog boxes + animated text - #6 by neven