Changeset 6048 for code/branches
- Timestamp:
- Nov 12, 2009, 11:32:41 AM (15 years ago)
- Location:
- code/branches/menu
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/menu/data/defaultConfig/keybindings.ini
r5929 r6048 23 23 KeyEnd=boost 24 24 KeyEquals= 25 KeyEscape=" exit"25 KeyEscape="toggleIngameGUI" 26 26 KeyF="scale -1 moveUpDown" 27 27 KeyF1="OverlayGroup toggleVisibility Debug" -
code/branches/menu/data/gui/scripts/InGameMenu.lua
r6024 r6048 18 18 -- events for ingamemenu 19 19 function P.button_quit_clicked(e) 20 orxonox.CommandExecutor:execute("hideGUI InGameMenu") 21 orxonox.CommandExecutor:execute("exit") 20 openDecisionPopup( "Do you really want to quit the game?", InGameMenu.callback ) 22 21 end 23 22 … … 34 33 end 35 34 35 function P.callback(doExit) 36 if doExit then 37 orxonox.CommandExecutor:execute("hideGUI InGameMenu") 38 orxonox.CommandExecutor:execute("exit") 39 end 40 end 41 36 42 return P 37 43 -
code/branches/menu/data/gui/scripts/InitialiseGUI.lua
r6036 r6048 21 21 bHidePrevious = {} 22 22 23 -- Require all tools 24 require("GUITools") 25 23 26 -- loads the GUI with the specified filename 24 27 -- be sure to set the global variable "filename" before calling this function … … 28 31 if loadedGui == nil then 29 32 loadedGuiNS = require(filename) 33 if loadedGuiNS == nil then 34 return 35 end 30 36 loadedGui = loadedGuiNS:load() 31 37 loadedGUIs[filename] = loadedGui … … 147 153 end 148 154 155 function keyESC() 156 orxonox.CommandExecutor:execute("hideGUI "..activeSheets[nrOfActiveSheets]) 157 end 158 149 159 function setBackground(filename) 150 160 local newroot -
code/branches/menu/src/libraries/core/GUIManager.cc
r6036 r6048 108 108 , resourceProvider_(0) 109 109 , camera_(NULL) 110 , bShowIngameGUI_(false) 110 111 { 111 112 using namespace CEGUI; … … 251 252 } 252 253 } 254 255 void GUIManager::toggleIngameGUI() 256 { 257 if ( this->bShowIngameGUI_==false ) 258 { 259 GUIManager::showGUI("InGameMenu"); 260 this->bShowIngameGUI_ = true; 261 } 262 else 263 { 264 GUIManager::hideGUI("InGameMenu"); 265 this->bShowIngameGUI_ = false; 266 } 267 } 253 268 254 void GUIManager::setToggleMode(const bool& mode) 255 { 256 this->bToggleMode_ = mode; 257 this->executeCode("setToggleMode(" + multi_cast<std::string>(mode) + ")"); 269 void GUIManager::keyESC() 270 { 271 if( this->showingGUIs_.size() == 0 ) 272 this->showGUI("InGameMenu"); 273 else 274 this->executeCode("keyESC()"); 258 275 } 259 276 -
code/branches/menu/src/libraries/core/GUIManager.h
r6032 r6048 71 71 void showGUIExtra(const std::string& name, const std::string& ptr, bool hidePrevious=false, bool showCursor=true); 72 72 static void hideGUI(const std::string& name); 73 void setToggleMode(const bool& mode); 73 void toggleIngameGUI(); 74 void keyESC(); 74 75 void setBackground(const std::string& name); 75 76 … … 113 114 114 115 static GUIManager* singletonPtr_s; //!< Singleton reference to GUIManager 115 bool b ToggleMode_;116 bool bShowIngameGUI_; 116 117 117 118 }; -
code/branches/menu/src/libraries/core/Game.cc
r6047 r6048 51 51 #include "GameMode.h" 52 52 #include "GameState.h" 53 #include "GUIManager.h" 53 54 54 55 namespace orxonox … … 57 58 { Game::getInstance().stop(); } 58 59 SetConsoleCommandShortcutExternAlias(stop_game, "exit"); 60 static void key_esc() 61 { Game::getInstance().keyESC(); } 62 SetConsoleCommandShortcutExternAlias(key_esc, "keyESC"); 59 63 static void printFPS() 60 64 { COUT(0) << Game::getInstance().getAvgFPS() << std::endl; } … … 354 358 } 355 359 360 void Game::keyESC() 361 { 362 if( this->getState("mainMenu") && this->getState("mainMenu")->getActivity().active==true ) 363 this->stop(); 364 else 365 GUIManager::getInstance().keyESC(); 366 } 367 356 368 void Game::stop() 357 369 { -
code/branches/menu/src/libraries/core/Game.h
r6024 r6048 98 98 void run(); 99 99 void stop(); 100 void keyESC(); 100 101 101 102 static Game& getInstance(){ return Singleton<Game>::getInstance(); } // tolua_export -
code/branches/menu/src/orxonox/gamestates/GSLevel.cc
r6024 r6048 56 56 , guiKeysOnlyInputState_(0) 57 57 , startFile_(0) 58 , bShowIngameGUI_(false) 58 59 { 59 60 } … … 78 79 guiKeysOnlyInputState_ = InputManager::getInstance().createInputState("guiKeysOnly"); 79 80 guiKeysOnlyInputState_->setKeyHandler(GUIManager::getInstancePtr()); 80 81 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSLevel::showIngameGUI, this), "showIngameGUI"));82 81 } 83 82 … … 94 93 // connect the HumanPlayer to the game 95 94 PlayerManager::getInstance().clientConnected(0); 96 }97 }98 99 void GSLevel::showIngameGUI(bool show)100 {101 if (show)102 {103 GUIManager::showGUI("inGameTest");104 }105 else106 {107 GUIManager::hideGUI("inGameTest");108 95 } 109 96 } -
code/branches/menu/src/orxonox/gamestates/GSLevel.h
r5929 r6048 52 52 void loadLevel(); 53 53 void unloadLevel(); 54 void showIngameGUI(bool show);55 54 56 55 InputState* gameInputState_; //!< input state for normal ingame playing … … 60 59 XMLFile* startFile_; 61 60 std::set<BaseObject*> staticObjects_; 61 bool bShowIngameGUI_; 62 62 }; 63 63 }
Note: See TracChangeset
for help on using the changeset viewer.