Changeset 1567 for code/trunk/src/orxonox
- Timestamp:
- Jun 8, 2008, 5:55:05 PM (17 years ago)
- Location:
- code/trunk/src/orxonox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/Orxonox.cc
r1563 r1567 116 116 { 117 117 // keep in mind: the order of deletion is very important! 118 // if (this->orxonoxHUD_) 119 // delete this->orxonoxHUD_; 118 this->orxonoxHUD_->destroy(); 120 119 Loader::close(); 121 120 InputManager::destroy(); … … 331 330 COUT(3) << "Orxonox: Loading HUD..." << std::endl; 332 331 orxonoxHUD_ = &HUD::getSingleton(); 332 orxonoxHUD_->initialise(); 333 333 return true; 334 334 } -
code/trunk/src/orxonox/hud/HUD.cc
r1564 r1567 46 46 #include "RadarOverlayElement.h" 47 47 #include "Navigation.h" 48 #include "OverlayElementFactories.h"49 48 50 49 namespace orxonox … … 59 58 HUD::HUD() 60 59 { 60 orxonoxHUD_ = 0; 61 container_ = 0; 62 fpsText_ = 0; 63 rTRText_ = 0; 64 energyBar_ = 0; 65 speedoBar_ = 0; 66 radar_ = 0; 67 nav_ = 0; 68 bool showFPS_ = true; 69 bool showRenderTime_ = true; 70 } 71 72 HUD::~HUD() 73 { 74 this->destroy(); 75 } 76 77 void HUD::initialise() 78 { 61 79 showFPS_ = true; 62 80 showRenderTime_ = true; 63 81 64 82 // create Factories 65 barOverlayElementFactory_ = new BarOverlayElementFactory(); 66 Ogre::OverlayManager::getSingleton().addOverlayElementFactory(barOverlayElementFactory_); 67 radarOverlayElementFactory_ = new RadarOverlayElementFactory(); 68 Ogre::OverlayManager::getSingleton().addOverlayElementFactory(radarOverlayElementFactory_); 83 Ogre::OverlayManager::getSingleton().addOverlayElementFactory(&barOverlayElementFactory_); 84 Ogre::OverlayManager::getSingleton().addOverlayElementFactory(&radarOverlayElementFactory_); 69 85 70 86 orxonoxHUD_ = Ogre::OverlayManager::getSingleton().create("Orxonox/HUD"); … … 139 155 } 140 156 141 HUD::~HUD() 142 { 143 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->container_); 144 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->fpsText_); 145 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->rTRText_); 146 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->energyBar_); 147 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->speedoBar_); 148 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->radar_); 149 150 delete this->nav_; 151 delete this->barOverlayElementFactory_; 152 delete this->radarOverlayElementFactory_; 157 void HUD::destroy() 158 { 159 if (this->container_) 160 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->container_); 161 this->container_ = 0; 162 if (this->fpsText_) 163 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->fpsText_); 164 this->fpsText_ = 0; 165 if (this->rTRText_) 166 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->rTRText_); 167 this->rTRText_ = 0; 168 if (this->energyBar_) 169 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->energyBar_); 170 this->energyBar_ = 0; 171 if (this->speedoBar_) 172 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->speedoBar_); 173 this->speedoBar_ = 0; 174 if (this->radar_) 175 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->radar_); 176 this->radar_ = 0; 177 if (this->orxonoxHUD_) 178 Ogre::OverlayManager::getSingleton().destroy(this->orxonoxHUD_); 179 this->orxonoxHUD_ = 0; 180 181 if (this->nav_) 182 delete this->nav_; 183 this->nav_ = 0; 153 184 } 154 185 -
code/trunk/src/orxonox/hud/HUD.h
r1564 r1567 37 37 #include "objects/Tickable.h" 38 38 #include "util/Math.h" 39 #include "OverlayElementFactories.h" 39 40 40 41 namespace orxonox … … 43 44 { 44 45 public: 45 static HUD& getSingleton(); 46 void initialise(); 47 void destroy(); 48 46 49 virtual void tick(float); 47 50 … … 54 57 inline std::list<RadarObject*>& getRadarObjects() 55 58 { return this->roSet_; } 59 60 static HUD& getSingleton(); 56 61 57 62 static void setEnergy(float value); … … 66 71 ~HUD(); 67 72 68 static HUD* instance_s; 73 std::list<RadarObject*> roSet_; 74 BarOverlayElementFactory barOverlayElementFactory_; 75 RadarOverlayElementFactory radarOverlayElementFactory_; 69 76 70 std::list<RadarObject*> roSet_;71 77 Ogre::Overlay* orxonoxHUD_; 72 78 Ogre::OverlayContainer* container_; 73 BarOverlayElementFactory* barOverlayElementFactory_;74 RadarOverlayElementFactory* radarOverlayElementFactory_;75 79 Ogre::TextAreaOverlayElement* fpsText_; 76 80 Ogre::TextAreaOverlayElement* rTRText_;
Note: See TracChangeset
for help on using the changeset viewer.