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 const double MAX_DELTA_TIME = 0.1;
private bool quit = false;
private double timestep;
ulong currentTime = SDL.SDL_GetPerformanceCounter();
@ -65,9 +67,9 @@ namespace MoonWorks
var newTime = SDL.SDL_GetPerformanceCounter();
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;