   arguments in SDL_ttf
  can someone please post a complete example on how to display a variable on the screen using ttf?i feel so dumb asking :(for example displaying mouse coordinates:mouseX = event.motion.x;mouseY = event.motion.y;then display->"Mouse X:  355" << endl (lol)"Mouse Y:  355"   
  i use a function that i got from.. someone.. lazy foo or cone 3d, or somebody, that goes like this void Draw_Text(const char* string, int x, int y, int fR, int fG, int fB);along with an initalizer to load up the fonts.  i can post it if you want.  but, you would use it with something like:char *ch;ch=new char[255];sprintf(ch,"Mouse x:%d, Mouse y:%d",event.motion.x,event.motion.y);Draw_Text(ch,screen->w/2,screen->h/2,255,255,255); //will print text left justified in white in center of screenjfh   ;Quote:Original post by flashingchickeni use a function that i got from.. someone.. lazy foo or cone 3d, or somebody, that goes like this void Draw_Text(const char* string, int x, int y, int fR, int fG, int fB);along with an initalizer to load up the fonts.  i can post it if you want.  but, you would use it with something like:char *ch;ch=new char[255];sprintf(ch,"Mouse x:%d, Mouse y:%d",event.motion.x,event.motion.y);Draw_Text(ch,screen->w/2,screen->h/2,255,255,255); //will print text left justified in white in center of screenjfhDon't use that, while on faster pc's this can be a really small bottleneck, it is a bottleneck none the less because you load and destroy the font and surface each frame.I suggest looking into <sstream> and std::stringstream:std::string text = "";std::stringstream ss;ss << mouse_pos_in_ints;text = ss.str();// now use text.c_str();  i rearranged the function so that the font initilaztion (sp?) is done only once, so, its only a surface create/destroy.though, as far as im aware, using "char * ch....,sprintf(...)" is the C equivilent to using what you have for sstreams.edit SDL_ttf returns a SDL_Surface so, its a necessary evil /editheres the function if you want to use it.void Draw_Text(const char* string, int x, int y, int fR, int fG, int fB){ SDL_Color foregroundColor = { fR, fG, fB };   SDL_Surface* textSurface = TTF_RenderText_Solid(font, string,   foregroundColor);   if (textSurface == NULL)    {   fprintf (stderr,"Couldn't initalize TTF");   MessageBox (0, "Error", "Error", MB_ICONHAND);    exit (2);    }   SDL_Rect textLocation = { x, y, 0, 0 };   SDL_BlitSurface(textSurface, NULL, screen, &textLocation);   SDL_FreeSurface(textSurface);};  You might be better off initializing the font, and then a surface containing "ABCDEFG....XYZabcdefg....xyz01234..9" (or better yet, every ascii character), and coming up with a mechanism where your DrawText function blits rectangles from this global font surface onto the main screen. That way, you'd get around having to create and destroy a surface everytime, but you would have to blit as many rectangles as you have characters to display. I don't know which of these is faster, so try doing a benchmark with a decent amount of text.   ;  the sdl_ttf site mentions (briefly) something to that effect.  i havent noticed a noticable slow down while having a lot of drawn text. http://jcatki.no-ip.org/SDL_ttf/SDL_ttf.html#SEC38jfh   ;  Forgive me if the syntax is incorrect as I've been working with C# for the past few years rather then C++, but I like using a templated function to convert values to strings:template <T>std::string ToString(T value){    std::stringstream ss;    ss << value;    return ss.str();}Once you have that, you can pass ToString(mouseX).c_str() to the SDL_ttf functions.   