Changeset 1035 for code/trunk/src/orxonox/core
- Timestamp:
- Apr 12, 2008, 11:23:32 PM (16 years ago)
- Location:
- code/trunk/src/orxonox/core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/core/InputManager.cc
r1034 r1035 43 43 @brief The reference to the singleton 44 44 */ 45 InputManager* InputManager::singletonRef_s = 0;45 //InputManager* InputManager::singletonRef_s = 0; 46 46 47 47 /** … … 60 60 InputManager::~InputManager() 61 61 { 62 this->destroy Devices();62 this->destroy(); 63 63 } 64 64 65 65 /** 66 66 @brief The one instance of the InputManager is stored in this function. 67 @return The pointer to the only instance of the InputManager 68 */ 69 InputManager *InputManager::getSingleton() 70 { 71 if (!singletonRef_s) 72 singletonRef_s = new InputManager(); 73 return singletonRef_s; 67 @return A reference to the only instance of the InputManager 68 */ 69 InputManager& InputManager::getSingleton() 70 { 71 static InputManager theOnlyInstance; 72 return theOnlyInstance; 74 73 } 75 74 … … 142 141 143 142 /** 144 @brief Destroys all the created input devices .145 */ 146 void InputManager::destroy Devices()147 { 148 COUT(ORX_DEBUG) << "*** InputManager: Destroying InputManager..." << std::endl;143 @brief Destroys all the created input devices and handlers. 144 */ 145 void InputManager::destroy() 146 { 147 COUT(ORX_DEBUG) << "*** InputManager: Destroying ..." << std::endl; 149 148 if (this->mouse_) 150 149 this->inputSystem_->destroyInputObject(mouse_); … … 157 156 this->keyboard_ = 0; 158 157 this->inputSystem_ = 0; 158 159 if (this->handlerBuffer_) 160 delete this->handlerBuffer_; 161 if (this->handlerGame_) 162 delete this->handlerGame_; 163 if (this->handlerGUI_) 164 delete this->handlerGUI_; 165 166 this->handlerBuffer_ = 0; 167 this->handlerGame_ = 0; 168 this->handlerGUI_ = 0; 169 159 170 COUT(ORX_DEBUG) << "*** InputManager: Destroying done." << std::endl; 160 }161 162 /**163 @brief Destroys the singleton.164 */165 void InputManager::destroySingleton()166 {167 if (singletonRef_s)168 delete singletonRef_s;169 singletonRef_s = 0;170 171 } 171 172 -
code/trunk/src/orxonox/core/InputManager.h
r1024 r1035 67 67 public: 68 68 bool initialise(size_t windowHnd, int windowWidth, int windowHeight); 69 void destroy Devices();69 void destroy(); 70 70 void tick(float dt); 71 71 void setWindowExtents(int width, int height); … … 77 77 OIS::Keyboard *getKeyboard() { return this->keyboard_; } 78 78 79 static InputManager *getSingleton();80 static void destroySingleton();79 static InputManager& getSingleton(); 80 static InputManager* getSingletonPtr() { return &getSingleton(); } 81 81 82 82 private: … … 84 84 InputManager (); 85 85 InputManager (const InputManager&); 86 InputManager& operator=(const InputManager& instance);87 86 ~InputManager(); 88 87 … … 99 98 100 99 //! Pointer to the instance of the singleton 101 static InputManager *singletonRef_s;100 //static InputManager *singletonRef_s; 102 101 }; 103 102 }
Note: See TracChangeset
for help on using the changeset viewer.