set a more sensible max delta time

main
cosmonaut 2021-01-22 23:43:48 -08:00
parent a3307c0066
commit 2978528f3b
1 changed files with 4 additions and 2 deletions

View File

@ -8,6 +8,8 @@ namespace MoonWorks
{ {
public abstract class Game public abstract class Game
{ {
public const double MAX_DELTA_TIME = 0.1;
private bool quit = false; private bool quit = false;
private double timestep; private double timestep;
ulong currentTime = SDL.SDL_GetPerformanceCounter(); ulong currentTime = SDL.SDL_GetPerformanceCounter();
@ -65,9 +67,9 @@ namespace MoonWorks
var newTime = SDL.SDL_GetPerformanceCounter(); var newTime = SDL.SDL_GetPerformanceCounter();
double frameTime = (newTime - currentTime) / (double)SDL.SDL_GetPerformanceFrequency(); double frameTime = (newTime - currentTime) / (double)SDL.SDL_GetPerformanceFrequency();
if (frameTime > 0.25) if (frameTime > MAX_DELTA_TIME)
{ {
frameTime = 0.25; frameTime = MAX_DELTA_TIME;
} }
currentTime = newTime; currentTime = newTime;