Changeset 1032 for code/trunk/src/orxonox/Orxonox.cc
- Timestamp:
- Apr 12, 2008, 4:08:29 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/Orxonox.cc
r1028 r1032 27 27 28 28 /** 29 @file Orxonox.cc29 @file 30 30 @brief Orxonox Main Class 31 31 */ … … 33 33 // Precompiled Headers 34 34 #include "OrxonoxStableHeaders.h" 35 36 //****** STD ******* 37 //#include <iostream> 38 //#include <exception> 39 #include <deque> 35 40 36 41 //****** OGRE ****** … … 39 44 #include <OgreOverlay.h> 40 45 #include <OgreOverlayManager.h> 46 #include <OgreRoot.h> 41 47 #include <OgreTimer.h> 42 48 #include <OgreWindowEventUtilities.h> 43 49 44 //****** STD *******45 //#include <iostream>46 //#include <exception>47 #include <deque>48 49 50 //***** ORXONOX **** 50 // misc51 // util 51 52 //#include "util/Sleep.h" 52 53 #include "util/ArgReader.h" 53 54 54 // audio 55 #include "audio/AudioManager.h" 56 57 // network 58 #include "network/Server.h" 59 #include "network/Client.h" 60 network::Client *client_g; 61 network::Server *server_g; 62 63 // objects 55 // core 64 56 #include "core/Debug.h" 65 57 #include "core/Factory.h" 66 58 #include "core/Loader.h" 67 59 #include "core/Tickable.h" 60 #include "core/InputManager.h" 61 62 // audio 63 #include "audio/AudioManager.h" 64 65 // network 66 #include "network/Server.h" 67 #include "network/Client.h" 68 69 // objects and tools 70 #include "tools/Timer.h" 68 71 #include "hud/HUD.h" 69 #include "tools/Timer.h" 70 #include "objects/weapon/BulletManager.h" 71 72 #include "core/InputManager.h" 72 //#include "objects/weapon/BulletManager.h" 73 73 74 74 #include "Orxonox.h" 75 76 // FIXME: is this really file scope? 77 // globals for the server or client 78 network::Client *client_g; 79 network::Server *server_g; 75 80 76 81 namespace orxonox … … 86 91 Orxonox::Orxonox() 87 92 { 88 this->ogre_ = new GraphicsEngine();93 this->ogre_ = &GraphicsEngine::getSingleton(); 89 94 this->timer_ = 0; 90 95 this->dataPath_ = ""; … … 103 108 { 104 109 // keep in mind: the order of deletion is very important! 105 if (this->bulletMgr_)106 delete this->bulletMgr_;110 // if (this->bulletMgr_) 111 // delete this->bulletMgr_; 107 112 if (this->orxonoxHUD_) 108 113 delete this->orxonoxHUD_; … … 113 118 if (this->timer_) 114 119 delete this->timer_; 115 if (this->ogre_) 116 delete this->ogre_; 120 GraphicsEngine::getSingleton().destroy(); 117 121 118 122 if (client_g) … … 251 255 auMan_ = new audio::AudioManager(); 252 256 253 bulletMgr_ = new BulletManager();257 //bulletMgr_ = new BulletManager(); 254 258 255 259 Ogre::Overlay* hudOverlay = Ogre::OverlayManager::getSingleton().getByName("Orxonox/HUD1.2"); … … 298 302 auMan_ = new audio::AudioManager(); 299 303 300 bulletMgr_ = new BulletManager();304 //bulletMgr_ = new BulletManager(); 301 305 302 306 // load this file from config … … 342 346 About the loop: The design is almost exactly like the one in ogre, so that 343 347 if any part of ogre registers a framelisteners, it will still behave 344 correctly. Furthermore I have taken over the time smoothing feature from345 ogre. If turned on (see orxonox constructor), it will calculate the dt_n by346 means of the recent most dt_n-1, dt_n-2, etc.348 correctly. Furthermore the time smoothing feature from ogre has been 349 implemented too. If turned on (see orxonox constructor), it will calculate 350 the dt_n by means of the recent most dt_n-1, dt_n-2, etc. 347 351 */ 348 352 void Orxonox::startRenderLoop() 349 353 { 354 // first check whether ogre root object has been created 355 if (Ogre::Root::getSingletonPtr() == 0) 356 { 357 COUT(2) << "Error: Could not start rendering. No Ogre root object found" << std::endl; 358 return; 359 } 360 350 361 // Contains the times of recently fired events 351 362 // eventTimes[4] is the list for the times required for the fps counter … … 389 400 // don't forget to call _fireFrameStarted in ogre to make sure 390 401 // everything goes smoothly 391 ogre_->frameStarted(evt);402 Ogre::Root::getSingleton()._fireFrameStarted(evt); 392 403 393 404 // server still renders at the moment 394 405 //if (mode_ != SERVER) 395 ogre_->renderOneFrame(); // only render in non-server mode406 Ogre::Root::getSingleton()._updateAllRenderTargets(); // only render in non-server mode 396 407 397 408 // get current time … … 403 414 404 415 // again, just to be sure ogre works fine 405 ogre_->frameEnded(evt);416 Ogre::Root::getSingleton()._fireFrameEnded(evt); 406 417 } 407 418 }
Note: See TracChangeset
for help on using the changeset viewer.