Changeset 4104 in orxonox.OLD for orxonox/trunk/src/glmenu
- Timestamp:
- May 7, 2005, 1:55:44 PM (20 years ago)
- Location:
- orxonox/trunk/src/glmenu
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/glmenu/glmenu_imagescreen.cc
r4101 r4104 29 29 /** 30 30 \brief standard constructor 31 32 \todo this constructor is not jet implemented - do it33 31 */ 34 32 GLMenuImageScreen::GLMenuImageScreen () 35 33 { 36 this->setClassName ("GLMenuImageScreen");37 34 this->init(); 38 35 } 39 36 40 37 /** 38 \param root The Element to load the GLMenu from 39 */ 41 40 GLMenuImageScreen::GLMenuImageScreen (TiXmlElement* root) 42 41 { 43 42 this->init(); 44 43 this->load(root); 44 45 } 46 47 /** 48 \brief Loads a GLMenu from an inputElement 49 \param root The Element to load the GLMenu from 50 51 Tags are: 52 \li BackgroundImage STRING: the background Image 53 \li BarImage: STRING: the Image on the Bar 54 \li BackgroundPS: FLOAT FLOAT FLOAT FLOAT: posX posY scaleX scaleY 55 \li BarPS: FLOAT FLOAT FLOAT FLOAT: posX posY scaleX scaleY 56 \li ElementCount: INT: how many elements will be loaded 57 */ 58 void GLMenuImageScreen::load(TiXmlElement* root) 59 { 45 60 const char* string; 46 61 … … 49 64 if( string != NULL) 50 65 this->setBackgroundImage(string); 51 66 67 string = grabParameter(root, "BackgroundPS"); 68 if (string != NULL) 69 { 70 float f1, f2, f3, f4; 71 sscanf (string, "%f %f %f %f", &f1, &f2, &f3, &f4); 72 this->setPosition(f1,f2); 73 this->setScale(f3,f4); 74 } 75 52 76 string = grabParameter( root, "BarImage"); 53 77 if (string != NULL) 54 78 this->setBarImage(string); 55 56 } 57 79 string = grabParameter(root, "BarPS"); 80 if (string != NULL) 81 { 82 float f1, f2, f3, f4; 83 sscanf (string, "%f %f %f %f", &f1, &f2, &f3, &f4); 84 this->setBarPosScale(f1,f2,f3,f4); 85 } 86 87 string = grabParameter( root, "ElementCount"); 88 if (string != NULL) 89 this->setMaximum(atoi(string)); 90 } 58 91 59 92 /** … … 72 105 void GLMenuImageScreen::init () 73 106 { 107 this->setClassName ("GLMenuImageScreen"); 108 74 109 // Select Our VU Meter Background Texture 75 110 this->backMat = new Material("load_screen"); … … 200 235 201 236 PRINTF(4)("GLMenuImagEscreen::draw() - drawing step %i/%i\n", 202 this->currentValue, this->maxValue);237 this->currentValue, this->maxValue); 203 238 204 239 /* screen size */ … … 218 253 int barH = (int)(this->barH *screenHeight); 219 254 220 int val = (int)(((float)this->currentValue/(float)this->maxValue)221 * this->barW * (float)screenWidth);255 float val = (float)this->currentValue/(float)this->maxValue; 256 222 257 if( val > barW) 223 258 val = barW; … … 248 283 barMat->select(); 249 284 glBegin(GL_TRIANGLE_STRIP); 250 glTexCoord2 i(0, 0); glVertex2i(barX, barY + barH);251 glTexCoord2 i(1, 0); glVertex2i(barX + val, barY + barH);252 glTexCoord2 i(0, 1); glVertex2i(barX, barY);253 glTexCoord2 i(1, 1); glVertex2i(barX + val, barY);285 glTexCoord2f(0, 0); glVertex2i(barX, barY + barH); 286 glTexCoord2f(val, 0); glVertex2i(barX + (int)(val * this->barW * (float)screenWidth), barY + barH); 287 glTexCoord2f(0, 1); glVertex2i(barX, barY); 288 glTexCoord2f(val, 1); glVertex2i(barX + (int)(val * this->barW * (float)screenWidth), barY); 254 289 glEnd(); 255 290 -
orxonox/trunk/src/glmenu/glmenu_imagescreen.h
r4101 r4104 18 18 GLMenuImageScreen (); 19 19 GLMenuImageScreen (TiXmlElement* root); 20 void load(TiXmlElement* root); 20 21 virtual ~GLMenuImageScreen (); 21 22
Note: See TracChangeset
for help on using the changeset viewer.