Changeset 3339 for code/branches/resource/src/orxonox/gui
- Timestamp:
- Jul 23, 2009, 8:04:51 PM (15 years ago)
- Location:
- code/branches/resource/src/orxonox/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/resource/src/orxonox/gui/GUIManager.cc
r3338 r3339 61 61 #include "ToluaBindCore.h" 62 62 #include "ToluaBindOrxonox.h" 63 #include "core/Loader.h"64 63 65 64 namespace orxonox … … 88 87 89 88 static CEGUI::MouseButton convertButton(MouseButtonCode::ByEnum button); 89 90 90 GUIManager* GUIManager::singletonRef_s = 0; 91 91 … … 157 157 Destructor of the GUIManager 158 158 159 Basically shuts down CEGUI and destroys the Lua engine and afterwards the interface to the Ogre engine.159 Basically shuts down CEGUI (member smart pointers) but first unloads our Tolua modules. 160 160 */ 161 161 GUIManager::~GUIManager() … … 174 174 Calls main Lua script 175 175 @todo 176 Replace loadGUI.lua with loadGUI_2.lua after merging this back to trunk.177 However CEGUI is able to execute a startup script. We could maybe put this call in this startup code.178 179 176 This function calls the main Lua script for our GUI. 180 177 … … 183 180 void GUIManager::loadLuaCode() 184 181 { 185 try 186 { 187 // set datapath for GUI data 188 lua_pushfstring(this->scriptModule_->getLuaState(), Core::getMediaPathString().c_str()); 189 lua_setglobal(this->scriptModule_->getLuaState(), "datapath"); 190 // call main Lua script 191 this->scriptModule_->executeScriptFile("loadGUI_3.lua", "GUI"); 192 } 193 catch (CEGUI::Exception& ex) 194 { 195 #if CEGUI_VERSION_MINOR < 6 196 throw GeneralException(ex.getMessage().c_str()); 197 #else 198 throw GeneralException(ex.getMessage().c_str(), ex.getLine(), 199 ex.getFileName().c_str(), ex.getName().c_str()); 200 #endif 201 } 182 // set datapath for GUI data 183 lua_pushfstring(this->scriptModule_->getLuaState(), Core::getMediaPathString().c_str()); 184 lua_setglobal(this->scriptModule_->getLuaState(), "datapath"); 185 // call main Lua script 186 this->scriptModule_->executeScriptFile("loadGUI_3.lua", "GUI"); 202 187 } 203 188 … … 216 201 assert(guiSystem_); 217 202 guiSystem_->injectTimePulse(time.getDeltaTime()); 218 }219 220 /**221 222 */223 void GUIManager::getLevelList()224 {225 lua_State* L = this->scriptModule_->getLuaState();226 lua_newtable(L);227 228 std::vector<std::string> list = Loader::getLevelList();229 230 int j = 1;231 for (std::vector<std::string>::iterator i = list.begin(); i != list.end(); i++)232 {233 lua_pushnumber(L,j);234 lua_pushstring(L,i->c_str());235 lua_settable(L,-3);236 j++;237 }238 lua_setglobal(L, "levellist");239 203 } 240 204 -
code/branches/resource/src/orxonox/gui/GUIManager.h
r3338 r3339 47 47 #include "core/input/InputHandler.h" 48 48 49 // tolua_begin50 49 namespace orxonox 51 50 { … … 61 60 Those input events are then injected into CEGUI in Lua. 62 61 */ 63 class _OrxonoxExport GUIManager 64 // tolua_end 65 : public InputHandler 66 // tolua_begin 62 class _OrxonoxExport GUIManager : public InputHandler 67 63 { 68 // tolua_end69 64 public: 70 65 GUIManager(Ogre::RenderWindow* renderWindow); … … 78 73 void setCamera(Ogre::Camera* camera); 79 74 80 static GUIManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; } // tolua_export75 static GUIManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; } 81 76 static GUIManager* getInstancePtr() { return singletonRef_s; } 82 77 83 void getLevelList(); //tolua_export84 85 78 private: 86 GUIManager(const GUIManager& instance); //!< private constructor (this is a singleton class)79 GUIManager(const GUIManager& instance); //!< private and undefined copy c'tor (this is a singleton class) 87 80 88 81 void loadLuaCode(); … … 108 101 static GUIManager* singletonRef_s; //!< Singleton reference to GUIManager 109 102 110 }; // tolua_export111 } // tolua_export103 }; 104 } 112 105 113 106 #endif /* _GUIManager_H__ */
Note: See TracChangeset
for help on using the changeset viewer.