Changeset 973 for code/branches/input/src/orxonox/core/InputManager.cc
- Timestamp:
- Apr 3, 2008, 10:23:37 AM (16 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
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;
Note: See TracChangeset
for help on using the changeset viewer.