Changeset 973 for code/branches/input
- Timestamp:
- Apr 3, 2008, 10:23:37 AM (17 years ago)
- Location:
- code/branches/input
- Files:
-
- 13 edited
- 2 copied
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
code/branches/input/src/orxonox/Orxonox.cc
r969 r973 70 70 #include "objects/weapon/BulletManager.h" 71 71 72 #include " InputHandler.h"72 #include "core/InputManager.h" 73 73 74 74 #include "Orxonox.h" … … 108 108 delete this->orxonoxHUD_; 109 109 Loader::close(); 110 Input Handler::destroySingleton();110 InputManager::destroySingleton(); 111 111 if (this->auMan_) 112 112 delete this->auMan_; … … 327 327 void Orxonox::setupInputSystem() 328 328 { 329 inputHandler_ = Input Handler::getSingleton();329 inputHandler_ = InputManager::getSingleton(); 330 330 if (!inputHandler_->initialise(ogre_->getWindowHandle(), 331 331 ogre_->getWindowWidth(), ogre_->getWindowHeight())) -
code/branches/input/src/orxonox/Orxonox.h
r969 r973 17 17 18 18 #include "GraphicsEngine.h" 19 #include " InputEventListener.h"19 #include "core/InputEventListener.h" 20 20 21 21 … … 75 75 audio::AudioManager* auMan_; //!< audio manager 76 76 BulletManager* bulletMgr_; //!< Keeps track of the thrown bullets 77 Input Handler* inputHandler_; //!< Handles input with key bindings77 InputManager* inputHandler_; //!< Handles input with key bindings 78 78 Ogre::Root* root_; //!< Holy grail of Ogre 79 79 Ogre::Timer* timer_; //!< Main loop timer -
code/branches/input/src/orxonox/OrxonoxPrereqs.h
r945 r973 61 61 namespace orxonox { 62 62 class GraphicsEngine; 63 struct InputEvent;64 class InputEventListener;65 class InputHandler;66 63 class Orxonox; 67 64 -
code/branches/input/src/orxonox/core/CorePrereqs.h
r945 r973 36 36 #include <string> 37 37 38 #include " orxonox/OrxonoxPlatform.h"38 #include "OrxonoxPlatform.h" 39 39 40 40 //----------------------------------------------------------------------- … … 86 86 class Identifier; 87 87 class IdentifierDistributor; 88 class InputHandlerGame; 89 class InputHandlerGUI; 90 class InputManager; 88 91 template <class T> 89 92 class Iterator; -
code/branches/input/src/orxonox/core/InputEventListener.h
r971 r973 46 46 class _CoreExport InputEventListener : virtual public OrxonoxClass 47 47 { 48 friend class Input Handler;48 friend class InputManager; 49 49 public: 50 50 InputEventListener(); -
code/branches/input/src/orxonox/core/InputHandler.cc
r971 r973 28 28 /** 29 29 @file 30 @brief Core relevant parts of InputEventListener30 @brief Implementation of the different input handlers. 31 31 */ 32 32 33 #include "InputHandler Base.h"33 #include "InputHandler.h" 34 34 35 35 namespace orxonox 36 36 { 37 // ############################### 38 // ### InputHandlerGame ### 39 // ############################### 40 37 41 /** 38 42 @brief standard constructor 39 43 */ 44 InputHandlerGame::InputHandlerGame() 45 { 46 } 47 48 /** 49 @brief Destructor 50 */ 51 InputHandlerGame::~InputHandlerGame() 52 { 53 } 54 55 /** 56 @brief Event handler for the keyPressed Event. 57 @param e Event information 58 */ 59 bool InputHandlerGame::keyPressed(const OIS::KeyEvent &e) 60 { 61 return true; 62 } 63 64 /** 65 @brief Event handler for the keyReleased Event. 66 @param e Event information 67 */ 68 bool InputHandlerGame::keyReleased(const OIS::KeyEvent &e) 69 { 70 return true; 71 } 72 73 /** 74 @brief Event handler for the mouseMoved Event. 75 @param e Event information 76 */ 77 bool InputHandlerGame::mouseMoved(const OIS::MouseEvent &e) 78 { 79 return true; 80 } 81 82 /** 83 @brief Event handler for the mousePressed Event. 84 @param e Event information 85 @param id The ID of the mouse button 86 */ 87 bool InputHandlerGame::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id) 88 { 89 return true; 90 } 91 92 /** 93 @brief Event handler for the mouseReleased Event. 94 @param e Event information 95 @param id The ID of the mouse button 96 */ 97 bool InputHandlerGame::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id) 98 { 99 return true; 100 } 101 102 // ############################### 103 // ### InputHandlerGUI ### 104 // ############################### 105 106 /** 107 @brief standard constructor 108 */ 109 InputHandlerGUI::InputHandlerGUI() 110 { 111 } 112 113 /** 114 @brief Destructor 115 */ 116 InputHandlerGUI::~InputHandlerGUI() 117 { 118 } 119 120 /** 121 @brief Event handler for the keyPressed Event. 122 @param e Event information 123 */ 124 bool InputHandlerGUI::keyPressed(const OIS::KeyEvent &e) 125 { 126 return true; 127 } 128 129 /** 130 @brief Event handler for the keyReleased Event. 131 @param e Event information 132 */ 133 bool InputHandlerGUI::keyReleased(const OIS::KeyEvent &e) 134 { 135 return true; 136 } 137 138 /** 139 @brief Event handler for the mouseMoved Event. 140 @param e Event information 141 */ 142 bool InputHandlerGUI::mouseMoved(const OIS::MouseEvent &e) 143 { 144 return true; 145 } 146 147 /** 148 @brief Event handler for the mousePressed Event. 149 @param e Event information 150 @param id The ID of the mouse button 151 */ 152 bool InputHandlerGUI::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id) 153 { 154 return true; 155 } 156 157 /** 158 @brief Event handler for the mouseReleased Event. 159 @param e Event information 160 @param id The ID of the mouse button 161 */ 162 bool InputHandlerGUI::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id) 163 { 164 return true; 165 } 40 166 41 167 } -
code/branches/input/src/orxonox/core/InputHandler.h
r971 r973 28 28 /** 29 29 @file 30 @brief InputHandlerBuffer class declaration30 @brief Different implementations of input processing. 31 31 */ 32 32 33 #ifndef _InputHandlerBase_H__ 34 #define _InputHandlerBase_H__ 33 #ifndef _InputHandler_H__ 34 #define _InputHandler_H__ 35 36 #include <OIS/OIS.h> 35 37 36 38 #include "CorePrereqs.h" … … 39 41 { 40 42 /** 41 @brief 43 @brief Captures mouse and keyboard input and distributes it to the 44 GUI. 42 45 */ 43 class InputHandlerBase 46 class _CoreExport InputHandlerGUI 47 : public OIS::KeyListener, public OIS::MouseListener 44 48 { 49 public: 50 InputHandlerGUI (); 51 ~InputHandlerGUI(); 52 53 private: 54 // input events 55 bool mousePressed (const OIS::MouseEvent &arg, OIS::MouseButtonID id); 56 bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id); 57 bool mouseMoved (const OIS::MouseEvent &arg); 58 bool keyPressed (const OIS::KeyEvent &arg); 59 bool keyReleased (const OIS::KeyEvent &arg); 45 60 }; 61 62 63 /** 64 @brief Captures mouse and keyboard input while in the actual game mode. 65 Manages the key bindings. 66 */ 67 class _CoreExport InputHandlerGame 68 : public OIS::KeyListener, public OIS::MouseListener 69 { 70 public: 71 InputHandlerGame (); 72 ~InputHandlerGame(); 73 74 private: 75 // input events 76 bool mousePressed (const OIS::MouseEvent &arg, OIS::MouseButtonID id); 77 bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id); 78 bool mouseMoved (const OIS::MouseEvent &arg); 79 bool keyPressed (const OIS::KeyEvent &arg); 80 bool keyReleased (const OIS::KeyEvent &arg); 81 }; 82 46 83 } 47 84 48 #endif /* _InputHandler Base_H__ */85 #endif /* _InputHandler_H__ */ -
code/branches/input/src/orxonox/core/InputManager.cc
r971 r973 35 35 #include "core/Debug.h" 36 36 #include "InputEventListener.h" 37 #include "Input Handler.h"37 #include "InputManager.h" 38 38 39 39 namespace orxonox … … 42 42 @brief The reference to the singleton 43 43 */ 44 Input Handler* InputHandler::singletonRef_s = 0;44 InputManager* InputManager::singletonRef_s = 0; 45 45 46 46 /** 47 47 @brief Constructor only resets the pointer values to 0. 48 48 */ 49 Input Handler::InputHandler() :49 InputManager::InputManager() : 50 50 mouse_(0), keyboard_(0), inputSystem_(0) 51 51 { … … 55 55 @brief Destructor only called at the end of the program 56 56 */ 57 Input Handler::~InputHandler()57 InputManager::~InputManager() 58 58 { 59 59 this->destroyDevices(); … … 61 61 62 62 /** 63 @brief The one instance of the Input Handler is stored in this function.64 @return The pointer to the only instance of the Input Handler65 */ 66 Input Handler *InputHandler::getSingleton()63 @brief The one instance of the InputManager is stored in this function. 64 @return The pointer to the only instance of the InputManager 65 */ 66 InputManager *InputManager::getSingleton() 67 67 { 68 68 if (!singletonRef_s) 69 singletonRef_s = new Input Handler();69 singletonRef_s = new InputManager(); 70 70 return singletonRef_s; 71 71 } … … 78 78 @param windowHeight The height of the render window 79 79 */ 80 bool Input Handler::initialise(size_t windowHnd, int windowWidth, int windowHeight)80 bool InputManager::initialise(size_t windowHnd, int windowWidth, int windowHeight) 81 81 { 82 82 if (!this->inputSystem_) … … 98 98 // Create inputsystem 99 99 inputSystem_ = OIS::InputManager::createInputSystem(paramList); 100 COUT(ORX_DEBUG) << "*** Input Handler: Created OIS input system" << std::endl;100 COUT(ORX_DEBUG) << "*** InputManager: Created OIS input system" << std::endl; 101 101 102 102 // create a keyboard. If none are available the exception is caught. 103 103 keyboard_ = static_cast<OIS::Keyboard*>(inputSystem_->createInputObject(OIS::OISKeyboard, true)); 104 104 keyboard_->setEventCallback(this); 105 COUT(ORX_DEBUG) << "*** Input Handler: Created OIS mouse" << std::endl;105 COUT(ORX_DEBUG) << "*** InputManager: Created OIS mouse" << std::endl; 106 106 107 107 // create a mouse. If none are available the exception is caught. 108 108 mouse_ = static_cast<OIS::Mouse*>(inputSystem_->createInputObject(OIS::OISMouse, true)); 109 109 mouse_->setEventCallback(this); 110 COUT(ORX_DEBUG) << "*** Input Handler: Created OIS keyboard" << std::endl;110 COUT(ORX_DEBUG) << "*** InputManager: Created OIS keyboard" << std::endl; 111 111 112 112 // Set mouse region … … 122 122 } 123 123 124 COUT(ORX_DEBUG) << "*** Input Handler: Loading key bindings..." << std::endl;124 COUT(ORX_DEBUG) << "*** InputManager: Loading key bindings..." << std::endl; 125 125 // load the key bindings 126 126 InputEvent empty = {0, false, 0, 0, 0}; … … 130 130 //assign 'abort' to the escape key 131 131 this->bindingsKeyPressed_[(int)OIS::KC_ESCAPE].id = 1; 132 COUT(ORX_DEBUG) << "*** Input Handler: Loading done." << std::endl;132 COUT(ORX_DEBUG) << "*** InputManager: Loading done." << std::endl; 133 133 134 134 return true; … … 138 138 @brief Destroys all the created input devices. 139 139 */ 140 void Input Handler::destroyDevices()141 { 142 COUT(ORX_DEBUG) << "*** Input Handler: Destroying InputHandler..." << std::endl;140 void InputManager::destroyDevices() 141 { 142 COUT(ORX_DEBUG) << "*** InputManager: Destroying InputManager..." << std::endl; 143 143 if (this->mouse_) 144 144 this->inputSystem_->destroyInputObject(mouse_); … … 151 151 this->keyboard_ = 0; 152 152 this->inputSystem_ = 0; 153 COUT(ORX_DEBUG) << "*** Input Handler: Destroying done." << std::endl;153 COUT(ORX_DEBUG) << "*** InputManager: Destroying done." << std::endl; 154 154 } 155 155 … … 157 157 @brief Destroys the singleton. 158 158 */ 159 void Input Handler::destroySingleton()159 void InputManager::destroySingleton() 160 160 { 161 161 if (singletonRef_s) … … 165 165 166 166 /** 167 @brief Updates the Input Handler167 @brief Updates the InputManager 168 168 @param dt Delta time 169 169 */ 170 void Input Handler::tick(float dt)170 void InputManager::tick(float dt) 171 171 { 172 172 //this->mouse_->setEventCallback(this); … … 185 185 @param height the new height of the render window 186 186 */ 187 void Input Handler::setWindowExtents(int width, int height)187 void InputManager::setWindowExtents(int width, int height) 188 188 { 189 189 // Set mouse region (if window resizes, we should alter this to reflect as well) … … 197 197 @param evt The input event that occured. 198 198 */ 199 inline void Input Handler::callListeners(orxonox::InputEvent &evt)199 inline void InputManager::callListeners(orxonox::InputEvent &evt) 200 200 { 201 201 for (Iterator<InputEventListener> it = ObjectList<InputEventListener>::start(); it; ) … … 212 212 @param e Event information 213 213 */ 214 bool Input Handler::keyPressed(const OIS::KeyEvent &e)214 bool InputManager::keyPressed(const OIS::KeyEvent &e) 215 215 { 216 216 callListeners(this->bindingsKeyPressed_[(int)e.key]); … … 222 222 @param e Event information 223 223 */ 224 bool Input Handler::keyReleased(const OIS::KeyEvent &e)224 bool InputManager::keyReleased(const OIS::KeyEvent &e) 225 225 { 226 226 return true; … … 231 231 @param e Event information 232 232 */ 233 bool Input Handler::mouseMoved(const OIS::MouseEvent &e)233 bool InputManager::mouseMoved(const OIS::MouseEvent &e) 234 234 { 235 235 return true; … … 241 241 @param id The ID of the mouse button 242 242 */ 243 bool Input Handler::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id)243 bool InputManager::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id) 244 244 { 245 245 COUT(1) << "asdf" << std::endl; … … 252 252 @param id The ID of the mouse button 253 253 */ 254 bool Input Handler::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id)254 bool InputManager::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id) 255 255 { 256 256 return true; -
code/branches/input/src/orxonox/core/InputManager.h
r971 r973 32 32 */ 33 33 34 #ifndef _Input Handler_H__35 #define _Input Handler_H__34 #ifndef _InputManager_H__ 35 #define _InputManager_H__ 36 36 37 37 #include <OIS/OIS.h> … … 51 51 enum InputMode 52 52 { 53 IM_GUI = 0 ;54 IM_KEYBOARD = 1 ;55 IM_INGAME = 2 ;53 IM_GUI = 0, 54 IM_KEYBOARD = 1, 55 IM_INGAME = 2, 56 56 }; 57 57 … … 61 61 implementing the InputEventListener interface. 62 62 */ 63 class _CoreExport Input Handler63 class _CoreExport InputManager 64 64 : public Tickable, public OIS::KeyListener, public OIS::MouseListener 65 65 { … … 74 74 OIS::Keyboard *getKeyboard() { return this->keyboard_; } 75 75 76 static Input Handler* getSingleton();76 static InputManager* getSingleton(); 77 77 static void destroySingleton(); 78 78 79 79 private: 80 80 // don't mess with a Singleton 81 Input Handler ();82 Input Handler (const InputHandler&);83 Input Handler& operator=(const InputHandler& instance);84 ~Input Handler();81 InputManager (); 82 InputManager (const InputManager&); 83 InputManager& operator=(const InputManager& instance); 84 ~InputManager(); 85 85 86 86 void callListeners(InputEvent &evt); … … 114 114 115 115 //! Pointer to the instance of the singleton 116 static Input Handler *singletonRef_s;116 static InputManager *singletonRef_s; 117 117 }; 118 118 } 119 119 120 #endif /* _Input Handler_H__ */120 #endif /* _InputManager_H__ */ -
code/branches/input/src/orxonox/objects/Fighter.cc
r929 r973 39 39 #include "core/CoreIncludes.h" 40 40 #include "Orxonox.h" 41 #include " InputHandler.h"41 #include "core/InputManager.h" 42 42 #include "particle/ParticleInterface.h" 43 43 #include "weapon/AmmunitionDump.h" … … 255 255 if (!this->setMouseEventCallback_) 256 256 { 257 if (Input Handler::getSingleton()->getMouse())257 if (InputManager::getSingleton()->getMouse()) 258 258 { 259 Input Handler::getSingleton()->getMouse()->setEventCallback(this);259 InputManager::getSingleton()->getMouse()->setEventCallback(this); 260 260 this->setMouseEventCallback_ = true; 261 261 } … … 264 264 WorldEntity::tick(dt); 265 265 266 OIS::Keyboard* mKeyboard = Input Handler::getSingleton()->getKeyboard();267 OIS::Mouse* mMouse = Input Handler::getSingleton()->getMouse();266 OIS::Keyboard* mKeyboard = InputManager::getSingleton()->getKeyboard(); 267 OIS::Mouse* mMouse = InputManager::getSingleton()->getMouse(); 268 268 269 269 mKeyboard->capture(); -
code/branches/input/src/orxonox/objects/SpaceShip.cc
r929 r973 42 42 #include "core/Debug.h" 43 43 #include "Orxonox.h" 44 #include " InputHandler.h"44 #include "core/InputManager.h" 45 45 #include "particle/ParticleInterface.h" 46 46 #include "Projectile.h" … … 419 419 if (!this->setMouseEventCallback_) 420 420 { 421 if (Input Handler::getSingleton()->getMouse())421 if (InputManager::getSingleton()->getMouse()) 422 422 { 423 Input Handler::getSingleton()->getMouse()->setEventCallback(this);423 InputManager::getSingleton()->getMouse()->setEventCallback(this); 424 424 this->setMouseEventCallback_ = true; 425 425 } … … 446 446 } 447 447 448 OIS::Keyboard* mKeyboard = Input Handler::getSingleton()->getKeyboard();449 OIS::Mouse* mMouse = Input Handler::getSingleton()->getMouse();448 OIS::Keyboard* mKeyboard = InputManager::getSingleton()->getKeyboard(); 449 OIS::Mouse* mMouse = InputManager::getSingleton()->getMouse(); 450 450 451 451 mKeyboard->capture(); -
code/branches/input/visual_studio/base_properties.vsprops
r944 r973 9 9 Name="VCCLCompilerTool" 10 10 AdditionalIncludeDirectories=""$(RootDir)src";"$(RootDir)src\orxonox";"$(DependencyDir)include"" 11 PreprocessorDefinitions="WIN32;__WIN32__;_WIN32;BOOST_ALL_DYN_LINK "11 PreprocessorDefinitions="WIN32;__WIN32__;_WIN32;BOOST_ALL_DYN_LINK;OIS_DYNAMIC_LIB; ZLIB_WINAPI" 12 12 WarningLevel="3" 13 13 DisableSpecificWarnings="4244;4251" -
code/branches/input/visual_studio/core_properties.vsprops
r790 r973 12 12 <Tool 13 13 Name="VCLinkerTool" 14 AdditionalDependencies="OgreMain$(CS).lib "14 AdditionalDependencies="OgreMain$(CS).lib OIS$(CSS).lib" 15 15 /> 16 16 </VisualStudioPropertySheet> -
code/branches/input/visual_studio/network_properties.vsprops
r918 r973 8 8 <Tool 9 9 Name="VCCLCompilerTool" 10 PreprocessorDefinitions="NETWORK_SHARED_BUILD; ZLIB_WINAPI;WIN32_LEAN_AND_MEAN"10 PreprocessorDefinitions="NETWORK_SHARED_BUILD;WIN32_LEAN_AND_MEAN" 11 11 /> 12 12 <Tool -
code/branches/input/visual_studio/orxonox_properties.vsprops
r790 r973 8 8 <Tool 9 9 Name="VCCLCompilerTool" 10 PreprocessorDefinitions="ORXONOX_SHARED_BUILD ; LOADER_STATIC_BUILD"10 PreprocessorDefinitions="ORXONOX_SHARED_BUILD" 11 11 UsePrecompiledHeader="2" 12 12 PrecompiledHeaderThrough="OrxonoxStableHeaders.h" -
code/branches/input/visual_studio/vc8/core.vcproj
r971 r973 317 317 </File> 318 318 <File 319 RelativePath="..\..\src\orxonox\core\InputHandlerBuffer.cc" 320 > 321 </File> 322 <File 323 RelativePath="..\..\src\orxonox\core\InputHandlerGame.cc" 324 > 325 </File> 326 <File 327 RelativePath="..\..\src\orxonox\core\InputHandlerGUI.cc" 319 RelativePath="..\..\src\orxonox\core\InputManager.cc" 328 320 > 329 321 </File> … … 439 431 </File> 440 432 <File 441 RelativePath="..\..\src\orxonox\core\InputHandlerBuffer.h" 442 > 443 </File> 444 <File 445 RelativePath="..\..\src\orxonox\core\InputHandlerGame.h" 446 > 447 </File> 448 <File 449 RelativePath="..\..\src\orxonox\core\InputHandlerGUI.h" 433 RelativePath="..\..\src\orxonox\core\InputManager.h" 450 434 > 451 435 </File> -
code/branches/input/visual_studio/vc8/orxonox.vcproj
r945 r973 285 285 </File> 286 286 <File 287 RelativePath="..\..\src\orxonox\InputEventListener.cc"288 >289 </File>290 <File291 RelativePath="..\..\src\orxonox\InputHandler.cc"292 >293 </File>294 <File295 287 RelativePath="..\..\src\orxonox\Main.cc" 296 288 > … … 455 447 </File> 456 448 <File 457 RelativePath="..\..\src\orxonox\InputEvent.h"458 >459 </File>460 <File461 RelativePath="..\..\src\orxonox\InputEventListener.h"462 >463 </File>464 <File465 RelativePath="..\..\src\orxonox\InputHandler.h"466 >467 </File>468 <File469 449 RelativePath="..\..\src\orxonox\Orxonox.h" 470 450 >
Note: See TracChangeset
for help on using the changeset viewer.