Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5380 in orxonox.OLD for branches/2d-recalc/src/lib/gui


Ignore:
Timestamp:
Oct 15, 2005, 1:49:17 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: some 2d-adaptions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2d-recalc/src/lib/gui/gl_gui/glmenu/glmenu_imagescreen.cc

    r5373 r5380  
    200200/**
    201201 *  draws the ImageScreen to the screenbuffer
     202 * @todo redesign this whole function, as it is deprecated.
    202203*/
    203204void GLMenuImageScreen::draw ()
     
    209210
    210211  /* screen size */
    211   int screenWidth = GraphicsEngine::getInstance()->getResolutionX();
    212   int screenHeight = GraphicsEngine::getInstance()->getResolutionY();
    213 
    214   int imageWidth = (int)(screenWidth * this->scaleX);
    215   int imageHeight = (int)(screenHeight * this->scaleY);
    216 
    217   int offsetX = (int)(this->offsetX * screenWidth);
    218   int offsetY = (int)(this->offsetY * screenHeight);
     212  float screenWidth = 1;//GraphicsEngine::getInstance()->getResolutionX();
     213  float screenHeight = 1;//GraphicsEngine::getInstance()->getResolutionY();
     214
     215  float imageWidth = (screenWidth * this->scaleX);
     216  float imageHeight = (screenHeight * this->scaleY);
     217
     218  float offsetX = (this->offsetX * screenWidth);
     219  float offsetY = (this->offsetY * screenHeight);
    219220
    220221  /* loadbar pos */
    221   int barX = (int)(this->barX *screenWidth);
    222   int barY = (int)(this->barY *screenHeight);
    223   int barW = (int)(this->barW *screenWidth);
    224   int barH = (int)(this->barH *screenHeight);
     222  float barX = (this->barX *screenWidth);
     223  float barY = (this->barY *screenHeight);
     224  float barW = (this->barW *screenWidth);
     225  float barH = (this->barH *screenHeight);
    225226
    226227  float val = (float)this->currentValue/(float)this->maxValue;
     
    234235  backMat->select();
    235236  glBegin(GL_TRIANGLE_STRIP);
    236   glTexCoord2i(0, 1); glVertex2i(offsetX, offsetY + imageHeight);
    237   glTexCoord2i(1, 1); glVertex2i(offsetX +imageWidth, offsetY + imageHeight);
    238   glTexCoord2i(0, 0); glVertex2i(offsetX, offsetY);
    239   glTexCoord2i(1, 0); glVertex2i(offsetX + imageWidth, offsetY);
     237  glTexCoord2i(0, 1); glVertex2f(offsetX, offsetY + imageHeight);
     238  glTexCoord2i(1, 1); glVertex2f(offsetX +imageWidth, offsetY + imageHeight);
     239  glTexCoord2i(0, 0); glVertex2f(offsetX, offsetY);
     240  glTexCoord2i(1, 0); glVertex2f(offsetX + imageWidth, offsetY);
    240241  glEnd();
    241242
     
    244245  glBegin(GL_LINE_LOOP);
    245246  glColor3f(1.0, 1.0, 1.0);
    246   glVertex2i(barX - 2, barY - 2);
    247   glVertex2i(barX + barW + 2, barY - 2);
    248   glVertex2i(barX + barW + 2, barY + barH + 2);
    249   glVertex2i(barX - 2, barY + barH + 2);
     247  glVertex2f(barX - .01, barY - .01);
     248  glVertex2f(barX + barW + .01, barY - .01);
     249  glVertex2f(barX + barW + .01, barY + barH + .01);
     250  glVertex2f(barX - .01, barY + barH + .01);
    250251  glColor3f(1.0, 1.0, 1.0);
    251252  glEnd();
     
    254255  barMat->select();
    255256  glBegin(GL_TRIANGLE_STRIP);
    256   glTexCoord2f(0,   1); glVertex2i(barX, barY + barH);
    257   glTexCoord2f(val, 1); glVertex2i(barX + (int)(val * this->barW * (float)screenWidth), barY + barH);
    258   glTexCoord2f(0,   0); glVertex2i(barX, barY);
    259   glTexCoord2f(val, 0); glVertex2i(barX + (int)(val * this->barW * (float)screenWidth), barY);
     257  glTexCoord2f(0,   1); glVertex2f(barX, barY + barH);
     258  glTexCoord2f(val, 1); glVertex2f(barX + (val * this->barW * (float)screenWidth), barY + barH);
     259  glTexCoord2f(0,   0); glVertex2f(barX, barY);
     260  glTexCoord2f(val, 0); glVertex2f(barX + (val * this->barW * (float)screenWidth), barY);
    260261  glEnd();
    261262
     
    263264    glBegin(GL_QUADS);
    264265    glColor3f(0.0, 0.0, 0.0);
    265     glVertex2i(barX, barY);
    266     glVertex2i(barX + barWidth, barY);
    267     glVertex2i(barX + barWidth, barY + barHeight);
    268     glVertex2i(barX, barY + barHeight);
     266    glVertex2f(barX, barY);
     267    glVertex2f(barX + barWidth, barY);
     268    glVertex2f(barX + barWidth, barY + barHeight);
     269    glVertex2f(barX, barY + barHeight);
    269270    glColor3f(1.0, 1.0, 1.0);
    270271    glEnd();
     
    273274    glBegin(GL_QUADS);
    274275    glColor3f(0.0, 0.0, 0.0);
    275     glVertex2i(barX-1, barY-1);
    276     glVertex2i(barX + barWidth +1, barY-1);
    277     glVertex2i(barX + barWidth+1, barY + barHeight+1);
    278     glVertex2i(barX - 1, barY + barHeight +1);
     276    glVertex2f(barX-1, barY-1);
     277    glVertex2f(barX + barWidth +1, barY-1);
     278    glVertex2f(barX + barWidth+1, barY + barHeight+1);
     279    glVertex2f(barX - 1, barY + barHeight +1);
    279280    glColor3f(1.0, 1.0, 1.0);
    280281    glEnd();
Note: See TracChangeset for help on using the changeset viewer.