Changeset 7132 in orxonox.OLD for trunk/src/story_entities
- Timestamp:
- Feb 14, 2006, 12:30:44 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/game_world.cc
r7131 r7132 252 252 this->cycle = 0; 253 253 for (unsigned int i = 0; i < TICK_SMOOTH_VALUE; i++) 254 this->frameTimes[i] = 0;254 this->frameTimes[i] = 100; 255 255 this->dtS = 0.0f; 256 256 this->lastFrame = SDL_GetTicks (); … … 258 258 while( this->isRunning) /* @todo implement pause */ 259 259 { 260 ++this->cycle;261 260 /* process intput */ 262 261 this->handleInput (); … … 332 331 Uint32 frameTimesIndex; 333 332 Uint32 getTicks; 334 Uint32 count;335 333 Uint32 i; 336 334 … … 339 337 this->frameTimes[frameTimesIndex] = getTicks - this->lastFrame; 340 338 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; 348 340 this->dtS = 0; 349 for (i = 0; i < count; i++)341 for (i = 0; i < TICK_SMOOTH_VALUE; i++) 350 342 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; 352 344 353 345 // TICK everything
Note: See TracChangeset
for help on using the changeset viewer.