Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualHAM

Posted 18 January 2013 - 03:15 AM

You might not have provided enough information for someone to help.  But I'll take a stab.  Also I think you have a typo and missed a comma in the code you did post.

 

I am assuming 'score' is an int and the function, TTF_RenderText_Solid is expecting a char* for the second arguement.

 

A simple way to do this would be:

 

 

 

char textBuffer[64];

sprintf(textBuffer, "%d", score);  // Write the int 'score' into a char buffer

TTF_RenderText_Solid(font, textBuffer, textColor);

 


sprintf works just like printf but writes into a char buffer instead of standard out.

 

The error you received was pretty straight forward.  You were trying to use a variable of type 'int' when a variable of type 'char*' was expected.


#1HAM

Posted 18 January 2013 - 03:15 AM

You might not have provided enough information for someone to help.  But I'll take a stab.  Also I think you have a typo and missed a comma in the code you did post.

 

I am assuming 'score' is an int and the function, TTF_RenderText_Solid is expecting a char* for the second arguement.

 

A simple way to do this would be:

 


 

char textBuffer[64];

sprintf(textBuffer, "%d", score);  // Write the int 'score' into a char buffer

TTF_RenderText_Solid(font, textBuffer, textColor);

 


sprintf works just like printf but writes it into a char buffer instead standard out.

The error you received was pretty straight forward.  You were trying to use a variable of type 'int' when a variable of type 'char*' was expected.


PARTNERS