Changeset 1646 for code/branches/gui/src/orxonox
- Timestamp:
- Jul 24, 2008, 10:40:22 PM (16 years ago)
- Location:
- code/branches/gui/src/orxonox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
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.