int score = 0;
char* fixedscore=(char*)score;
.
.
.
imgTxt = TTF_RenderText_Solid( font, fixedscore, fColor );
^^ This doesn’t work – looks like fixedscore is empty or doesn’t exists.
int score = 0;
char* fixedscore=(char*)score;
.
.
.
imgTxt = TTF_RenderText_Solid( font, "Works fine", fColor );
^^ Works fine, but…
I guess converting int to char* doesn’t really work. So how do you print scores in SDL?
Oh and one more thing: why is the text so ugly?
Casting is not what you want. This code:
is the equivalent of doing:
I assume you are trying to get
fixedscoreto hold the textual value of the number in score. The easiest way using just standard C++ is viastringstream: