Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7919 in orxonox.OLD for trunk/src/story_entities/game_world.cc


Ignore:
Timestamp:
May 28, 2006, 3:48:13 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the gui branche back
merged with command:
https://svn.orxonox.net/orxonox/branches/gui
no conflicts

File:
1 edited

Legend:

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

    r7871 r7919  
    2525
    2626#include "util/loading/game_loader.h"
     27#include "util/timer.h"
    2728
    2829#include "player.h"
     
    259260  this->cycle = 0;
    260261  for (unsigned int i = 0; i < TICK_SMOOTH_VALUE; i++)
    261     this->frameTimes[i] = 100;
     262    this->frameTimes[i] = 0.01f;
    262263  this->dtS = 0.0f;
    263   this->lastFrame = SDL_GetTicks ();
     264  this->lastFrame = Timer::getNow();
    264265
    265266  if (this->dataTank->music != NULL)
     
    356357void GameWorld::tick ()
    357358{
    358   Uint32 currentFrame = SDL_GetTicks();
    359 
    360359  if( !this->bPaused)
    361360  {
    362361    // CALCULATE FRAMERATE
    363362    Uint32 frameTimesIndex;
    364     Uint32 getTicks;
    365363    Uint32 i;
     364    double currentFrame = Timer::getNow();
    366365
    367366    frameTimesIndex = this->cycle % TICK_SMOOTH_VALUE;
    368     getTicks = SDL_GetTicks();
    369     this->frameTimes[frameTimesIndex] = getTicks - this->lastFrame;
    370     this->lastFrame = getTicks;
     367    this->frameTimes[frameTimesIndex] = currentFrame - this->lastFrame;
     368    this->lastFrame = currentFrame;
    371369    ++this->cycle;
    372     this->dtS = 0;
     370    this->dtS = 0.0;
    373371    for (i = 0; i < TICK_SMOOTH_VALUE; i++)
    374372      this->dtS += this->frameTimes[i];
    375     this->dtS = this->dtS / TICK_SMOOTH_VALUE / 1000.0f * speed;
     373    this->dtS = this->dtS / TICK_SMOOTH_VALUE * speed;
    376374
    377375    // TICK everything
     
    390388      this->dataTank->gameRule->tick(this->dtS);
    391389  }
    392   this->lastFrame = currentFrame;
    393390}
    394391
     
    526523  GraphicsEngine* engine = GraphicsEngine::getInstance();
    527524
     525
    528526  AtmosphericEngine::getInstance()->draw();
     527
     528  //glEnable(GL_DEPTH_TEST);
     529  //glEnable(GL_LIGHTING);
    529530
    530531  // set camera
Note: See TracChangeset for help on using the changeset viewer.