Changeset 1662 for code/branches/gui/src/orxonox/gamestates/GSGraphics.cc
- Timestamp:
- Aug 19, 2008, 8:12:15 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/orxonox/gamestates/GSGraphics.cc
r1661 r1662 35 35 #include <OgreWindowEventUtilities.h> 36 36 37 #include "core/ConsoleCommand.h" 38 #include "core/ConfigValueIncludes.h" 37 39 #include "core/input/InputManager.h" 38 #include "core/input/SimpleInputState.h"39 #include "core/input/KeyBinder.h"40 40 #include "core/Core.h" 41 42 #include "GraphicsEngine.h"43 41 #include "overlays/console/InGameConsole.h" 44 42 #include "gui/GUIManager.h" 43 #include "GraphicsEngine.h" 45 44 46 45 namespace orxonox … … 88 87 guiManager_ = new GUIManager(); 89 88 guiManager_->initialise(); 89 90 // use the ogre timer class to measure time. 91 timer_ = new Ogre::Timer(); 92 93 // add console commands 94 FunctorMember<GSGraphics>* functor = createFunctor(&GSGraphics::exitGame); 95 functor->setObject(this); 96 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor, "exit")); 90 97 } 91 98 92 99 void GSGraphics::leave() 93 100 { 94 if (this->guiManager_) 95 delete guiManager_; 96 97 if (this->console_) 98 delete this->console_; 99 100 if (inputManager_) 101 delete inputManager_; 102 103 // TODO: deintialise graphics 104 } 105 101 delete this->timer_; 102 103 delete this->guiManager_; 104 105 delete this->console_; 106 107 delete this->inputManager_; 108 109 // TODO: destroy render window 110 } 111 112 /** 113 Main loop of the orxonox game. 114 We use the Ogre::Timer to measure time since it uses the most precise 115 method an a platform (however the windows timer lacks time when under 116 heavy kernel load!). 117 There is a simple mechanism to measure the average time spent in our 118 ticks as it may indicate performance issues. 119 A note about the Ogre::FrameListener: Even though we don't use them, 120 they still get called. However, the delta times are not correct (except 121 for timeSinceLastFrame, which is the most important). A little research 122 as shown that there is probably only one FrameListener that doesn't even 123 need the time. So we shouldn't run into problems. 124 */ 106 125 bool GSGraphics::tick(float dt) 107 126 { 127 // note: paramter 'dt' is of no meaning 128 108 129 Ogre::Root& ogreRoot = Ogre::Root::getSingleton(); 109 110 // use the ogre timer class to measure time.111 if (!timer_)112 timer_ = new Ogre::Timer();113 130 114 131 unsigned long frameCount = 0; … … 146 163 this->getActiveChild()->tick(dt); 147 164 165 // tick console 166 this->console_->tick(dt); 167 148 168 // get current time once again 149 169 timeAfterTick = timer_->getMicroseconds();
Note: See TracChangeset
for help on using the changeset viewer.