Changeset 6023
- Timestamp:
- Nov 4, 2009, 1:59:39 PM (15 years ago)
- Location:
- code/branches/ingamemenu
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ingamemenu/data/gui/scripts/InitialiseGUI.lua
r6003 r6023 14 14 15 15 loadedGUIs = {} 16 root = nil; 16 cursorVisibility = {} 17 activeSheets = {} 18 nrOfActiveSheets = 0 19 root = nil 20 bShowsCursor = false 17 21 18 22 -- loads the GUI with the specified filename … … 36 40 end 37 41 38 function showGUI(filename, ptr)39 gui = showGUI(filename )42 function showGUI(filename, bCursorVisible, ptr) 43 gui = showGUI(filename, bCursorVisible) 40 44 gui.overlay = ptr 41 45 end … … 43 47 -- shows the specified and loads it if not loaded already 44 48 -- be sure to set the global variable "filename" before calling this function 45 function showGUI(filename) 49 function showGUI(filename, bCursorVisible) 50 -- bCursorVisibile=false 51 if bCursorVisible == nil then 52 cursorVisibility= true 53 end 54 46 55 if root == nil then 47 56 root = winMgr:createWindow("TaharezLook/StaticImage", "AbsoluteRootWindow") … … 61 70 root:addChildWindow(currentGUI.window) 62 71 72 if bCursorVisible then 73 showCursor() 74 else 75 hideCursor() 76 end 77 cursorVisibility[filename]=bCursorVisible 78 79 nrOfActiveSheets = nrOfActiveSheets + 1 80 table.insert(activeSheets, filename) 81 activeSheets[nrOfActiveSheets] = filename 82 63 83 currentGUI:show() 64 84 showing = true … … 67 87 68 88 function hideCursor() 69 cursor:hide() 89 if bShowsCursor==true then 90 bShowsCursor=false 91 cursor:hide() 92 end 70 93 end 71 94 72 95 function showCursor() 73 cursor:show() 96 if bShowsCursor==false then 97 bShowsCursor=true 98 cursor:show() 99 end 74 100 end 75 101 76 102 function hideGUI(filename) 77 103 local currentGUI = loadedGUIs[filename] 78 if currentGUI ~= nil then 79 currentGUI:hide() 80 root:removeChildWindow(currentGUI.window) 81 showing = false 104 if currentGUI == nil then 105 return 82 106 end 107 currentGUI:hide() 108 root:removeChildWindow(currentGUI.window) 109 showing = false 110 i=1 111 while activeSheets[i] do 112 if activeSheets[i+1] == nil then 113 if activeSheets[i-1] ~= nil then 114 if cursorVisibility[ activeSheets[i-1] ] == true then 115 showCursor() 116 else 117 hideCursor() 118 end 119 else 120 hideCursor() 121 end 122 end 123 if activeSheets[i] == filename then 124 table.remove( activeSheets, i ) 125 nrOfActiveSheets = nrOfActiveSheets-1 126 else 127 i = i+1 128 end 129 end 130 cursorVisibility[filename] = nil -- remove the cursor visibility of the current gui from the table 83 131 end -
code/branches/ingamemenu/src/libraries/core/GUIManager.cc
r6020 r6023 50 50 51 51 #include "util/Clock.h" 52 #include "util/Convert.h" 52 53 #include "util/Debug.h" 53 54 #include "util/Exception.h" … … 88 89 GUIManager* GUIManager::singletonPtr_s = 0; 89 90 90 SetConsoleCommandShortcut(GUIManager, showGUI).accessLevel(AccessLevel::User) ;91 SetConsoleCommandShortcut(GUIManager, showGUI).accessLevel(AccessLevel::User).defaultValue(1, true); 91 92 SetConsoleCommandShortcut(GUIManager, hideGUI).accessLevel(AccessLevel::User); 92 93 … … 209 210 For more details check out loadGUI_2.lua where the function presides. 210 211 */ 211 /*static*/ void GUIManager::showGUI(const std::string& name )212 /*static*/ void GUIManager::showGUI(const std::string& name, bool showCursor) 212 213 { 213 214 std::pair<std::set<std::string>::iterator,bool> result = GUIManager::getInstance().showingGUIs_.insert(name); … … 216 217 if(GUIManager::getInstance().showingGUIs_.size() == 1 && result.second == true) //!< If it's the first GUI. 217 218 { 218 GUIManager::getInstance().executeCode("showCursor()");219 // GUIManager::getInstance().executeCode("showCursor()"); 219 220 InputManager::getInstance().enterState("guiMouseOnly"); 220 221 } 221 GUIManager::getInstance().executeCode("showGUI(\"" + name + "\" )");222 GUIManager::getInstance().executeCode("showGUI(\"" + name + "\", " + multi_cast<std::string>(showCursor) + ")"); 222 223 } 223 224 … … 226 227 Hack-ish. Needed for GUIOverlay. 227 228 */ 228 void GUIManager::showGUIExtra(const std::string& name, const std::string& ptr )229 void GUIManager::showGUIExtra(const std::string& name, const std::string& ptr, bool showCursor) 229 230 { 230 231 std::pair<std::set<std::string>::iterator,bool> result = this->showingGUIs_.insert(name); … … 236 237 InputManager::getInstance().enterState("guiMouseOnly"); 237 238 } 238 this->executeCode("showGUI(\"" + name + "\", " + ptr + ")");239 this->executeCode("showGUI(\"" + name + "\", " + multi_cast<std::string>(showCursor) + ", " + ptr + ")"); 239 240 } 240 241 … … 258 259 } 259 260 260 /*static*/ void GUIManager::hideCursor()261 {262 GUIManager::getInstance().executeCode("hideCursor()");263 }264 265 261 void GUIManager::keyPressed(const KeyEvent& evt) 266 262 { -
code/branches/ingamemenu/src/libraries/core/GUIManager.h
r6020 r6023 68 68 void update(const Clock& time); 69 69 70 static void showGUI(const std::string& name );71 void showGUIExtra(const std::string& name, const std::string& ptr );70 static void showGUI(const std::string& name, bool showCursor=true); 71 void showGUIExtra(const std::string& name, const std::string& ptr, bool showCursor=true); 72 72 static void hideGUI(const std::string& name); 73 static void hideCursor();74 73 75 74 void setCamera(Ogre::Camera* camera); -
code/branches/ingamemenu/src/libraries/core/LuaState.cc
r5929 r6023 164 164 if (sourceFileInfo != NULL) 165 165 origin = " originating from " + sourceFileInfo_->filename; 166 COUT( 2) << "Error in Lua-script" << origin << ": " << lua_tostring(luaState_, -1) << std::endl;166 COUT(1) << "Error in Lua-script" << origin << ": " << lua_tostring(luaState_, -1) << std::endl; 167 167 // return value is nil 168 168 lua_pushnil(luaState_); -
code/branches/ingamemenu/src/orxonox/gamestates/GSMainMenu.cc
r6020 r6023 82 82 { 83 83 // show main menu 84 GUIManager::showGUI("MainMenu"); 85 GUIManager::hideCursor(); 84 GUIManager::getInstance().showGUI("MainMenu", false); 86 85 GUIManager::getInstance().setCamera(this->camera_); 87 86 GraphicsManager::getInstance().setCamera(this->camera_); … … 112 111 113 112 InputManager::getInstance().leaveState("mainMenu"); 114 GUIManager::hideGUI("MainMenu");115 113 116 114 GUIManager::getInstance().setCamera(0); 115 GUIManager::hideGUI("MainMenu"); 117 116 GraphicsManager::getInstance().setCamera(0); 118 117 }
Note: See TracChangeset
for help on using the changeset viewer.