Changeset 1674 for code/branches/gui/src/orxonox/gamestates/GSIO.cc
- Timestamp:
- Aug 28, 2008, 8:30:25 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/orxonox/gamestates/GSIO.cc
r1672 r1674 30 30 #include "GSIO.h" 31 31 32 #include <OgreFrameListener.h>33 #include <OgreRoot.h>34 #include <OgreTimer.h>35 36 #include "core/ConsoleCommand.h"37 #include "core/TclThreadManager.h"38 #include "GraphicsEngine.h"39 40 32 namespace orxonox 41 33 { 42 34 GSIO::GSIO() 43 35 : GameState("io") 44 //, timer_(0)45 36 { 46 37 } … … 58 49 } 59 50 60 void GSIO::ticked( float dt, uint64_ttime)51 void GSIO::ticked(const Clock& time) 61 52 { 62 this->tickChild(dt, time); 63 //Ogre::Root& ogreRoot = Ogre::Root::getSingleton(); 64 65 //unsigned long frameCount = 0; 66 67 //const unsigned long refreshTime = (unsigned long)(debugRefreshTime_ * 1000000.0f); 68 //unsigned long refreshStartTime = 0; 69 //unsigned long tickTime = 0; 70 //unsigned long oldFrameCount = 0; 71 72 //unsigned long timeBeforeTick = 0; 73 //unsigned long timeBeforeTickOld = 0; 74 //unsigned long timeAfterTick = 0; 75 76 //// TODO: Update time in seconds every 7 seconds to avoid any overflow (7 secs is very tight) 77 78 //COUT(3) << "Orxonox: Starting the main loop." << std::endl; 79 80 //try 81 //{ 82 // timer_->reset(); 83 // while (!this->hasScheduledTransition()) 84 // { 85 // // get current time 86 // timeBeforeTickOld = timeBeforeTick; 87 // timeBeforeTick = timer_->getMicroseconds(); 88 // float dt = (timeBeforeTick - timeBeforeTickOld) / 1000000.0; 89 90 // TclThreadManager::getInstance().tick(dt); 91 92 // this->tickChild(dt); 93 94 // // get current time once again 95 // timeAfterTick = timer_->getMicroseconds(); 96 97 // tickTime += timeAfterTick - timeBeforeTick; 98 // if (timeAfterTick > refreshStartTime + refreshTime) 99 // { 100 // GraphicsEngine::getInstance().setAverageTickTime( 101 // (float)tickTime * 0.001 / (frameCount - oldFrameCount)); 102 // float avgFPS = (float)(frameCount - oldFrameCount) / (timeAfterTick - refreshStartTime) * 1000000.0; 103 // GraphicsEngine::getInstance().setAverageFramesPerSecond(avgFPS); 104 105 // oldFrameCount = frameCount; 106 // tickTime = 0; 107 // refreshStartTime = timeAfterTick; 108 // } 109 110 // // don't forget to call _fireFrameStarted in ogre to make sure 111 // // everything goes smoothly 112 // Ogre::FrameEvent evt; 113 // evt.timeSinceLastFrame = dt; 114 // evt.timeSinceLastEvent = dt; // note: same time, but shouldn't matter anyway 115 // ogreRoot._fireFrameStarted(evt); 116 117 // // again, just to be sure ogre works fine 118 // ogreRoot._fireFrameEnded(evt); // note: uses the same time as _fireFrameStarted 119 120 // ++frameCount; 121 // } 122 //} 123 //catch (std::exception& ex) 124 //{ 125 // // something went wrong. 126 // COUT(1) << ex.what() << std::endl; 127 // COUT(1) << "Main loop was stopped by an unhandled exception. Shutting down." << std::endl; 128 //} 53 this->tickChild(time); 129 54 } 130 55 }
Note: See TracChangeset
for help on using the changeset viewer.