How can i output an integer variable to the screen, textout only allows strings.
Thanks.
How can i output an integer variable to the screen, textout only allows strings.
Thanks.
I'm not sure if there are any functions in allegro to output integers and whatnot, but the most logical thing to do at this step would be convert the integers to a string and print them out...
char pszFinalString[30];
char pcszText[] = "A number: ";
int iNumber = 10;
sprintf(pszFinalString, "%s%d", pcszText, iNumber);
printf("%s\n", pszFinalString);
I think they should've documented this in the manual
textprintf() will do it.
replace the ? withCode:textprintf(screen,font,5,13,makecol(255,255,255),"%?",variable);
i - integer
g - integer
f- float
c - char
s - string
and all the other ones printf uses.
or...
Code:char prinstr[50]; sprintf(printstr, variable); textout(buffer, font, printstr, 550, 340, makecol(100, 100, 100)); //notice i drew the text to a buffer and not the screen! //the color of 100,100,100 is a gray...it goes R(red)G(green)B(blue)...