Changeset 7900 in orxonox.OLD for branches/gui/src/story_entities/game_world.cc
- Timestamp:
- May 27, 2006, 1:09:35 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gui/src/story_entities/game_world.cc
r7840 r7900 25 25 26 26 #include "util/loading/game_loader.h" 27 #include "util/timer.h" 27 28 28 29 #include "player.h" … … 259 260 this->cycle = 0; 260 261 for (unsigned int i = 0; i < TICK_SMOOTH_VALUE; i++) 261 this->frameTimes[i] = 100;262 this->frameTimes[i] = 0.01f; 262 263 this->dtS = 0.0f; 263 this->lastFrame = SDL_GetTicks();264 this->lastFrame = Timer::getNow(); 264 265 265 266 if (this->dataTank->music != NULL) … … 356 357 void GameWorld::tick () 357 358 { 358 Uint32 currentFrame = SDL_GetTicks();359 360 359 if( !this->bPaused) 361 360 { 362 361 // CALCULATE FRAMERATE 363 362 Uint32 frameTimesIndex; 364 Uint32 getTicks;365 363 Uint32 i; 364 double currentFrame = Timer::getNow(); 366 365 367 366 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; 371 369 ++this->cycle; 372 this->dtS = 0 ;370 this->dtS = 0.0; 373 371 for (i = 0; i < TICK_SMOOTH_VALUE; i++) 374 372 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; 376 374 377 375 // TICK everything … … 390 388 this->dataTank->gameRule->tick(this->dtS); 391 389 } 392 this->lastFrame = currentFrame;393 390 } 394 391
Note: See TracChangeset
for help on using the changeset viewer.