[SDL] Very quick SDL_TTF question

James O\'Meara james at nformant.net
Thu Nov 3 17:40:42 PST 2005


Is it possible to have multi-line surfaces with SDL_TTF?

I went through the documentation at the SDL_TTF page, and they only show a
"Hello World" example.

Here's the gist of what I'd like to do:


SDL_Surface *textSur;			//text surface
TTF_Font *text;
SDL_Color fontcolor;			//color for the text


oStream << score ;
theText="Score: " + oStream.str();
oStream.str("");
oStream << lives ;
theText+="\nLives: " + oStream.str();

textSur=TTF_RenderText_Solid(text,theText.c_str(),fontcolor);

This doesn't properly go down a line, however. It ends up giving me something
that looks like this:
Score: 21391\█Lives: 3

Is there some way I can get it to print out multiple lines without having to
have a different surface for every line? I'd imagine there is, but I don't know
what to do.





More information about the SDL mailing list