Changeset 1035
- Timestamp:
- Apr 12, 2008, 11:23:32 PM (17 years ago)
- Location:
- code/trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/GraphicsEngine.cc
r1032 r1035 25 25 * 26 26 */ 27 27 28 /** 28 29 @file orxonox.cc -
code/trunk/src/orxonox/GraphicsEngine.h
r1032 r1035 1 /* 2 * ORXONOX - the hottest 3D action shooter ever to exist 3 * 4 * 5 * License notice: 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 * Author: 22 * Benjamin Knecht <beni_at_orxonox.net>, (C) 2007 23 * Co-authors: 24 * Reto Grieder 25 * 26 */ 27 1 28 /** 2 @file GraphicsEngine.h3 @brief Graphics Engine29 @file 30 @brief Declaration of GraphicsEngine Singleton. 4 31 @author Benjamin Knecht <beni_at_orxonox.net> 5 32 */ … … 42 69 43 70 static GraphicsEngine& getSingleton(); 71 static GraphicsEngine* getSingletonPtr() { return &getSingleton(); } 44 72 45 73 private: 46 74 // don't mess with singletons 47 75 GraphicsEngine(); 76 ~GraphicsEngine(); 48 77 GraphicsEngine(GraphicsEngine&) { } 49 ~GraphicsEngine();50 78 51 79 //! Method called by the LogListener from Ogre -
code/trunk/src/orxonox/Orxonox.cc
r1032 r1035 113 113 delete this->orxonoxHUD_; 114 114 Loader::close(); 115 InputManager:: destroySingleton();115 InputManager::getSingleton().destroy(); 116 116 if (this->auMan_) 117 117 delete this->auMan_; … … 329 329 void Orxonox::setupInputSystem() 330 330 { 331 inputHandler_ = InputManager::getSingleton();331 inputHandler_ = &InputManager::getSingleton(); 332 332 if (!inputHandler_->initialise(ogre_->getWindowHandle(), 333 333 ogre_->getWindowWidth(), ogre_->getWindowHeight())) -
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 } -
code/trunk/src/orxonox/objects/SpaceShip.cc
r1032 r1035 417 417 void SpaceShip::tick(float dt) 418 418 { 419 if (InputManager::getSingleton() ->getMouse()->getEventCallback() != this)420 { 421 if (InputManager::getSingleton() ->getMouse())419 if (InputManager::getSingleton().getMouse()->getEventCallback() != this) 420 { 421 if (InputManager::getSingleton().getMouse()) 422 422 { 423 InputManager::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 = InputManager::getSingleton() ->getKeyboard();449 OIS::Mouse* mMouse = InputManager::getSingleton() ->getMouse();448 OIS::Keyboard* mKeyboard = InputManager::getSingleton().getKeyboard(); 449 OIS::Mouse* mMouse = InputManager::getSingleton().getMouse(); 450 450 451 451 -
code/trunk/visual_studio/vc8/orxonox.vcproj
r1032 r1035 245 245 /> 246 246 </FileConfiguration> 247 <FileConfiguration 248 Name="Release|Win32" 249 ExcludedFromBuild="true" 250 > 251 <Tool 252 Name="VCCLCompilerTool" 253 /> 254 </FileConfiguration> 247 255 </File> 248 256 <File … … 257 265 /> 258 266 </FileConfiguration> 267 <FileConfiguration 268 Name="Release|Win32" 269 ExcludedFromBuild="true" 270 > 271 <Tool 272 Name="VCCLCompilerTool" 273 /> 274 </FileConfiguration> 259 275 </File> 260 276 <File … … 269 285 /> 270 286 </FileConfiguration> 287 <FileConfiguration 288 Name="Release|Win32" 289 ExcludedFromBuild="true" 290 > 291 <Tool 292 Name="VCCLCompilerTool" 293 /> 294 </FileConfiguration> 271 295 </File> 272 296 <File … … 281 305 /> 282 306 </FileConfiguration> 307 <FileConfiguration 308 Name="Release|Win32" 309 ExcludedFromBuild="true" 310 > 311 <Tool 312 Name="VCCLCompilerTool" 313 /> 314 </FileConfiguration> 283 315 </File> 284 316 <File … … 293 325 /> 294 326 </FileConfiguration> 327 <FileConfiguration 328 Name="Release|Win32" 329 ExcludedFromBuild="true" 330 > 331 <Tool 332 Name="VCCLCompilerTool" 333 /> 334 </FileConfiguration> 295 335 </File> 296 336 <File … … 299 339 <FileConfiguration 300 340 Name="Debug|Win32" 341 ExcludedFromBuild="true" 342 > 343 <Tool 344 Name="VCCLCompilerTool" 345 /> 346 </FileConfiguration> 347 <FileConfiguration 348 Name="Release|Win32" 301 349 ExcludedFromBuild="true" 302 350 >
Note: See TracChangeset
for help on using the changeset viewer.