mkxp-sunshine/src
Jonas Kulla 58bd60a70f Graphics: Attempt to provide more consistent frame timings
We now actively track how far behind / in front of an
ideal timestep we are during each frame, and try to
catch up / delay approximate this timing.

Therefore we use more precise timers and sleep functions
(nanosleep if available). We also delay **before** the
final buffer swap so the frame displays at more consistent
points in time.

Not only should this provide a somewhat more consistent
looking map scrolling at lower frame rates, it also
guarantees that we don't fall out of sync eg. with the
Audio during longer cutscenes.

'Graphics.frameReset()' now finally has a function, in
that it resets the ideal timestep approximation, which I
beliefe was also its job in the original RMXP engine.

I'm not sure how well this will work when the frame rate
is set to the monitor refresh rate and vsync is turned on.
Very likely unnecessary frame skips will occur here and there
due to imprecise timers. In the future we should probably
check if the frame rate is equal to or higher than the
monitor rate, and disable frame skip accordingly.

These changes currently break the F2 FPS display (it shows
a value that's slightly too high).
2013-10-22 17:05:46 +02:00
..
audio.cpp Fix up SDL2 include paths 2013-10-13 23:21:34 +02:00
audio.h Initial commit 2013-09-01 16:27:21 +02:00
autotiles.cpp Initial commit 2013-09-01 16:27:21 +02:00
binding.h Initial commit 2013-09-01 16:27:21 +02:00
bitmap.cpp Bitmap: Make 'Bitmap::textSize()' work with multibyte characters 2013-10-20 22:14:38 +02:00
bitmap.h Bitmap: Add warning to 'flush()' 2013-10-17 15:28:43 +02:00
config.cpp Add config entry "allowSymlinks" 2013-10-20 22:38:46 +02:00
config.h Add config entry "allowSymlinks" 2013-10-20 22:38:46 +02:00
debuglogger.cpp Fix up glew include paths 2013-10-14 02:22:34 +02:00
debuglogger.h Initial commit 2013-09-01 16:27:21 +02:00
disposable.h Initial commit 2013-09-01 16:27:21 +02:00
etc-internal.h Add equality op that compares against a clamped integer 2013-09-27 00:55:48 +02:00
etc.cpp Fix up SDL2 include paths 2013-10-13 23:21:34 +02:00
etc.h Fix 'Rect::isEmpty()' and small performance fixes 2013-09-28 21:45:33 +02:00
eventthread.cpp Graphics: Attempt to provide more consistent frame timings 2013-10-22 17:05:46 +02:00
eventthread.h Graphics: Attempt to provide more consistent frame timings 2013-10-22 17:05:46 +02:00
exception.h Initial commit 2013-09-01 16:27:21 +02:00
filesystem.cpp Add config entry "allowSymlinks" 2013-10-20 22:38:46 +02:00
filesystem.h Add config entry "allowSymlinks" 2013-10-20 22:38:46 +02:00
flashable.h Initial commit 2013-09-01 16:27:21 +02:00
font.cpp Fix up SDL2 include paths 2013-10-13 23:21:34 +02:00
font.h Initial commit 2013-09-01 16:27:21 +02:00
gl-util.h Tilemap: Optimize atlas assembly from mega surface tileset 2013-10-16 19:20:36 +02:00
global-ibo.h Use C99 integer types instead of Qt's 2013-09-04 13:30:14 +02:00
glstate.cpp Fix up glew include paths 2013-10-14 02:22:34 +02:00
glstate.h Remove the remaining bits of deprecated GL usage 2013-09-23 07:50:22 +02:00
graphics.cpp Graphics: Attempt to provide more consistent frame timings 2013-10-22 17:05:46 +02:00
graphics.h Ifdef out more RGSS2 functionality 2013-10-06 10:28:03 +02:00
input.cpp Fix up SDL2 include paths 2013-10-13 23:21:34 +02:00
input.h Initial commit 2013-09-01 16:27:21 +02:00
intrulist.h Initial commit 2013-09-01 16:27:21 +02:00
main.cpp Revert "Always request OpenGL Core profile" 2013-10-16 00:04:01 +02:00
perftimer.cpp Fix up glew include paths 2013-10-14 02:22:34 +02:00
perftimer.h Factor out performance timers into separate files 2013-09-27 16:54:01 +02:00
plane.cpp Plane, Sprite: Fix Bitmap flushes in draw handler 2013-10-17 15:28:55 +02:00
plane.h Initial commit 2013-09-01 16:27:21 +02:00
quad.h Fix up glew include paths 2013-10-14 02:22:34 +02:00
quadarray.h Rename 'GlobalState' to 'SharedState' to avoid confusion with GLState 2013-10-09 12:30:33 +02:00
scene.cpp Tilemap: Optimize scanrow z ordering 2013-10-13 12:58:56 +02:00
scene.h Attempt at better documentation for SceneElement subclasses 2013-10-17 15:27:48 +02:00
serial-util.h Serialization: Fix typos resulting in corrupted data 2013-10-17 01:01:25 +02:00
serializable.h Remove Serializable's virtual destructor. It didn't do anything anyway. 2013-09-27 04:39:35 +02:00
shader.cpp Fix up glew include paths 2013-10-14 02:22:34 +02:00
shader.h Start ifdef'ing out RGSS2 functionality 2013-10-02 22:40:09 +02:00
sharedstate.cpp Tilemap: Use simple "TexPool" replacement for atlas allocation 2013-10-22 06:36:13 +02:00
sharedstate.h Tilemap: Use simple "TexPool" replacement for atlas allocation 2013-10-22 06:36:13 +02:00
sprite.cpp Plane, Sprite: Fix Bitmap flushes in draw handler 2013-10-17 15:28:55 +02:00
sprite.h Initial commit 2013-09-01 16:27:21 +02:00
table.cpp Table: Minor cleanups 2013-10-15 19:39:29 +02:00
table.h Remove Serializable's virtual destructor. It didn't do anything anyway. 2013-09-27 04:39:35 +02:00
texpool.cpp Rename 'GlobalState' to 'SharedState' to avoid confusion with GLState 2013-10-09 12:30:33 +02:00
texpool.h Rename 'Tex' to 'TEX' for consistency 2013-09-06 12:26:41 +02:00
tileatlas.cpp Forgot to add license header 2013-10-09 13:44:15 +02:00
tileatlas.h Forgot to add license header 2013-10-09 13:44:15 +02:00
tilemap.cpp Tilemap: Use simple "TexPool" replacement for atlas allocation 2013-10-22 06:36:13 +02:00
tilemap.h Ifdef out more RGSS2 functionality 2013-10-06 10:28:03 +02:00
tilequad.cpp Cosmetic changes 2013-09-21 14:45:27 +02:00
tilequad.h Cosmetic changes 2013-09-21 14:45:27 +02:00
transform.h Add GPL license header 2013-09-01 18:26:36 +02:00
util.h Rename 'bound' to 'clamp' 2013-09-03 15:31:29 +02:00
viewport.cpp Fix up SDL2 include paths 2013-10-13 23:21:34 +02:00
viewport.h Ifdef out more RGSS2 functionality 2013-10-06 10:28:03 +02:00
window.cpp Rename 'GlobalState' to 'SharedState' to avoid confusion with GLState 2013-10-09 12:30:33 +02:00
window.h Initial commit 2013-09-01 16:27:21 +02:00