Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 30, 2005, 5:20:21 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: glmenu progressbar corrected, pnode modifications

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/glmenu/glmenu_imagescreen.cc

    r3658 r3675  
    110110void GLMenuImageScreen::draw ()
    111111{
    112   /*
    113   // Display a quad texture to the screen
    114   glEnable(GL_TEXTURE_2D);
    115   glBegin(GL_QUADS);
    116  
    117   // Display the top left vertice
    118   glTexCoord2f(0.0f, 1.0f);
    119   glVertex3f(-2.5, 2.5, 0);
    120  
    121   // Display the bottom left vertice
    122   glTexCoord2f(0.0f, 0.0f);
    123   glVertex3f(-2.5, -2.5, 0);
    124  
    125   // Display the bottom right vertice
    126   glTexCoord2f(1.0f, 0.0f);
    127   glVertex3f(2.5, -2.5, 0);
    128  
    129   // Display the top right vertice
    130   glTexCoord2f(1.0f, 1.0f);
    131   glVertex3f(2.5, 2.5, 0);
    132 
    133   glEnd();
    134   glEnable(GL_TEXTURE_2D); 
    135   */
    136112
    137113  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
     114
     115
     116  //PRINTF()();
     117  printf("GLMenuImagEscreen::draw() - drawing step %i/%i\n",
     118         this->currentValue, this->maxValue);
    138119
    139120  /* screen size */
     
    154135  int barWidth = 230;
    155136  int barHeight = 30;
    156 
    157   int val = (int)((float)this->currentValue/(float)this->maxValue) * barWidth;
     137 
     138  float val = ((float)this->currentValue/(float)this->maxValue) * barWidth;
     139  if( val > (float)barWidth)
     140    val = (float)barWidth;
    158141
    159142  glMatrixMode(GL_PROJECTION);
     
    170153  glDisable(GL_LIGHTING);
    171154
     155  /* draw the progress bar */
    172156  glBegin(GL_QUADS);
    173157  glColor3f(0.96, 0.84, 0.34);
    174158  glVertex2i(barX, barY);
    175   glVertex2i(barX + val, barY);
    176   glVertex2i(barX + val, barY + barHeight);
     159  glVertex2i(barX + (int)val, barY);
     160  glVertex2i(barX + (int)val, barY + barHeight);
    177161  glVertex2i(barX, barY + barHeight);
    178162  glColor3f(1.0, 1.0, 1.0);
     
    223207  glPopAttrib();
    224208
    225   SDL_GL_SwapBuffers();                   
     209  SDL_GL_SwapBuffers();             
    226210}
    227211 
Note: See TracChangeset for help on using the changeset viewer.