Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualJTippetts

Posted 06 March 2013 - 11:28 AM

I am almost done with my breakout  game. I have a small problem with the scoring system. I have been able to print to the screen the numbers used in scoring. Basically I can print out 100 and then overwrite it with 200 points.  What want to do is print the number then print black numbers to overwrite the text and then print the next highest score. here is my 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);
		drawBitmapText(str,4.0f,2.0f,0.0f);
	}
	if(bricks[2][3]==true)
	{
		n+=100;
		str=itoa(n,buffer,10);
		drawBitmapText(str,4.0f,2.0f,0.0f);
	}
	if(bricks[2][2]==true)
	{
		n+=100;
		str=itoa(n,buffer,10);
		drawBitmapText(str,4.0f,2.0f,0.0f);
	}
	if(bricks[2][1]==true)
	{
		n+=100;
		str=itoa(n,buffer,10);
		drawBitmapText(str,4.0f,2.0f,0.0f);
	}
	if(bricks[2][0]==true)
	{
		n+=100;
		str=itoa(n,buffer,10);
		drawBitmapText(str,4.0f,2.0f,0.0f);
	}
 

: Fix code tags


#2JTippetts

Posted 06 March 2013 - 11:23 AM

I am almost done with my breakout  game. I have a small problem with the scoring system. I have been able to print to the screen the numbers used in scoring. Basically I can print out 100 and then overwrite it with 200 points.  What want to do is print the number then print black numbers to overwrite the text and then print the next highest score. here is my 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);

 
    drawBitmapText(str,4.0f,2.0f,0.0f);    

 
    }


 
    
 
if(bricks[2][3]==true)

 
    {

 
    n+=100;

 
    str=itoa(n,buffer,10);

 
    drawBitmapText(str,4.0f,2.0f,0.0f);    

 
    }


 
    
 
if(bricks[2][2]==true)

 
    {

 
    n+=100;

 
    str=itoa(n,buffer,10);

 
    drawBitmapText(str,4.0f,2.0f,0.0f);    

 
    }


 
    
 
if(bricks[2][1]==true)

 
    {

 
    n+=100;

 
    str=itoa(n,buffer,10);

 
    drawBitmapText(str,4.0f,2.0f,0.0f);    

 
    }


 
    
 
if(bricks[2][0]==true)

 
    {

 
    n+=100;

 
    str=itoa(n,buffer,10);

 
    drawBitmapText(str,4.0f,2.0f,0.0f);    

 
    }
 

: Fix code tags


#1phil67rpg

Posted 05 March 2013 - 08:28 PM

I am almost done with my breakout  game. I have a small problem with the scoring system. I have been able to print to the screen the numbers used in scoring. Basically I can print out 100 and then overwrite it with 200 points.  What want to do is print the number then print black numbers to overwrite the text and then print the next highest score. here is my code.

[code=auto:0]

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);


 

    drawBitmapText(str,4.0f,2.0f,0.0f);    


 

    }



 

    

 

if(bricks[2][3]==true)


 

    {


 

    n+=100;


 

    str=itoa(n,buffer,10);


 

    drawBitmapText(str,4.0f,2.0f,0.0f);    


 

    }



 

    

 

if(bricks[2][2]==true)


 

    {


 

    n+=100;


 

    str=itoa(n,buffer,10);


 

    drawBitmapText(str,4.0f,2.0f,0.0f);    


 

    }



 

    

 

if(bricks[2][1]==true)


 

    {


 

    n+=100;


 

    str=itoa(n,buffer,10);


 

    drawBitmapText(str,4.0f,2.0f,0.0f);    


 

    }



 

    

 

if(bricks[2][0]==true)


 

    {


 

    n+=100;


 

    str=itoa(n,buffer,10);


 

    drawBitmapText(str,4.0f,2.0f,0.0f);    


 

    }

 

[code=auto:0]

 


PARTNERS