Sign in to follow this  
Answer3

Hello I have a problem with text in SDL

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this