Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 1, 2005, 9:50:30 AM (19 years ago)
Author:
bensch
Message:

orxonox/branches/trackManager: merged trunk back to trackManager
merged with command
svn merge -r 3369:HEAD trunk/ branches/trackManager
resoloved conflicts in favor of the trunk.

Location:
orxonox/branches/trackManager
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/trackManager

    • Property svn:externals set to
  • orxonox/branches/trackManager/src/glmenu_imagescreen.cc

    r3369 r3430  
    1818
    1919#include "glmenu_imagescreen.h"
    20 #include "importer/texture.h"
     20
     21#include "importer/material.h"
    2122
    2223using namespace std;
    2324
     25GLMenuImageScreen* GLMenuImageScreen::singletonRef = 0;
     26
     27GLMenuImageScreen* GLMenuImageScreen::getInstance()
     28{
     29  if( singletonRef == NULL)
     30    singletonRef = new GLMenuImageScreen ();
     31  return singletonRef;
     32}
    2433
    2534/**
     
    3948   \todo this deconstructor is not jet implemented - do it
    4049*/
    41 GLMenuImageScreen::~GLMenuImageScreen () {}
     50GLMenuImageScreen::~GLMenuImageScreen()
     51{
     52  if (backMat)
     53    delete backMat;
     54}
    4255
    4356
     
    5871  glMatrixMode(GL_MODELVIEW);
    5972
    60   this->backTex = new Texture();
    61   this->backTex->loadImage("orx_tex.bmp");
    62 
    6373  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    6474  glLoadIdentity();
     
    7181 
    7282  // Select Our VU Meter Background Texture
    73   this->backTex = new Texture();
    74   this->backTex->loadImage("load_screen.jpg");
     83  this->backMat = new Material("load_screen");
     84  this->backMat->setDiffuseMap("../data/pictures/load_screen.jpg");
     85  this->maxValue = 10;
     86  this->currentValue = 0;
    7587
    7688  // End of Background image code.
     
    126138  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    127139
    128   // Screen Size.
     140  /* screen size */
    129141  int screenWidth = 640;
    130142  int screenHeight = 480;
    131143 
    132   // Set Image Size.
     144  /* set image size */
    133145  int imageWidth = 640;
    134146  int imageHeight = 480;
    135147 
    136   // Start pos of image.
     148  /* start pos of image */
    137149  int offsetX = (screenWidth - imageWidth)/2;
    138150  int offsetY = (screenHeight - imageHeight)/2;
    139151 
    140   glEnable(GL_BLEND);
    141   glEnable(GL_TEXTURE_2D);
    142 
    143   glPushAttrib(GL_LIGHTING_BIT | GL_TRANSFORM_BIT);
    144  
    145   glDisable(GL_LIGHTING);
     152  /* loadbar pos */
     153  int barX = 390;
     154  int barY = 50;
     155  int barWidth = 230;
     156  int barHeight = 30;
     157
     158  int val = (int)((float)this->currentValue/(float)this->maxValue) * barWidth;
     159
    146160  glMatrixMode(GL_PROJECTION);
    147161  glPushMatrix();
     
    152166  glLoadIdentity();
    153167  glPushMatrix();
     168
    154169  glEnable(GL_BLEND);
    155 
     170  glPushAttrib(GL_LIGHTING_BIT | GL_TRANSFORM_BIT);
     171  glDisable(GL_LIGHTING);
     172
     173  backMat->select();
     174  glBegin(GL_QUADS);
     175  glColor3f(0.96, 0.84, 0.34);
     176  glVertex2i(barX, barY);
     177  glVertex2i(barX + val, barY);
     178  glVertex2i(barX + val, barY + barHeight);
     179  glVertex2i(barX, barY + barHeight);
     180  glColor3f(1.0, 1.0, 1.0);
     181  glEnd();
     182
     183  glBegin(GL_QUADS);
     184  glColor3f(0.0, 0.0, 0.0);
     185  glVertex2i(barX, barY);
     186  glVertex2i(barX + barWidth, barY);
     187  glVertex2i(barX + barWidth, barY + barHeight);
     188  glVertex2i(barX, barY + barHeight);
     189  glColor3f(1.0, 1.0, 1.0);
     190  glEnd();
     191
     192  /* draw black border */
     193  glBegin(GL_QUADS);
     194  glColor3f(0.0, 0.0, 0.0);
     195  glVertex2i(barX-1, barY-1);
     196  glVertex2i(barX + barWidth +1, barY-1);
     197  glVertex2i(barX + barWidth+1, barY + barHeight+1);
     198  glVertex2i(barX - 1, barY + barHeight +1);
     199  glColor3f(1.0, 1.0, 1.0);
     200  glEnd();
     201
     202  /* draw white border */
     203  glBegin(GL_QUADS);
     204  glColor3f(1.0, 1.0, 1.0);
     205  glVertex2i(barX-2, barY-2);
     206  glVertex2i(barX + barWidth +2, barY-2);
     207  glVertex2i(barX + barWidth+2, barY + barHeight+2);
     208  glVertex2i(barX - 2, barY + barHeight +2);
     209  glColor3f(1.0, 1.0, 1.0);
     210  glEnd();
     211
     212  glEnable(GL_TEXTURE_2D);
    156213  glBegin(GL_QUADS);
    157214  glTexCoord2i(0, 0); glVertex2i(offsetX, offsetY);
    158   glTexCoord2i(1, 0 ); glVertex2i(offsetX + imageWidth, offsetY);
    159   glTexCoord2i( 1, 1 ); glVertex2i(offsetX + imageWidth, offsetY + imageHeight);
    160   glTexCoord2i( 0, 1 ); glVertex2i(offsetX, offsetY + imageHeight);
    161   glEnd();
    162 
     215  glTexCoord2i(1, 0); glVertex2i(offsetX + imageWidth, offsetY);
     216  glTexCoord2i(1, 1); glVertex2i(offsetX + imageWidth, offsetY + imageHeight);
     217  glTexCoord2i(0, 1); glVertex2i(offsetX, offsetY + imageHeight);
     218  glEnd();
    163219  glDisable(GL_TEXTURE_2D);
    164 
    165   glBegin(GL_QUADS);
    166   glColor3f(1.0, 0.0, 0.0);
    167   glVertex2i(100, 100);
    168   glVertex2i(200, 100);
    169   glVertex2i(200, 150);
    170   glVertex2i(100, 150);
    171   glEnd();
    172 
    173220
    174221  glDisable(GL_BLEND);
     
    179226
    180227  SDL_GL_SwapBuffers();                   
    181   SDL_Delay(1000);
    182228}
    183229 
     
    213259   \param maximum of steps
    214260*/
    215 void GLMenuImageScreen::setMaximum(int maxStep)
    216 {
    217   this->maxStep = maxStep;
     261void GLMenuImageScreen::setMaximum(int maxValue)
     262{
     263  this->maxValue = maxValue;
    218264}
    219265
     
    224270int GLMenuImageScreen::getMaximum()
    225271{
    226   return this->maxStep;
     272  return this->maxValue;
    227273}
    228274
     
    256302{
    257303  this->currentValue++;
    258 }
     304  this->draw();
     305}
Note: See TracChangeset for help on using the changeset viewer.