Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6174


Ignore:
Timestamp:
Nov 28, 2009, 6:06:57 PM (14 years ago)
Author:
rgrieder
Message:

Moved fps hack to the right position. I still have no idea why the fps rate was one frame too low.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/libraries/core/Game.cc

    r6169 r6174  
    307307
    308308            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;
    310311            this->avgTickTime_ = static_cast<float>(this->periodTickTime_) / framesPerPeriod / 1000.0f;
    311312
     
    316317    void Game::updateFPSLimiter()
    317318    {
    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_);
    320320        uint64_t currentRealTime = gameClock_->getRealMicroseconds();
    321321        while (currentRealTime < nextTime - minimumSleepTime_)
Note: See TracChangeset for help on using the changeset viewer.