Changeset 1646 for code/branches/gui/src
- Timestamp:
- Jul 24, 2008, 10:40:22 PM (17 years ago)
- Location:
- code/branches/gui/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/core/Loader.cc
r1625 r1646 64 64 void Loader::add(const Level* level, const ClassTreeMask& mask) 65 65 { 66 if (!level) 67 return; 66 68 Loader::levels_s.insert(Loader::levels_s.end(), std::pair<const Level*, ClassTreeMask>(level, mask)); 67 69 } … … 69 71 void Loader::remove(const Level* level) 70 72 { 73 if (!level) 74 return; 71 75 for (std::vector<std::pair<const Level*, ClassTreeMask> >::iterator it = Loader::levels_s.begin(); it != Loader::levels_s.end(); ++it) 72 76 { … … 108 112 bool Loader::load(const Level* level, const ClassTreeMask& mask) 109 113 { 114 if (!level) 115 return false; 116 110 117 Loader::currentMask_s = level->getMask() * mask; 111 118 … … 165 172 void Loader::unload(const Level* level, const ClassTreeMask& mask) 166 173 { 174 if (!level) 175 return; 167 176 for (Iterator<BaseObject> it = ObjectList<BaseObject>::begin(); it; ) 168 177 { -
code/branches/gui/src/core/input/ExtendedInputState.h
r1642 r1646 47 47 class _CoreExport ExtendedInputState : public InputState 48 48 { 49 friend class InputManager; 50 friend class ClassFactory<ExtendedInputState>; 51 49 52 public: 50 ExtendedInputState();51 ~ExtendedInputState() { }52 53 53 bool addKeyHandler (KeyHandler* handler); 54 54 bool removeKeyHandler (KeyHandler* handler); … … 68 68 69 69 private: 70 ExtendedInputState(); 71 ~ExtendedInputState() { } 72 70 73 void tickInput(float dt); 71 74 void tickInput(float dt, unsigned int device); -
code/branches/gui/src/core/input/InputManager.cc
r1645 r1646 429 429 (*rit).second->onLeave(); 430 430 } 431 activeStates_.clear();432 _updateActiveStates();431 //activeStates_.clear(); 432 //_updateActiveStates(); 433 433 434 434 // destroy all input states … … 438 438 } 439 439 440 stateEmpty_ = 0;441 stateCalibrator_ = 0;442 stateDetector_ = 0;440 //stateEmpty_ = 0; 441 //stateCalibrator_ = 0; 442 //stateDetector_ = 0; 443 443 444 444 // destroy the devices … … 448 448 449 449 // 0 joy sticks now 450 _redimensionLists();450 //_redimensionLists(); 451 451 452 452 OIS::InputManager::destroyInputSystem(inputSystem_); 453 inputSystem_ = 0;453 //inputSystem_ = 0; 454 454 455 455 CCOUT(3) << "Destroying done." << std::endl; … … 509 509 { 510 510 assert(state); 511 std::map<int, InputState*>::iterator it = this->activeStates_.find(state->getPriority()); 512 if (it != this->activeStates_.end()) 513 { 514 this->activeStates_.erase(it); 515 _updateActiveStates(); 516 } 511 517 inputStatesByPriority_.erase(state->getPriority()); 512 518 inputStatesByName_.erase(state->getName()); -
code/branches/gui/src/core/input/InputState.h
r1642 r1646 51 51 52 52 public: 53 InputState() : priority_(0), executorOnEnter_(0), executorOnLeave_(0)54 { RegisterObject(InputState); }55 virtual ~InputState() { }56 57 53 const std::string& getName() const { return name_; } 58 54 int getPriority() const { return priority_; } … … 93 89 94 90 protected: 91 InputState() : priority_(0), executorOnEnter_(0), executorOnLeave_(0) 92 { RegisterObject(InputState); } 93 virtual ~InputState() { } 94 95 95 virtual void numberOfJoySticksChanged(unsigned int n) = 0; 96 96 void setInputDeviceEnabled(unsigned int device, bool bEnabled) -
code/branches/gui/src/core/input/SimpleInputState.h
r1642 r1646 45 45 class _CoreExport SimpleInputState : public InputState 46 46 { 47 friend class InputManager; 48 friend class ClassFactory<SimpleInputState>; 49 47 50 public: 48 SimpleInputState();49 ~SimpleInputState() { }50 51 51 void setKeyHandler (KeyHandler* handler) { keyHandler_ = handler; update(); } 52 52 void setMouseHandler (MouseHandler* handler) { mouseHandler_ = handler; update(); } … … 57 57 58 58 private: 59 SimpleInputState(); 60 ~SimpleInputState() { } 61 59 62 void tickInput(float dt); 60 63 void tickInput(float dt, unsigned int device); -
code/branches/gui/src/orxonox/Orxonox.cc
r1645 r1646 115 115 , inputManager_(0) 116 116 , radar_(0) 117 , console_(0) 118 , guiManager_(0) 117 119 { 118 120 RegisterRootObject(Orxonox); … … 142 144 if (this->radar_) 143 145 delete this->radar_; 146 147 if (this->guiManager_) 148 delete guiManager_; 144 149 145 150 //if (this->auMan_) … … 271 276 272 277 // load the CEGUI interface 273 GUIManager::getInstance().initialise(); 278 guiManager_ = new GUIManager(); 279 guiManager_->initialise(); 274 280 } 275 281 -
code/branches/gui/src/orxonox/Orxonox.h
r1642 r1646 103 103 Radar* radar_; //!< represents the Radar (not the HUD part) 104 104 InGameConsole* console_; 105 GUIManager* guiManager_; 105 106 106 107 static Orxonox *singletonRef_s; -
code/branches/gui/src/orxonox/OrxonoxPrereqs.h
r1625 r1646 118 118 class OverlayGroup; 119 119 class OverlayText; 120 121 //gui 122 class GUIManager; 120 123 } 121 124 -
code/branches/gui/src/orxonox/gui/GUIManager.cc
r1645 r1646 58 58 SetConsoleCommandShortcut(GUIManager, showGUI_s).setKeybindMode(KeybindMode::OnPress); 59 59 60 GUIManager* GUIManager::singletonRef_s = 0; 61 60 62 GUIManager::GUIManager() 61 63 //: emptySceneManager_(0) … … 71 73 , state_(Uninitialised) 72 74 { 75 assert(singletonRef_s == 0); 76 singletonRef_s = this; 73 77 } 74 78 75 79 GUIManager::~GUIManager() 76 80 { 77 // TODO: destruct at least something 81 if (backgroundCamera_) 82 backgroundSceneManager_->destroyCamera(backgroundCamera_); 83 84 if (backgroundSceneManager_) 85 Ogre::Root::getSingleton().destroySceneManager(backgroundSceneManager_); 86 87 InputManager::getInstance().destroyState("gui"); 88 89 if (guiSystem_) 90 delete guiSystem_; 91 92 if (scriptModule_) 93 { 94 // destroy our own tolua interfaces 95 //lua_pushnil(luaState_); 96 //lua_setglobal(luaState_, "Orxonox"); 97 //lua_pushnil(luaState_); 98 //lua_setglobal(luaState_, "Core"); 99 // TODO: deleting the script module fails an assertation. 100 // However there is not much we can do about it since it occurs too when 101 // we don't open Core or Orxonox. Might be a CEGUI issue. 102 // The memory leak is not a problem anyway.. 103 //delete scriptModule_; 104 } 105 106 if (guiRenderer_) 107 delete guiRenderer_; 108 109 singletonRef_s = 0; 78 110 } 79 111 … … 104 136 // setup scripting 105 137 this->scriptModule_ = new LuaScriptModule(); 138 this->luaState_ = this->scriptModule_->getLuaState(); 106 139 107 140 // create the CEGUI system singleton … … 267 300 268 301 269 /**270 @brief271 Returns a unique instance of GUIManager.272 @return273 The instance274 */275 GUIManager& GUIManager::getInstance()276 {277 static GUIManager instance;278 return instance;279 }280 281 302 inline CEGUI::MouseButton GUIManager::convertButton(MouseButton::Enum button) 282 303 { -
code/branches/gui/src/orxonox/gui/GUIManager.h
r1641 r1646 48 48 class LuaScriptModule; 49 49 } 50 struct lua_State; 50 51 51 52 namespace orxonox // tolua_export … … 68 69 }; 69 70 71 GUIManager(); 72 ~GUIManager(); 73 70 74 bool initialise(); 71 75 void tick(float dt); … … 75 79 Ogre::Camera* getCamera() { return this->backgroundCamera_; } 76 80 77 static GUIManager& getInstance(); // tolua_export78 81 static void showGUI_s(const std::string& name, Ogre::SceneManager* sceneManager)//bool showBackground) 79 82 { … … 81 84 } 82 85 86 static GUIManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; } // tolua_export 87 static GUIManager* getInstancePtr() { return singletonRef_s; } 88 83 89 private: 84 GUIManager();85 90 GUIManager(const GUIManager& instance); 86 ~GUIManager();87 91 88 92 void keyPressed (const KeyEvent& evt) … … 119 123 CEGUI::System* guiSystem_; 120 124 CEGUI::Imageset* backgroundImage_; 125 lua_State* luaState_; 121 126 122 127 State state_; 123 128 129 static CEGUI::MouseButton convertButton(MouseButton::Enum button); 124 130 125 static CEGUI::MouseButton convertButton(MouseButton::Enum button);131 static GUIManager* singletonRef_s; 126 132 }; // tolua_export 127 133
Note: See TracChangeset
for help on using the changeset viewer.