Sign in to follow this  

FTGL-Problems again

Recommended Posts

Hey Guys, Don't know if this is the right place to post this, but if it's not plz just move the topic. Now to my problem: I finally got FTGL to work (yes, i managed the linking stuff ;) ), but now i'm running into the next problem. ( I guess it's actually pretty simple, but i just can't figure it out ) The only thing i'm trying to do is to show the position of the player in the tilegrid (something like "tile x/y: 1/2"), but I don't know how to do that with the render-function. Is there some way to use that function with something other than const chars? I first thought it would work just like font.Render("text %d", 1), but obviously this does'nt do it at all. I hope you can help me.

Share this post

Link to post
Share on other sites
create a buffer on the stack (or heap, whichever is cleaner) and pass that:

char buffer[256]; //make sure it's long enough
int myIntVar = 1;

sprintf( buffer, "text %d", myIntVar ); //use snprintf instead cause it's safer

font.Render( buffer );

Or better, use std::string instead. I'm just too lazy to look up the syntax to retrieve the buffer from a std::string.


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