void Ruler::divideV(const int z, const int scale, void * font, const float trace, const int k)const{ char delta[5] = ""; const char base[]=""; int mult = - 1; int scale2 = scale; size_t i = scale; int i2 = mult * i; glBegin(GL_LINES); glVertex3f( clsFirst.x + trace , clsFirst.y , z );//first trace glVertex3f( clsFirst.x - trace , clsFirst.y , z ); glVertex3f( clsFirst.x + trace, clsLast.y, z );//last trace glVertex3f( clsFirst.x - trace, clsLast.y, z ); glEnd();//end lines sprintf(delta, "%s%.0f", base, 0.0); DesenhaTexto(delta, clsFirst.x + trace, clsFirst.y- 1.25f , font); sprintf(delta, "%s%.1f", base, (float)abs(clsFirst.y - clsLast.y)/scale*k); DesenhaTexto(delta, clsLast.x+ trace , clsLast.y- 1.25f , font); if( 0 > (clsFirst.y - clsLast.y)){ scale2 = - scale; mult = 1; i2 = mult * i; }//set direction parameters for(i; i<(abs(clsFirst.y - clsLast.y)); i+=scale){ i2 = mult * i; sprintf(delta, "%s%.0f", base, (float)i*k/scale); glBegin(GL_LINES); glColor3f(1 , 1 , 1); glVertex3f( clsFirst.x + trace, clsFirst.y +i2, z ); //big trace glVertex3f( clsFirst.x - trace, clsFirst.y +i2, z ); glEnd();//end line DesenhaTexto(delta, clsFirst.x + trace , clsFirst.y +i2 - 0.5f, font);//digit }//end for glBegin(GL_LINES); glColor3f(1,1,1); for(int j = clsFirst.y;(mult > 0 && j < clsLast.y) || (mult < 0 && j > clsLast.y) ; j+=(mult*scale/10)){ glVertex3f( clsFirst.x + trace/2, j , z ); glVertex3f( clsFirst.x , j , z ); }//end for little traces glEnd();//end lines }//end method
void DesenhaBotoes(){ int i; for( i = 0; i < 4;i++){ glPushMatrix(); glTranslatef(0,(i*-30),0); glColor3f(0.0,0.0,0.0); glBegin(GL_QUADS); glVertex2i( (widthJanela/2-10) , (heightJanela/2-5) ); glVertex2i( (widthJanela/2-10) , (heightJanela/2-25) ); glVertex2i( (widthJanela/2-105) , (heightJanela/2-25) ); glVertex2i( (widthJanela/2-105) , (heightJanela/2-5) ); glEnd(); DesenhaTexto(i); glPopMatrix(); } }