Changeset 929 for code/branches/network/src/orxonox/InputHandler.cc
- Timestamp:
- Mar 26, 2008, 11:39:55 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/orxonox/InputHandler.cc
r928 r929 44 44 @brief Constructor only resets the pointer values to 0. 45 45 */ 46 InputHandler::InputHandler() 46 InputHandler::InputHandler() : 47 mouse_(0), keyboard_(0), inputSystem_(0), 48 uninitialized_(true) 47 49 { 48 50 //RegisterObject(InputHandler); 49 this->mouse_ = 0; 50 this->keyboard_ = 0; 51 this->inputSystem_ = 0; 51 } 52 53 /** 54 @brief Destructor only called at the end of the program 55 */ 56 InputHandler::~InputHandler() 57 { 58 this->destroy(); 52 59 } 53 60 … … 71 78 void InputHandler::initialise(size_t windowHnd, int windowWidth, int windowHeight) 72 79 { 73 if ( !inputSystem_)80 if (this->uninitialized_ || !this->inputSystem_) 74 81 { 75 82 // Setup basic variables … … 104 111 this->setWindowExtents(windowWidth, windowHeight); 105 112 } 113 114 uninitialized_ = false; 106 115 } 107 116 … … 120 129 void InputHandler::destroy() 121 130 { 122 this->inputSystem_->destroyInputObject(this->mouse_); 123 this->inputSystem_->destroyInputObject(this->keyboard_); 124 OIS::InputManager::destroyInputSystem(this->inputSystem_); 125 126 //TODO: If the InputHandler has been destroyed, how does it know? 131 if (!this->inputSystem_) 132 { 133 this->inputSystem_->destroyInputObject(this->mouse_); 134 this->inputSystem_->destroyInputObject(this->keyboard_); 135 OIS::InputManager::destroyInputSystem(this->inputSystem_); 136 } 137 138 this->uninitialized_ = true; 127 139 } 128 140
Note: See TracChangeset
for help on using the changeset viewer.