fp: Update physics at a fixed rate

This commit is contained in:
2023-09-23 17:26:18 +10:00
parent 9106230079
commit a8f5aa41a5
2 changed files with 8 additions and 1 deletions
+7 -1
View File
@@ -1121,7 +1121,13 @@ void TELY_DLL_FrameUpdate(void *user_data)
}
}
FP_Update(platform, game, renderer, input);
Dqn_f32 const PHYSICS_STEP = 1 / 60.f;
for (game->delta_s_accumulator += input->delta_s;
game->delta_s_accumulator > PHYSICS_STEP;
game->delta_s_accumulator -= PHYSICS_STEP) {
FP_Update(platform, game, renderer, input);
}
FP_Render(game, platform, renderer);
// NOTE: UI ====================================================================================