Changeset 6417 for code/trunk/src/libraries/core/GUIManager.cc
- Timestamp:
- Dec 25, 2009, 10:23:58 PM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/core/GUIManager.cc
r6105 r6417 40 40 #include <CEGUIResourceProvider.h> 41 41 #include <CEGUISystem.h> 42 #include <CEGUIWindow.h> 42 43 #include <ogreceguirenderer/OgreCEGUIRenderer.h> 43 44 … … 50 51 51 52 #include "util/Clock.h" 53 #include "util/Convert.h" 52 54 #include "util/Debug.h" 53 55 #include "util/Exception.h" 54 56 #include "util/OrxAssert.h" 57 #include "ConsoleCommand.h" 58 #include "Core.h" 55 59 #include "LuaState.h" 56 60 #include "PathConfig.h" … … 59 63 namespace orxonox 60 64 { 65 static void key_esc() 66 { GUIManager::getInstance().keyESC(); } 67 SetConsoleCommandShortcutExternAlias(key_esc, "keyESC"); 68 61 69 class CEGUILogger : public CEGUI::DefaultLogger 62 70 { … … 85 93 GUIManager* GUIManager::singletonPtr_s = 0; 86 94 95 SetConsoleCommandShortcut(GUIManager, showGUI).accessLevel(AccessLevel::User).defaultValue(1, false).defaultValue(2, true); 96 SetConsoleCommandShortcut(GUIManager, hideGUI).accessLevel(AccessLevel::User); 97 87 98 /** 88 99 @brief … … 101 112 , resourceProvider_(0) 102 113 , camera_(NULL) 114 , bShowIngameGUI_(false) 103 115 { 104 116 using namespace CEGUI; … … 113 125 // setup scripting 114 126 luaState_.reset(new LuaState()); 127 rootFileInfo_ = Resource::getInfo("InitialiseGUI.lua"); 128 // This is necessary to ensure that input events also use the right resource info when triggering lua functions 129 luaState_->setDefaultResourceInfo(this->rootFileInfo_); 115 130 scriptModule_.reset(new LuaScriptModule(luaState_->getInternalLuaState())); 116 131 … … 127 142 128 143 // Initialise the basic Lua code 129 rootFileInfo_ = Resource::getInfo("InitialiseGUI.lua", "GUI"); 130 this->luaState_->doFile("InitialiseGUI.lua", "GUI", false); 144 this->luaState_->doFile("InitialiseGUI.lua"); 131 145 132 146 // Align CEGUI mouse with OIS mouse … … 156 170 This time value is then used to provide a fluent animation of the GUI. 157 171 */ 158 void GUIManager:: update(const Clock& time)172 void GUIManager::preUpdate(const Clock& time) 159 173 { 160 174 assert(guiSystem_); … … 203 217 For more details check out loadGUI_2.lua where the function presides. 204 218 */ 205 void GUIManager::showGUI(const std::string& name) 206 { 207 this->luaState_->doString("showGUI(\"" + name + "\")", rootFileInfo_); 219 /*static*/ void GUIManager::showGUI(const std::string& name, bool hidePrevious, bool showCursor) 220 { 221 GUIManager::getInstance().executeCode("showGUI(\"" + name + "\", " + multi_cast<std::string>(hidePrevious) + ", " + multi_cast<std::string>(showCursor) + ")"); 222 } 223 224 /** 225 @brief 226 Hack-ish. Needed for GUIOverlay. 227 */ 228 void GUIManager::showGUIExtra(const std::string& name, const std::string& ptr, bool hidePrevious, bool showCursor) 229 { 230 this->executeCode("showGUI(\"" + name + "\", " + multi_cast<std::string>(hidePrevious) + ", " + multi_cast<std::string>(showCursor) + ", " + ptr + ")"); 231 } 232 233 /** 234 @brief 235 Hides specified GUI. 236 @param name 237 The name of the GUI. 238 */ 239 /*static*/ void GUIManager::hideGUI(const std::string& name) 240 { 241 GUIManager::getInstance().executeCode("hideGUI(\"" + name + "\")"); 242 } 243 244 void GUIManager::keyESC() 245 { 246 this->executeCode("keyESC()"); 247 } 248 249 void GUIManager::setBackground(const std::string& name) 250 { 251 this->executeCode("setBackground(\"" + name + "\")"); 208 252 } 209 253 … … 304 348 } 305 349 } 350 351 void GUIManager::subscribeEventHelper(CEGUI::Window* window, const std::string& event, const std::string& function) 352 { 353 window->subscribeScriptedEvent(event, function); 354 } 306 355 }
Note: See TracChangeset
for help on using the changeset viewer.