• Advertisement
Sign in to follow this  

Hello I have a problem with text in SDL

This topic is 3317 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

Hello I have some problem with text in SDL. So that the situation: If I want start new line, I do the next thing printf("I going\n down\n"), thats working with C. But thats not working with SDL, I mean what should I do if I want to start new line? There is a special fuction to do it? I mean that I want to see "I am starting new line" on the screen, but I dont want to declare two SDL_Surface parameters. Hope for respond, thank you!

Share this post


Link to post
Share on other sites
Advertisement
Assuming you are using SDL_ttf, there is no way to do it without creating more than one SDL_Surface.

To achieve this yourself, you could write a function that takes a string as a parameter, scan the string for new lines, creates a destination surface that is large enough, then blits each line of text onto that.

Share this post


Link to post
Share on other sites
If you're not glued to SDL_ttf, you can try NFont:
http://pubpages.unh.edu/~jmb97/NFont.html

NFont has '\n' support.
In the near future, I'll be releasing an update that lets you load SDL_ttf's fonts into NFont, so you get the benefits of a bitmap font lib with the font selection of SDL_ttf.

Share this post


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

  • Advertisement