I'm trying to display a score to the screen on a small and very basic game.
I use this function to display the word Score:
:
void drawBitmapText(char *string, int score, float r, float g, float b, float x,float y,float z) {
char *c;
glColor3f(r,g,b);
glRasterPos3f(x,y,z);
for (c=string; *c != '\0'; c++) {
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, *c); }
}
I call the above function()
using: drawBitmapText("score: ",score,0,1,0,10,220,0);
It successfully displays the word Score:
and in the right place, but the problem I'm having is including the actually int
that represents the score next to it.
How do I incorporate the int
to be displayed too? I pass it successfully.
I've tried converting it a string/char
and adding/concatenating it but it just displays random letters... Thanks.