Group3_FinalProject/HUD.cpp
// draws the BG and text elements of the HUD
draws the BG and text elements of the HUD
draws the BG and text elements of the HUD
void HUD::draw( )
{
	char numberBuffer[21];
	GLfloat startX = WINDOW_WIDTH/13.0f;
	GLfloat startY = WINDOW_HEIGHT - WINDOW_HEIGHT/20.0f;
	bg->draw();
	textWriter.print( startX, startY - 1*WINDOW_HEIGHT/20.0f, titleString, vec3(0.0f, 0.0f, 0.0f) );
	textWriter.print( startX, startY - 2*WINDOW_HEIGHT/20.0f, scoreString, vec3(0.0f, 0.0f, 0.0f)  );
	sprintf(numberBuffer,"%i",score);
	textWriter.print( startX*2, startY - 3*WINDOW_HEIGHT/20.0f, numberBuffer, vec3(0.0f, 0.0f, 0.0f) );
	textWriter.print( startX, startY - 4*WINDOW_HEIGHT/20.0f, ballString, vec3(0.0f, 0.0f, 0.0f)  );
	sprintf(numberBuffer,"%i",ballStock);
	textWriter.print( startX*2, startY - 5*WINDOW_HEIGHT/20.0f, numberBuffer, vec3(0.0f, 0.0f, 0.0f)  );
}
void HUD :: draw ( ) { char numberBuffer [ 21 ] ; GLfloat startX = WINDOW_WIDTH / 13.0f ; GLfloat startY = WINDOW_HEIGHT - WINDOW_HEIGHT / 20.0f ; bg -> draw ( ) ; textWriter . print ( startX , startY - 1 * WINDOW_HEIGHT / 20.0f , titleString , vec3 ( 0.0f , 0.0f , 0.0f ) ) ; textWriter . print ( startX , startY - 2 * WINDOW_HEIGHT / 20.0f , scoreString , vec3 ( 0.0f , 0.0f , 0.0f ) ) ; sprintf ( numberBuffer , " " , score ) ; textWriter . print ( startX * 2 , startY - 3 * WINDOW_HEIGHT / 20.0f , numberBuffer , vec3 ( 0.0f , 0.0f , 0.0f ) ) ; textWriter . print ( startX , startY - 4 * WINDOW_HEIGHT / 20.0f , ballString , vec3 ( 0.0f , 0.0f , 0.0f ) ) ; sprintf ( numberBuffer , " " , ballStock ) ; textWriter . print ( startX * 2 , startY - 5 * WINDOW_HEIGHT / 20.0f , numberBuffer , vec3 ( 0.0f , 0.0f , 0.0f ) ) ; }
draws the BG and text elements of the HUD
draws the BG and text elements of the HUD
// create a string for score // create a string for ballStock