Author: plouj
Date: 2007-12-28 05:18:53 +0100 (Fri, 28 Dec 2007)
New Revision: 3537
Modified:
trunk/pingus/src/screen/screen_manager.cpp
Log:
introduced a temporary variable for storing frame time to avoid problems
related to large differences in time between lines of code (caused by system
lag)
Modified: trunk/pingus/src/screen/screen_manager.cpp
===================================================================
--- trunk/pingus/src/screen/screen_manager.cpp 2007-12-28 03:06:07 UTC (rev
3536)
+++ trunk/pingus/src/screen/screen_manager.cpp 2007-12-28 04:18:53 UTC (rev
3537)
@@ -147,10 +147,12 @@
fade_over(last_screen, get_current_screen());
}
+ // save this value because it might change drastically within the if
statement
+ float current_frame_time = frame_timer.get();
// cap the framerate at the desired value
- if (frame_timer.get() < 1 / desired_fps) {
+ if (current_frame_time < 1 / desired_fps) {
// idle delay to make the frame take as long as we want it to
- SDL_Delay(static_cast<Uint32>(1000 *((1 / desired_fps) -
frame_timer.get())));
+ SDL_Delay(static_cast<Uint32>(1000 *((1 / desired_fps) -
current_frame_time)));
}
}
_______________________________________________
pingus-cvs mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/pingus-cvs