fp: Update physics at a fixed rate
This commit is contained in:
parent
9106230079
commit
a8f5aa41a5
@ -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 ====================================================================================
|
||||
|
@ -136,6 +136,7 @@ struct FP_GameCamera
|
||||
|
||||
struct FP_Game
|
||||
{
|
||||
Dqn_f32 delta_s_accumulator;
|
||||
uint16_t tile_size;
|
||||
TELY_ChunkPool *chunk_pool;
|
||||
TELY_AssetFontHandle inter_regular_font;
|
||||
|
Loading…
Reference in New Issue
Block a user