set a more sensible max delta time
parent
a3307c0066
commit
2978528f3b
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue