mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 17:38:16 +03:00
Add being able to toggle over/fixed-30-FPS, off by default
There is now an option in "graphic options" named "toggle fps", which toggles whether the game visually runs at 1000/34 FPS or over 1000/34 FPS. It is off by default. I've had to put the entire game loop in yet another set of braces, I'll indent it next commit.
This commit is contained in:
@@ -306,12 +306,34 @@ int main(int argc, char *argv[])
|
||||
volatile Uint32 time = 0;
|
||||
volatile Uint32 timePrev = 0;
|
||||
volatile Uint32 accumulator = 0;
|
||||
volatile Uint32 f_time = 0;
|
||||
volatile Uint32 f_timePrev = 0;
|
||||
volatile Uint32 f_accumulator = 0;
|
||||
game.infocus = true;
|
||||
key.isActive = true;
|
||||
game.gametimer = 0;
|
||||
|
||||
while(!key.quitProgram)
|
||||
{
|
||||
f_timePrev = f_time;
|
||||
f_time = SDL_GetTicks();
|
||||
const float f_rawdeltatime = static_cast<float>(f_time - f_timePrev);
|
||||
if (!game.over30mode)
|
||||
{
|
||||
f_accumulator += f_rawdeltatime;
|
||||
}
|
||||
|
||||
while ((game.over30mode || f_accumulator >= 34) && !key.quitProgram)
|
||||
{
|
||||
if (game.over30mode)
|
||||
{
|
||||
f_accumulator = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
f_accumulator = fmodf(f_accumulator, 34);
|
||||
}
|
||||
|
||||
timePrev = time;
|
||||
time = SDL_GetTicks();
|
||||
|
||||
@@ -601,6 +623,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
gameScreen.FlipScreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
game.savestats();
|
||||
|
||||
Reference in New Issue
Block a user