- Timestamp:
- Oct 28, 2008, 10:55:49 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/overlay/src/orxonox/overlays/OrxonoxOverlay.cc
r1755 r2036 60 60 { 61 61 RegisterObject(OrxonoxOverlay); 62 63 // add this overlay to the static map of OrxonoxOverlays 64 if (overlays_s.find(this->getName()) != overlays_s.end()) 65 { 66 COUT(1) << "Overlay names should be unique or you cannnot access them via console." << std::endl; 67 } 68 overlays_s[this->getName()] = this; 69 70 // create the Ogre::Overlay 71 overlay_ = Ogre::OverlayManager::getSingleton().create("OrxonoxOverlay_overlay_" 72 + convertToString(hudOverlayCounter_s++)); 73 74 // create background panel (can be used to show any picture) 75 this->background_ = static_cast<Ogre::PanelOverlayElement*>( 76 Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", 77 "OrxonoxOverlay_background_" + convertToString(hudOverlayCounter_s++))); 78 this->overlay_->add2D(this->background_); 79 80 // We'll have to get the aspect ratio manually for the first time. Afterwards windowResized() gets 81 // called automatically by the GraphicsEngine. 82 this->windowResized(GraphicsEngine::getInstance().getWindowWidth(), 83 GraphicsEngine::getInstance().getWindowHeight()); 84 85 this->changedVisibility(); 62 86 } 63 87 … … 93 117 { 94 118 SUPER(OrxonoxOverlay, XMLPort, xmlElement, mode); 95 96 if (mode == XMLPort::LoadObject)97 {98 // add this overlay to the static map of OrxonoxOverlays99 if (overlays_s.find(this->getName()) != overlays_s.end())100 {101 COUT(1) << "Overlay names should be unique or you cannnot access them via console." << std::endl;102 }103 overlays_s[this->getName()] = this;104 105 // create the Ogre::Overlay106 overlay_ = Ogre::OverlayManager::getSingleton().create("OrxonoxOverlay_overlay_"107 + convertToString(hudOverlayCounter_s++));108 109 // create background panel (can be used to show any picture)110 this->background_ = static_cast<Ogre::PanelOverlayElement*>(111 Ogre::OverlayManager::getSingleton().createOverlayElement("Panel",112 "OrxonoxOverlay_background_" + convertToString(hudOverlayCounter_s++)));113 this->overlay_->add2D(this->background_);114 115 // We'll have to get the aspect ratio manually for the first time. Afterwards windowResized() gets116 // called automatically by the GraphicsEngine.117 this->windowResized(GraphicsEngine::getInstance().getWindowWidth(),118 GraphicsEngine::getInstance().getWindowHeight());119 120 this->changedVisibility();121 }122 119 123 120 XMLPortParam(OrxonoxOverlay, "size", setSize, getSize, xmlElement, mode)
Note: See TracChangeset
for help on using the changeset viewer.