Changeset 1614 for code/branches/hud/src/orxonox/overlays/OrxonoxOverlay.cc
- Timestamp:
- Jun 21, 2008, 2:35:24 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hud/src/orxonox/overlays/OrxonoxOverlay.cc
r1604 r1614 31 31 32 32 #include <OgreOverlayManager.h> 33 #include <OgrePanelOverlayElement.h> 33 34 #include "util/Convert.h" 34 35 #include "core/CoreIncludes.h" … … 41 42 OrxonoxOverlay::OrxonoxOverlay() 42 43 : overlay_(0) 44 , background_(0) 43 45 , windowAspectRatio_(1.0f) 44 46 , bCorrectAspect_(false) … … 50 52 { 51 53 RegisterObject(OrxonoxOverlay); 54 } 55 56 OrxonoxOverlay::~OrxonoxOverlay() 57 { 58 if (this->background_) 59 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->background_); 52 60 } 53 61 … … 63 71 this->windowResized(GraphicsEngine::getSingleton().getWindowWidth(), 64 72 GraphicsEngine::getSingleton().getWindowHeight()); 73 74 // create background 75 this->background_ = static_cast<Ogre::PanelOverlayElement*>( 76 Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", getUniqueNumberStr() + "_Background")); 77 this->overlay_->add2D(this->background_); 65 78 } 66 79 … … 70 83 XMLPortParam(OrxonoxOverlay, "origin", setOrigin, getOrigin, xmlElement, mode); 71 84 XMLPortParam(OrxonoxOverlay, "position", setPosition, getPosition, xmlElement, mode); 85 XMLPortParam(OrxonoxOverlay, "background", setBackgroundMaterial, getBackgroundMaterial, xmlElement, mode); 72 86 73 87 if (mode == XMLPort::LoadObject) … … 83 97 } 84 98 85 OrxonoxOverlay::~OrxonoxOverlay()99 void OrxonoxOverlay::setBackgroundMaterial(const std::string& material) 86 100 { 101 if (this->background_ && material != "") 102 this->background_->setMaterialName(material); 103 } 104 105 std::string OrxonoxOverlay::getBackgroundMaterial() const 106 { 107 if (this->background_) 108 return this->background_->getMaterialName(); 109 else 110 return ""; 87 111 } 88 112
Note: See TracChangeset
for help on using the changeset viewer.