-
-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use higher precision timing in main loop (#2983)
Currently, because inverse frame rates are rounded to milliseconds in src/supertux/screen_manager.cpp, the only possible logical frame rates are 1/0.016 = 62.5fps, 1/0.015 = 66.66fps, 1/0.014 = 71.43fps, etc. (The current value LOGICAL_FPS=64.f gets rounded to 66.66.). This PR makes it possible to change the logical FPS to arbitrary values (like 120fps, if we want a multiple of the most common monitor refresh rate). It should also very slightly reduce jitter from time measurements on high frame rate displays. * Correct for rounding in LOGICAL_FPS The main loop for SuperTux used millisecond-precision timing, and as a result rounded the spacing between logical steps to the nearest millisecond. As a result, the actual logical fps did not match the LOGICAL_FPS constant. This commit updates LOGICAL_FPS to match. * Use higher precision timing in main loop This very slightly reduces jitter from timing quantization noise, and makes it possible to use arbitrary logical frame rates, instead of those corresponding to integer millisecond frame spacings.
- Loading branch information
Showing
3 changed files
with
21 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters