Changeset 4597 in orxonox.OLD for orxonox/trunk/src/glmenu
- Timestamp:
- Jun 11, 2005, 12:55:48 AM (20 years ago)
- Location:
- orxonox/trunk/src/glmenu
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/glmenu/glmenu_imagescreen.cc
r4453 r4597 1 1 2 2 3 /* 3 /* 4 4 orxonox - the future of 3D-vertical-scrollers 5 5 … … 13 13 ### File Specific: 14 14 main-programmer: Patrick Boenzli 15 co-programmer: 15 co-programmer: 16 16 */ 17 17 … … 28 28 using namespace std; 29 29 /** 30 \brief standard constructor31 */32 GLMenuImageScreen::GLMenuImageScreen ()33 {34 this->init();35 }36 37 /**38 30 \param root The Element to load the GLMenu from 39 31 */ 40 32 GLMenuImageScreen::GLMenuImageScreen(const TiXmlElement* root) 41 33 { 42 this->init();43 this->loadParams(root);44 }45 46 /**47 \brief Loads a GLMenu from an inputElement48 \param root The Element to load the GLMenu from49 */50 void GLMenuImageScreen::loadParams(const TiXmlElement* root)51 {52 LoadParam<GLMenuImageScreen>(root, "BackgroundImage", this, &GLMenuImageScreen::setBackgroundImage)53 .describe("sets the image to load onto the loadscreen");54 55 LoadParam<GLMenuImageScreen>(root, "BackgroundPS", this, &GLMenuImageScreen::setPosScale)56 .describe("The Position and Scale of the Background Image in %(0-1.0). PosX, PosY, SizeX, SizeY");57 58 LoadParam<GLMenuImageScreen>(root, "BarImage", this, &GLMenuImageScreen::setBarImage)59 .describe("sets the image of the LoadingBar");60 61 LoadParam<GLMenuImageScreen>(root, "BarPS", this, &GLMenuImageScreen::setBarPosScale)62 .describe("The Position and Scale of the Loading Bar in %(0-1.0). PosX, PosY, SizeX, SizeY");63 64 LoadParam<GLMenuImageScreen>(root, "ElementCount", this, &GLMenuImageScreen::setMaximum)65 .describe("The Count of elements to load into the bar (this is only a maximum value)");66 }67 68 /**69 \brief standard deconstructor70 \todo this deconstructor is not jet implemented - do it71 */72 GLMenuImageScreen::~GLMenuImageScreen()73 {74 delete this->backMat;75 delete this->barMat;76 }77 78 /**79 \brief function to init the screen80 */81 void GLMenuImageScreen::init ()82 {83 34 this->setClassID(CL_GLMENU_IMAGE_SCREEN, "GLMenuImageScreen"); 84 35 this->setName("GLMenuLoadScreen"); 85 36 // Select Our VU Meter Background Texture 86 37 this->backMat = new Material("load_screen"); … … 92 43 this->setBarPosScale( .6, .75, .3, .1); 93 44 // End of Background image code. 94 } 95 96 /** 45 46 if (root) 47 this->loadParams(root); 48 } 49 50 /** 51 \brief Loads a GLMenu from an inputElement 52 \param root The Element to load the GLMenu from 53 */ 54 void GLMenuImageScreen::loadParams(const TiXmlElement* root) 55 { 56 LoadParam<GLMenuImageScreen>(root, "BackgroundImage", this, &GLMenuImageScreen::setBackgroundImage) 57 .describe("sets the image to load onto the loadscreen"); 58 59 LoadParam<GLMenuImageScreen>(root, "BackgroundPS", this, &GLMenuImageScreen::setPosScale) 60 .describe("The Position and Scale of the Background Image in %(0-1.0). PosX, PosY, SizeX, SizeY"); 61 62 LoadParam<GLMenuImageScreen>(root, "BarImage", this, &GLMenuImageScreen::setBarImage) 63 .describe("sets the image of the LoadingBar"); 64 65 LoadParam<GLMenuImageScreen>(root, "BarPS", this, &GLMenuImageScreen::setBarPosScale) 66 .describe("The Position and Scale of the Loading Bar in %(0-1.0). PosX, PosY, SizeX, SizeY"); 67 68 LoadParam<GLMenuImageScreen>(root, "ElementCount", this, &GLMenuImageScreen::setMaximum) 69 .describe("The Count of elements to load into the bar (this is only a maximum value)"); 70 } 71 72 /** 73 \brief standard deconstructor 74 \todo this deconstructor is not jet implemented - do it 75 */ 76 GLMenuImageScreen::~GLMenuImageScreen() 77 { 78 delete this->backMat; 79 delete this->barMat; 80 } 81 82 /** 97 83 \brief sets the background image name 98 84 \param backImageName name of the backgroun-image … … 191 177 192 178 193 /** 179 /** 194 180 \brief call this to trigger a progress event 195 181 196 182 this has to redraw the progress bar and the whole image 197 183 */ … … 211 197 glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); 212 198 213 PRINTF(4)("GLMenuImagEscreen::draw() - drawing step %i/%i\n", 214 199 PRINTF(4)("GLMenuImagEscreen::draw() - drawing step %i/%i\n", 200 this->currentValue, this->maxValue); 215 201 216 202 /* screen size */ 217 203 int screenWidth = GraphicsEngine::getInstance()->getResolutionX(); 218 204 int screenHeight = GraphicsEngine::getInstance()->getResolutionY(); 219 205 220 206 int imageWidth = (int)(screenWidth * this->scaleX); 221 207 int imageHeight = (int)(screenHeight * this->scaleY); … … 229 215 int barW = (int)(this->barW *screenWidth); 230 216 int barH = (int)(this->barH *screenHeight); 231 217 232 218 float val = (float)this->currentValue/(float)this->maxValue; 233 219 234 220 if( val > barW) 235 221 val = barW; … … 245 231 glTexCoord2i(1, 0); glVertex2i(offsetX + imageWidth, offsetY); 246 232 glEnd(); 247 233 248 234 glDisable(GL_TEXTURE_2D); 249 235 /* draw white border */ … … 256 242 glColor3f(1.0, 1.0, 1.0); 257 243 glEnd(); 258 244 259 245 /* draw the progress bar */ 260 246 barMat->select(); … … 275 261 glColor3f(1.0, 1.0, 1.0); 276 262 glEnd(); 277 278 /* draw black border 263 264 /* draw black border 279 265 glBegin(GL_QUADS); 280 266 glColor3f(0.0, 0.0, 0.0); … … 285 271 glColor3f(1.0, 1.0, 1.0); 286 272 glEnd(); 287 273 288 274 */ 289 275 290 276 GraphicsEngine::leave2DMode(); 291 277 292 SDL_GL_SwapBuffers(); 293 } 294 295 278 SDL_GL_SwapBuffers(); 279 } 280 281 -
orxonox/trunk/src/glmenu/glmenu_imagescreen.h
r4453 r4597 1 /*! 1 /*! 2 2 \file glmenu_imagescreen.h 3 3 \brief class to display a LoadScreen … … 16 16 17 17 public: 18 GLMenuImageScreen (); 19 GLMenuImageScreen (const TiXmlElement* root); 18 GLMenuImageScreen (const TiXmlElement* root = NULL); 20 19 void loadParams(const TiXmlElement* root); 21 20 virtual ~GLMenuImageScreen (); 22 21 23 void init();22 void draw (); 24 23 25 void draw ();26 27 24 void setBackgroundImage(const char* backImageName); 28 25 void setPosition(float offsetX, float offsetY);
Note: See TracChangeset
for help on using the changeset viewer.