Changeset 2869 for code/branches/gui/src/orxonox/gamestates
- Timestamp:
- Mar 30, 2009, 11:34:51 PM (16 years ago)
- Location:
- code/branches/gui/src/orxonox/gamestates
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/orxonox/gamestates/GSGraphics.cc
r2854 r2869 36 36 #include "core/ConfigValueIncludes.h" 37 37 #include "core/Clock.h" 38 #include "core/ConsoleCommand.h" 38 39 #include "core/Core.h" 39 40 #include "core/CoreIncludes.h" … … 110 111 guiManager_->initialise(renderWindow); 111 112 113 FunctorMember<GSGraphics>* functor = createFunctor(&GSGraphics::toggleGUI); 114 functor->setObject(this); 115 this->ccToggleGUI_ = createConsoleCommand(functor, "toggleGUI"); 116 CommandExecutor::addConsoleCommandShortcut(this->ccToggleGUI_); 117 118 112 119 InputManager::getInstance().requestEnterState("master"); 113 120 } … … 115 122 void GSGraphics::deactivate() 116 123 { 124 125 if (this->ccToggleGUI_) 126 { 127 delete this->ccToggleGUI_; 128 this->ccToggleGUI_ = 0; 129 } 130 117 131 masterInputState_->setHandler(0); 118 132 InputManager::getInstance().requestDestroyState("master"); … … 131 145 132 146 GameMode::setShowsGraphics(false); 147 } 148 149 void GSGraphics::toggleGUI() 150 { 151 GUIManager::getInstance().executeCode("toggleGUI()"); 133 152 } 134 153 -
code/branches/gui/src/orxonox/gamestates/GSGraphics.h
r2844 r2869 47 47 void update(const Clock& time); 48 48 49 void toggleGUI(); 50 49 51 private: 50 52 // Window events from WindowEventListener … … 61 63 SimpleInputState* masterInputState_; 62 64 XMLFile* debugOverlay_; 65 ConsoleCommand* ccToggleGUI_; 63 66 }; 64 67 } -
code/branches/gui/src/orxonox/gamestates/GSLevel.cc
r2850 r2869 56 56 57 57 SetCommandLineArgument(level, "presentation.oxw").shortcut("l"); 58 SetConsoleCommand(GSLevel, showIngameGUI, true).keybindMode(KeybindMode::OnPress).keybindMode(KeybindMode::OnRelease); 58 59 59 60 GSLevel::GSLevel(const std::string& name) 60 61 : GameState(name) 61 62 , keyBinder_(0) 62 , inputState_(0) 63 , gameInputState_(0) 64 , guiMouseOnlyInputState_(0) 65 , guiKeysOnlyInputState_(0) 63 66 , radar_(0) 64 67 , startFile_(0) … … 87 90 if (GameMode::showsGraphics()) 88 91 { 89 { 90 FunctorMember<GSLevel>* functor = createFunctor(&GSLevel::toggleGUI); 91 functor->setObject(this); 92 this->ccToggleGUI_ = createConsoleCommand(functor, "toggleGUI"); 93 CommandExecutor::addConsoleCommandShortcut(this->ccToggleGUI_); 94 } 95 96 inputState_ = InputManager::getInstance().createInputState<SimpleInputState>("game"); 92 gameInputState_ = InputManager::getInstance().createInputState<SimpleInputState>("game"); 97 93 keyBinder_ = new KeyBinder(); 98 94 keyBinder_->loadBindings("keybindings.ini"); 99 inputState_->setHandler(keyBinder_); 95 gameInputState_->setHandler(keyBinder_); 96 97 guiMouseOnlyInputState_ = InputManager::getInstance().createInputState<SimpleInputState>("guiMouseOnly"); 98 guiMouseOnlyInputState_->setMouseHandler(GUIManager::getInstancePtr()); 99 100 guiKeysOnlyInputState_ = InputManager::getInstance().createInputState<SimpleInputState>("guiKeysOnly"); 101 guiKeysOnlyInputState_->setKeyHandler(GUIManager::getInstancePtr()); 100 102 101 103 // create the global CameraManager … … 138 140 } 139 141 142 void GSLevel::showIngameGUI(bool show) 143 { 144 COUT(0) << "*** Call works with \"" << (show ? "true" : "false") << "\" as param" << std::endl; 145 if (show) 146 { 147 GUIManager::getInstancePtr()->showGUI("inGameTest"); 148 InputManager::getInstance().requestEnterState("guiMouseOnly"); 149 } 150 else 151 { 152 GUIManager::getInstancePtr()->executeCode("hideGUI(inGameTest)"); 153 InputManager::getInstance().requestLeaveState("guiMouseOnly"); 154 } 155 } 156 140 157 void GSLevel::deactivate() 141 158 { … … 150 167 delete this->ccTkeybind_; 151 168 this->ccTkeybind_ = 0; 152 }153 if (this->ccToggleGUI_)154 {155 delete this->ccToggleGUI_;156 this->ccToggleGUI_ = 0;157 169 } 158 170 … … 196 208 if (GameMode::showsGraphics()) 197 209 { 198 inputState_->setHandler(0); 210 gameInputState_->setHandler(0); 211 guiMouseOnlyInputState_->setHandler(0); 212 guiKeysOnlyInputState_->setHandler(0); 199 213 InputManager::getInstance().requestDestroyState("game"); 200 214 if (this->keyBinder_) … … 233 247 234 248 delete this->startFile_; 235 }236 237 void GSLevel::toggleGUI()238 {239 if (GameMode::showsGraphics())240 {241 GUIManager::getInstance().executeCode("toggleGUI()");242 }243 249 } 244 250 -
code/branches/gui/src/orxonox/gamestates/GSLevel.h
r2850 r2869 47 47 void update(const Clock& time); 48 48 49 void toggleGUI();49 static void showIngameGUI(bool show); 50 50 51 51 protected: … … 58 58 void keybindInternal(const std::string& command, bool bTemporary); 59 59 60 KeyBinder* keyBinder_; //!< tool that loads and manages the input bindings 61 SimpleInputState* inputState_; 62 Radar* radar_; //!< represents the Radar (not the HUD part) 63 XMLFile* startFile_; //!< current hard coded default level 60 KeyBinder* keyBinder_; //!< tool that loads and manages the input bindings 61 SimpleInputState* gameInputState_; //!< input state for normal ingame playing 62 SimpleInputState* guiMouseOnlyInputState_; //!< input state if we only need the mouse to use the GUI 63 SimpleInputState* guiKeysOnlyInputState_; //!< input state if we only need the keys to use the GUI 64 Radar* radar_; //!< represents the Radar (not the HUD part) 65 XMLFile* startFile_; //!< current hard coded default level 64 66 CameraManager* cameraManager_; 65 67 LevelManager* levelManager_; … … 72 74 ConsoleCommand* ccKeybind_; 73 75 ConsoleCommand* ccTkeybind_; 74 ConsoleCommand* ccToggleGUI_;75 76 }; 76 77 } -
code/branches/gui/src/orxonox/gamestates/GSMainMenu.cc
r2853 r2869 83 83 void GSMainMenu::deactivate() 84 84 { 85 InputManager::getInstance().requestLeaveState(" game");86 InputManager::getInstance().requestDestroyState(" game");85 InputManager::getInstance().requestLeaveState("mainMenu"); 86 InputManager::getInstance().requestDestroyState("mainMenu"); 87 87 88 88 if (this->ccStartGame_) … … 91 91 this->ccStartGame_ = 0; 92 92 } 93 94 GUIManager::getInstance().executeCode("hideGUI()");95 93 } 96 94 -
code/branches/gui/src/orxonox/gamestates/GSStandalone.cc
r2848 r2869 55 55 { 56 56 GameMode::setIsStandalone(true); 57 58 guiManager_ = GUIManager::getInstancePtr();59 // not sure if necessary60 // guiManager_->loadScene("IngameMenu");61 57 } 62 58 … … 68 64 void GSStandalone::update(const Clock& time) 69 65 { 70 //Ogre::Viewport* viewport = GraphicsManager::getInstance().getViewport();71 //COUT(0) << "** " << viewport->getCamera()->getSceneManager() << std::endl;72 //guiManager_->testFct();73 //Ogre::Viewport* viewport = GraphicsManager::getInstance().getViewport();74 //guiManager_->showGUI("IngameMenu", viewport->getCamera()->getSceneManager());75 76 // tick CEGUI77 guiManager_->update(time);78 66 } 79 67 } -
code/branches/gui/src/orxonox/gamestates/GSStandalone.h
r2844 r2869 46 46 47 47 private: 48 GUIManager* guiManager_;49 48 }; 50 49 }
Note: See TracChangeset
for help on using the changeset viewer.