mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 10:09:43 +01:00
Move fixed loop to its own function
To improve code readability because otherwise the code would be one giant blob.
This commit is contained in:
parent
1fbec9c427
commit
a9f07ccc8f
1 changed files with 45 additions and 39 deletions
|
@ -65,6 +65,7 @@ volatile Uint32 f_accumulator = 0;
|
|||
|
||||
void gameloop();
|
||||
void deltaloop();
|
||||
void fixedloop();
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -387,6 +388,50 @@ void deltaloop()
|
|||
{
|
||||
accumulator = fmodf(accumulator, timesteplimit);
|
||||
|
||||
fixedloop();
|
||||
}
|
||||
const float alpha = game.over30mode ? static_cast<float>(accumulator) / timesteplimit : 1.0f;
|
||||
graphics.alpha = alpha;
|
||||
|
||||
if (game.infocus)
|
||||
{
|
||||
switch (game.gamestate)
|
||||
{
|
||||
case PRELOADER:
|
||||
preloaderrender();
|
||||
break;
|
||||
case EDITORMODE:
|
||||
graphics.flipmode = false;
|
||||
editorrender();
|
||||
break;
|
||||
case TITLEMODE:
|
||||
titlerender();
|
||||
break;
|
||||
case GAMEMODE:
|
||||
gamerender();
|
||||
break;
|
||||
case MAPMODE:
|
||||
maprender();
|
||||
break;
|
||||
case TELEPORTERMODE:
|
||||
teleporterrender();
|
||||
break;
|
||||
case GAMECOMPLETE:
|
||||
gamecompleterender();
|
||||
break;
|
||||
case GAMECOMPLETE2:
|
||||
gamecompleterender2();
|
||||
break;
|
||||
case CLICKTOSTART:
|
||||
help.updateglow();
|
||||
break;
|
||||
}
|
||||
gameScreen.FlipScreen();
|
||||
}
|
||||
}
|
||||
|
||||
void fixedloop()
|
||||
{
|
||||
key.Poll();
|
||||
if(key.toggleFullscreen)
|
||||
{
|
||||
|
@ -607,43 +652,4 @@ void deltaloop()
|
|||
music.processmusic();
|
||||
graphics.processfade();
|
||||
game.gameclock();
|
||||
}
|
||||
const float alpha = game.over30mode ? static_cast<float>(accumulator) / timesteplimit : 1.0f;
|
||||
graphics.alpha = alpha;
|
||||
|
||||
if (game.infocus)
|
||||
{
|
||||
switch (game.gamestate)
|
||||
{
|
||||
case PRELOADER:
|
||||
preloaderrender();
|
||||
break;
|
||||
case EDITORMODE:
|
||||
graphics.flipmode = false;
|
||||
editorrender();
|
||||
break;
|
||||
case TITLEMODE:
|
||||
titlerender();
|
||||
break;
|
||||
case GAMEMODE:
|
||||
gamerender();
|
||||
break;
|
||||
case MAPMODE:
|
||||
maprender();
|
||||
break;
|
||||
case TELEPORTERMODE:
|
||||
teleporterrender();
|
||||
break;
|
||||
case GAMECOMPLETE:
|
||||
gamecompleterender();
|
||||
break;
|
||||
case GAMECOMPLETE2:
|
||||
gamecompleterender2();
|
||||
break;
|
||||
case CLICKTOSTART:
|
||||
help.updateglow();
|
||||
break;
|
||||
}
|
||||
gameScreen.FlipScreen();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue