Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7132 in orxonox.OLD for trunk/src/story_entities


Ignore:
Timestamp:
Feb 14, 2006, 12:30:44 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: better entry point for the speed messurement

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/story_entities/game_world.cc

    r7131 r7132  
    252252  this->cycle = 0;
    253253  for (unsigned int i = 0; i < TICK_SMOOTH_VALUE; i++)
    254     this->frameTimes[i] = 0;
     254    this->frameTimes[i] = 100;
    255255  this->dtS = 0.0f;
    256256  this->lastFrame = SDL_GetTicks ();
     
    258258  while( this->isRunning) /* @todo implement pause */
    259259  {
    260     ++this->cycle;
    261260    /* process intput */
    262261    this->handleInput ();
     
    332331    Uint32 frameTimesIndex;
    333332    Uint32 getTicks;
    334     Uint32 count;
    335333    Uint32 i;
    336334
     
    339337    this->frameTimes[frameTimesIndex] = getTicks - this->lastFrame;
    340338    this->lastFrame = getTicks;
    341     //this->cycle++;
    342   // Work out the current framerate
    343     if (this->cycle < TICK_SMOOTH_VALUE)
    344       count = this->cycle;
    345     else
    346       count = TICK_SMOOTH_VALUE;
    347         // add up all the values and divide to get the average frame time.
     339    ++this->cycle;
    348340    this->dtS = 0;
    349     for (i = 0; i < count; i++)
     341    for (i = 0; i < TICK_SMOOTH_VALUE; i++)
    350342      this->dtS += this->frameTimes[i];
    351     this->dtS = this->dtS / count / 1000.0f * speed;
     343    this->dtS = this->dtS / TICK_SMOOTH_VALUE / 1000.0f * speed;
    352344
    353345    // TICK everything
Note: See TracChangeset for help on using the changeset viewer.