fix: target delta time is now enforced
This commit is contained in:
parent
dd01f9488f
commit
17f78ef57d
|
|
@ -154,7 +154,9 @@ Clay_RenderCommandArray RenderApplication() {
|
||||||
static uint64_t lastStep = 0;
|
static uint64_t lastStep = 0;
|
||||||
if (isSimulating) {
|
if (isSimulating) {
|
||||||
double deltaTime{ (double)(SDL_GetTicks() - lastStep) * 0.001 };
|
double deltaTime{ (double)(SDL_GetTicks() - lastStep) * 0.001 };
|
||||||
if (deltaTime > 0.16) {
|
constexpr double targetDeltaTime = 1.0/24.0;
|
||||||
|
if (deltaTime > targetDeltaTime) {
|
||||||
|
lastStep = SDL_GetTicks();
|
||||||
simulation::Step();
|
simulation::Step();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue