Changeset 1614 for code/branches/hud/src/orxonox/overlays/OverlayGroup.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/OverlayGroup.cc
r1609 r1614 41 41 42 42 SetConsoleCommand(OverlayGroup, toggleVisibility, false).setAccessLevel(AccessLevel::User); 43 44 OverlayGroup* OverlayGroup::hudInstance_s = 0; 43 SetConsoleCommand(OverlayGroup, scaleGroup, false).setAccessLevel(AccessLevel::User); 45 44 46 45 using namespace Ogre; … … 50 49 { 51 50 RegisterObject(OverlayGroup); 52 53 // Singleton like in Ogre. Constructor and destructor are public,54 // but the assert prevents from having multiple instances.55 assert(hudInstance_s == 0);56 hudInstance_s = this;57 51 } 58 52 59 53 OverlayGroup::~OverlayGroup() 60 54 { 61 if (this->isInitialized())62 {63 }64 65 hudInstance_s = 0;66 55 } 67 56 … … 104 93 } 105 94 106 /*static*/ OverlayGroup& OverlayGroup::getHUD()107 {108 assert(hudInstance_s);109 return *hudInstance_s;110 }111 95 112 96 /*static*/ void OverlayGroup::toggleVisibility(const std::string& name) 113 97 { 114 if (OverlayGroup::getHUD().hudElements_.find(name) != OverlayGroup::getHUD().hudElements_.end())98 for (Iterator<OverlayGroup> it = ObjectList<OverlayGroup>::begin(); it; ++it) 115 99 { 116 OverlayGroup::getHUD().hudElements_[name]->setVisibility(!OverlayGroup::getHUD().hudElements_[name]->isVisible()); 100 if ((*it)->getName() == name) 101 (*it)->setVisibility(!((*it)->isVisible())); 117 102 } 118 103 } 119 104 105 /*static*/ void OverlayGroup::scaleGroup(const std::string& name, float scale) 106 { 107 for (Iterator<OverlayGroup> it = ObjectList<OverlayGroup>::begin(); it; ++it) 108 { 109 if ((*it)->getName() == name) 110 (*it)->scale(Vector2(scale, scale)); 111 } 112 } 120 113 }
Note: See TracChangeset
for help on using the changeset viewer.