Changeset 1342 for code/branches/hud3/src/orxonox/hud/BarOverlayElement.cc
- Timestamp:
- May 21, 2008, 12:57:10 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hud3/src/orxonox/hud/BarOverlayElement.cc
r1329 r1342 42 42 BarOverlayElement::~BarOverlayElement(){} 43 43 44 void BarOverlayElement::init(Real leftRel, Real topRel, Real widthRel, Real heightRel, Ogre::OverlayContainer* container){44 void BarOverlayElement::init(Real leftRel, Real topRel, Real dimRel, Ogre::OverlayContainer* container){ 45 45 // init some values... 46 46 container_ = container; … … 49 49 color_ = 2; 50 50 autoColor_ = true; 51 left2Right = false; // default: right to left progress 52 53 // get window data... 54 windowW_ = GraphicsEngine::getSingleton().getWindowWidth(); 55 windowH_ = GraphicsEngine::getSingleton().getWindowHeight(); 51 left2Right = false; // default is right to left progress 56 52 leftRel_ = leftRel; 57 53 topRel_ = topRel; 58 widthRel_ = widthRel; 59 heightRel_ = heightRel; 60 61 // cálculate absolute coordinates... 62 left_ = leftRel_ * windowW_; 63 top_ = topRel_ * windowH_; 64 width_ = widthRel_ * windowW_; 65 height_ = heightRel_ * windowH_; 66 54 dimRel_ = dimRel; 55 67 56 // create background... 68 57 background_ = static_cast<OverlayContainer*>(om->createOverlayElement("Panel", name_+"container")); … … 72 61 background_->setMaterialName("Orxonox/BarBackground"); 73 62 63 // calculate absolute coordinates... 64 resize(); 65 74 66 show(); 75 background_->addChild(this);76 67 setMetricsMode(Ogre::GMM_PIXELS); 77 68 setMaterialName("Orxonox/Green"); 78 resize();69 background_->addChild(this); 79 70 } 80 71 … … 82 73 windowW_ = GraphicsEngine::getSingleton().getWindowWidth(); 83 74 windowH_ = GraphicsEngine::getSingleton().getWindowHeight(); 84 // c álculate new absolute coordinates...85 left_ = leftRel_ * windowW_;86 top_ = topRel_ * windowH_;87 width_ = widthRel_ * windowW_;88 height_ = heightRel_ * windowH_;75 // calculate new absolute coordinates... 76 left_ = (int) (leftRel_ * windowW_); 77 top_ = (int) (topRel_ * windowH_); 78 width_ = (int) (dimRel_ * windowW_); 79 height_ = (int) (0.1*width_); // the texture has dimensions height:length = 1:10 89 80 // adapt background 90 81 background_->setPosition(left_, top_);
Note: See TracChangeset
for help on using the changeset viewer.