I am working on game scoring for a breakout game. I am able to write 100 to the screen but then I want to erase the old score and put 200 on the screen and so on. here is the code I am using.
I am almost done with my game I just need a little help. let me know if you need more code.
void drawBitmapText(char *string,float x,float y,float z) { char *c; glRasterPos3f(x, y,z); for (c=string; *c != '\0'; c++) { glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *c); } } void brick_collision() { GLint n=0; if(bricks[2][4]==true) { n+=100; str=itoa(n,buffer,10); glRasterPos3f(4.0f,2.0f,0.0f); glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, '\0'); drawBitmapText(str,4.0f,2.0f,0.0f); } if(bricks[2][3]==true) { n+=100; str=itoa(n,buffer,10); glRasterPos3f(4.0f,2.0f,0.0f); glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,'\0'); drawBitmapText(str,4.0f,2.0f,0.0f); } if(bricks[2][2]==true) { n+=100; str=itoa(n,buffer,10); glRasterPos3f(4.0f,2.0f,0.0f); glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, '\0'); drawBitmapText(str,4.0f,2.0f,0.0f); } if(bricks[2][1]==true) { n+=100; str=itoa(n,buffer,10); glRasterPos3f(4.0f,2.0f,0.0f); glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, '\0'); drawBitmapText(str,4.0f,2.0f,0.0f); } if(bricks[2][0]==true) { n+=100; str=itoa(n,buffer,10); glRasterPos3f(4.0f,2.0f,0.0f); glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, '\0'); drawBitmapText(str,4.0f,2.0f,0.0f); }
I am almost done with my game I just need a little help. let me know if you need more code.