Changeset 6174 for code/branches/presentation2/src/libraries/core/Game.cc
- Timestamp:
- Nov 28, 2009, 6:06:57 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/libraries/core/Game.cc
r6169 r6174 307 307 308 308 uint32_t framesPerPeriod = this->statisticsTickTimes_.size(); 309 this->avgFPS_ = static_cast<float>(framesPerPeriod) / (currentTime - this->statisticsTickTimes_.front().tickTime) * 1000000.0f; 309 // Why plus 1? No idea, but otherwise the fps rate is always (from 10 to 200!) one frame too low 310 this->avgFPS_ = 1 + static_cast<float>(framesPerPeriod) / (currentTime - this->statisticsTickTimes_.front().tickTime) * 1000000.0f; 310 311 this->avgTickTime_ = static_cast<float>(this->periodTickTime_) / framesPerPeriod / 1000.0f; 311 312 … … 316 317 void Game::updateFPSLimiter() 317 318 { 318 // Why fpsLimit_ - 1? No idea, but otherwise the fps rate is always (from 10 to 200!) one frame too high 319 uint32_t nextTime = gameClock_->getMicroseconds() - excessSleepTime_ + static_cast<uint32_t>(1000000.0f / (fpsLimit_ - 1)); 319 uint32_t nextTime = gameClock_->getMicroseconds() - excessSleepTime_ + static_cast<uint32_t>(1000000.0f / fpsLimit_); 320 320 uint64_t currentRealTime = gameClock_->getRealMicroseconds(); 321 321 while (currentRealTime < nextTime - minimumSleepTime_)
Note: See TracChangeset
for help on using the changeset viewer.