Sign in to follow this  

[SDL_ttf] Blit multiply lines?

This topic is 3858 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey. I'm using SDL_ttf to blit text to screen. In order to blit more that one line of text I blit this text line by line. I blit first line free the surface load another line to this surface blit him and all over again while not finished to blit all. Now i want to know is there any option to blit multiply lines using the blit function only once? I mean something like SDL_BlitSurface(TTF_RenderText_Solid("Hey\nthis is\nmultiply\nline", color), NULL, g_Screen, NULL); ? Thanks a lot

Share this post


Link to post
Share on other sites
Not to my knowledge. Sorry. SDL_ttf is a text rendering engine, not a text layout engine.
However, it shouldn't be too hard write your own function to return to a set point plus a certain offset on each newline. :)

And, be careful with TTF_RenderText_Solid(). It allocates a new surface, that has to be freed with SDL_FreeSurface() once you're done with it.

Share this post


Link to post
Share on other sites
Ok thanks for the answer.

And yea i know that it allocate new surface :)

Share this post


Link to post
Share on other sites
Sign in to follow this