Files
VVVVVV/desktop_version/src
Misa e2fe2d4c2b Replace SDL_Delay() with an accumulator
Alright, this is the start of the over-30-FPS patch!

First things first, we'll need to make it possible to have a separate
deltatime loop outside of the fixed timestep loop. And for that, we
can't be using SDL_Delay(), as SDL_Delay() (as you might imagine) blocks
the whole program.

Instead we'll be using this thing called an accumulator. It looks at how
long the previous poll took (the raw deltatime), and lets timesteps pass
accordingly.

On a side note, I've had to split the `time` and `timePrev` declaration
each onto their own separate line, otherwise there's undefined behavior
from `time` not being initialized.

I use `accumulator = fmodf(...)` instead of `accumulator -=
timesteplimit` because otherwise it'll fast-forward if it's behind,
which is a jarring thing to see.

Also in preparation for what's going to come down the over-30-FPS road,
I've also added `deltatime` and `alpha`. `deltatime` is going to be used
if the game is in slowdown mode, and `alpha` is going to be used for
linear interpolation of animations.

By the way, what was the main game loop previously (and is now the new
timestep loop) is now in an extra set of curly braces, but I haven't
indented it yet to reduce the noise in this commit.
2020-06-19 09:05:48 -04:00
..
2020-06-14 22:44:34 -04:00
2020-06-15 07:37:05 -04:00
2020-06-17 19:15:07 -04:00
2020-06-13 15:41:44 -04:00
2020-01-08 10:37:50 -05:00
2020-06-12 15:08:29 -04:00
2020-06-07 22:40:03 -04:00
2020-06-07 22:40:03 -04:00
2020-01-08 10:37:50 -05:00
2020-04-03 10:40:50 -04:00
2020-05-29 10:21:25 -04:00
2020-04-26 19:07:40 -04:00
2020-01-08 10:37:50 -05:00
2020-06-07 22:40:03 -04:00
2020-04-26 19:07:40 -04:00
2020-04-23 23:35:33 -04:00
2020-05-29 10:21:25 -04:00