Advertisement Jump to content
Sign in to follow this  
kzar

Writing a sdl_ttf function

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

In my game I need to display lots of different text so ovbiously I need to seperate myself from sdl_ttf a bit with some code. I made a function called show_fps() and then one called show_lives() but you can see having 1000 functions to show each bit of text is a bad idea. I can see how to make a function to add an item to a linked list with a string, font, size, position etc for each lump of text but theres somthing I'm not sure about. Sometimes the text will stay the same throughout but for somthing like displaying the frames per second it needs a variable for the number so that it can change each time. Now if I called my add text function I would want to be able to use variables in the string like printf does, but I have no clue how to do it. If you can think of a better way to do this / explain how you did it instead I would be very interested as well. Thanks, David

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!