Changeset 3327 for code/trunk/src/orxonox/gamestates
- Timestamp:
- Jul 19, 2009, 5:31:02 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/core4 merged: 3269,3271-3275,3278,3285,3290-3294,3310
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/gamestates/GSGraphics.cc
r3280 r3327 38 38 #include <OgreRenderWindow.h> 39 39 40 #include " core/ConfigValueIncludes.h"40 #include "util/Convert.h" 41 41 #include "core/Clock.h" 42 #include "core/CommandExecutor.h" 42 43 #include "core/ConsoleCommand.h" 43 44 #include "core/Core.h" 44 #include "core/CoreIncludes.h"45 45 #include "core/Game.h" 46 46 #include "core/GameMode.h" 47 47 #include "core/input/InputManager.h" 48 48 #include "core/input/KeyBinder.h" 49 #include "core/input/ SimpleInputState.h"49 #include "core/input/InputState.h" 50 50 #include "core/Loader.h" 51 51 #include "core/XMLFile.h" … … 70 70 , debugOverlay_(0) 71 71 { 72 RegisterRootObject(GSGraphics);73 72 } 74 73 75 74 GSGraphics::~GSGraphics() 76 {77 }78 79 /**80 @brief81 this function does nothing82 83 Indeed. Here goes nothing.84 */85 void GSGraphics::setConfigValues()86 75 { 87 76 } … … 106 95 GameMode::setShowsGraphics(true); 107 96 108 setConfigValues();109 110 97 // Load OGRE including the render window 111 98 this->graphicsManager_ = new GraphicsManager(); … … 122 109 123 110 // Calls the InputManager which sets up the input devices. 124 inputManager_ = new InputManager(); 125 inputManager_->initialise(windowHnd, renderWindow->getWidth(), renderWindow->getHeight(), true); 111 inputManager_ = new InputManager(windowHnd); 126 112 127 113 // load master key bindings 128 masterInputState_ = InputManager::getInstance().createInputState <SimpleInputState>("master", true);114 masterInputState_ = InputManager::getInstance().createInputState("master", true); 129 115 masterKeyBinder_ = new KeyBinder(); 130 116 masterKeyBinder_->loadBindings("masterKeybindings.ini"); … … 136 122 // Load the InGameConsole 137 123 console_ = new InGameConsole(); 138 console_->initialise( renderWindow->getWidth(), renderWindow->getHeight());124 console_->initialise(); 139 125 140 126 // load the CEGUI interface … … 149 135 150 136 // enable master input 151 InputManager::getInstance(). requestEnterState("master");137 InputManager::getInstance().enterState("master"); 152 138 } 153 139 … … 169 155 170 156 masterInputState_->setHandler(0); 171 InputManager::getInstance(). requestDestroyState("master");157 InputManager::getInstance().destroyState("master"); 172 158 delete this->masterKeyBinder_; 173 159 … … 232 218 this->graphicsManager_->update(time); 233 219 } 234 235 /**236 @brief237 Window has resized.238 @param rw239 The render window it occured in240 @note241 GraphicsManager has a render window stored itself. This is the same242 as rw. But we have to be careful when using multiple render windows!243 */244 void GSGraphics::windowResized(unsigned int newWidth, unsigned int newHeight)245 {246 // OIS needs this under linux even if we only use relative input measurement.247 if (this->inputManager_)248 this->inputManager_->setWindowExtents(newWidth, newHeight);249 }250 251 /**252 @brief253 Window focus has changed.254 @param rw255 The render window it occured in256 */257 void GSGraphics::windowFocusChanged()258 {259 // instruct InputManager to clear the buffers (core library so we cannot use the interface)260 if (this->inputManager_)261 this->inputManager_->clearBuffers();262 }263 264 220 } -
code/trunk/src/orxonox/gamestates/GSGraphics.h
r3280 r3327 37 37 38 38 #include "OrxonoxPrereqs.h" 39 40 39 #include "core/GameState.h" 41 #include "interfaces/WindowEventListener.h"42 40 43 41 namespace orxonox … … 49 47 This game state is only left out if we start a dedicated server where no graphics are present. 50 48 */ 51 class _OrxonoxExport GSGraphics : public GameState , public WindowEventListener49 class _OrxonoxExport GSGraphics : public GameState 52 50 { 53 51 public: 54 52 GSGraphics(const GameStateConstrParams& params); 55 53 ~GSGraphics(); 56 void setConfigValues();57 54 58 55 void activate(); … … 63 60 64 61 private: 65 // Window events from WindowEventListener66 void windowResized(unsigned int newWidth, unsigned int newHeight);67 void windowFocusChanged();68 69 62 // managed singletons 70 63 InputManager* inputManager_; //!< Reference to input management … … 75 68 76 69 KeyBinder* masterKeyBinder_; //!< Key binder for master key bindings 77 SimpleInputState*masterInputState_; //!< Special input state for master input70 InputState* masterInputState_; //!< Special input state for master input 78 71 XMLFile* debugOverlay_; 79 72 ConsoleCommand* ccToggleGUI_; //!< Console command to toggle GUI -
code/trunk/src/orxonox/gamestates/GSLevel.cc
r3280 r3327 31 31 32 32 #include "core/input/InputManager.h" 33 #include "core/input/ SimpleInputState.h"33 #include "core/input/InputState.h" 34 34 #include "core/input/KeyBinder.h" 35 35 #include "core/Clock.h" … … 90 90 if (GameMode::showsGraphics()) 91 91 { 92 gameInputState_ = InputManager::getInstance().createInputState <SimpleInputState>("game");92 gameInputState_ = InputManager::getInstance().createInputState("game"); 93 93 keyBinder_ = new KeyBinder(); 94 94 keyBinder_->loadBindings("keybindings.ini"); 95 95 gameInputState_->setHandler(keyBinder_); 96 96 97 guiMouseOnlyInputState_ = InputManager::getInstance().createInputState <SimpleInputState>("guiMouseOnly");97 guiMouseOnlyInputState_ = InputManager::getInstance().createInputState("guiMouseOnly"); 98 98 guiMouseOnlyInputState_->setMouseHandler(GUIManager::getInstancePtr()); 99 99 100 guiKeysOnlyInputState_ = InputManager::getInstance().createInputState <SimpleInputState>("guiKeysOnly");100 guiKeysOnlyInputState_ = InputManager::getInstance().createInputState("guiKeysOnly"); 101 101 guiKeysOnlyInputState_->setKeyHandler(GUIManager::getInstancePtr()); 102 102 … … 134 134 135 135 // level is loaded: we can start capturing the input 136 InputManager::getInstance(). requestEnterState("game");136 InputManager::getInstance().enterState("game"); 137 137 } 138 138 } … … 144 144 GUIManager::getInstance().showGUI("inGameTest"); 145 145 GUIManager::getInstance().executeCode("showCursor()"); 146 InputManager::getInstance(). requestEnterState("guiMouseOnly");146 InputManager::getInstance().enterState("guiMouseOnly"); 147 147 } 148 148 else … … 150 150 GUIManager::getInstance().executeCode("hideGUI(\"inGameTest\")"); 151 151 GUIManager::getInstance().executeCode("hideCursor()"); 152 InputManager::getInstance(). requestLeaveState("guiMouseOnly");152 InputManager::getInstance().leaveState("guiMouseOnly"); 153 153 } 154 154 } … … 178 178 179 179 if (GameMode::showsGraphics()) 180 InputManager::getInstance(). requestLeaveState("game");180 InputManager::getInstance().leaveState("game"); 181 181 182 182 if (GameMode::isMaster()) … … 218 218 guiMouseOnlyInputState_->setHandler(0); 219 219 guiKeysOnlyInputState_->setHandler(0); 220 InputManager::getInstance(). requestDestroyState("game");220 InputManager::getInstance().destroyState("game"); 221 221 if (this->keyBinder_) 222 222 { … … 286 286 { 287 287 COUT(0) << "Press any button/key or move a mouse/joystick axis" << std::endl; 288 InputManager::getInstance(). requestEnterState("detector");288 InputManager::getInstance().enterState("detector"); 289 289 bindingString = command; 290 290 bTemporarySaved = bTemporary; … … 301 301 COUT(0) << "Binding string \"" << bindingString << "\" on key '" << name << "'" << std::endl; 302 302 this->keyBinder_->setBinding(bindingString, name, bTemporarySaved); 303 InputManager::getInstance(). requestLeaveState("detector");303 InputManager::getInstance().leaveState("detector"); 304 304 bound = true; 305 305 } -
code/trunk/src/orxonox/gamestates/GSLevel.h
r3280 r3327 63 63 64 64 KeyBinder* keyBinder_; //!< tool that loads and manages the input bindings 65 SimpleInputState*gameInputState_; //!< input state for normal ingame playing66 SimpleInputState*guiMouseOnlyInputState_; //!< input state if we only need the mouse to use the GUI67 SimpleInputState*guiKeysOnlyInputState_; //!< input state if we only need the keys to use the GUI65 InputState* gameInputState_; //!< input state for normal ingame playing 66 InputState* guiMouseOnlyInputState_; //!< input state if we only need the mouse to use the GUI 67 InputState* guiKeysOnlyInputState_; //!< input state if we only need the keys to use the GUI 68 68 Radar* radar_; //!< represents the Radar (not the HUD part) 69 69 CameraManager* cameraManager_; //!< camera manager for this level -
code/trunk/src/orxonox/gamestates/GSMainMenu.cc
r3280 r3327 32 32 33 33 #include "core/input/InputManager.h" 34 #include "core/input/ SimpleInputState.h"34 #include "core/input/InputState.h" 35 35 #include "core/Game.h" 36 36 #include "core/Clock.h" … … 57 57 void GSMainMenu::activate() 58 58 { 59 inputState_ = InputManager::getInstance().createInputState <SimpleInputState>("mainMenu");59 inputState_ = InputManager::getInstance().createInputState("mainMenu"); 60 60 inputState_->setHandler(GUIManager::getInstancePtr()); 61 inputState_->setJoyStickHandler(&Input Manager::EMPTY_HANDLER);61 inputState_->setJoyStickHandler(&InputHandler::EMPTY); 62 62 63 63 // create an empty Scene … … 96 96 } 97 97 98 InputManager::getInstance(). requestEnterState("mainMenu");98 InputManager::getInstance().enterState("mainMenu"); 99 99 100 100 this->ambient_ = new SoundMainMenu(); … … 106 106 delete this->ambient_; 107 107 108 InputManager::getInstance(). requestLeaveState("mainMenu");109 InputManager::getInstance(). requestDestroyState("mainMenu");108 InputManager::getInstance().leaveState("mainMenu"); 109 InputManager::getInstance().destroyState("mainMenu"); 110 110 111 111 GUIManager::getInstance().setCamera(0); -
code/trunk/src/orxonox/gamestates/GSMainMenu.h
r3280 r3327 53 53 54 54 private: 55 SimpleInputState*inputState_;55 InputState* inputState_; 56 56 Scene* scene_; 57 57 Ogre::Camera* camera_;
Note: See TracChangeset
for help on using the changeset viewer.