actually use the fixed timestep

main
_ 2022-01-09 17:35:19 +00:00
parent 8872a45d50
commit 77ed8db317
1 changed files with 9 additions and 4 deletions

View File

@ -75,7 +75,10 @@ async fn main () -> Result <()> {
let mut depth_buffer = vec! [0u32; 320 * 2 * 240 * 2];
'running: loop {
let _frames_to_do = time_step.step ();
let frames_to_do = time_step.step ();
if frames_to_do != 1 {
// debug! ("frames_to_do = {}", frames_to_do);
}
let mut player_gamepad = virtual_gamepad::VirtualGamepad::default ();
for event in event_pump.poll_iter () {
@ -139,9 +142,11 @@ async fn main () -> Result <()> {
let p_gp = player_gamepad;
let logic_step_output = game_state.logic.step (&level.phys_tris, &phys_params, p_gp);
if logic_step_output.reset_level {
game_state.logic.reset_level (&level);
for _ in 0..frames_to_do {
let logic_step_output = game_state.logic.step (&level.phys_tris, &phys_params, p_gp);
if logic_step_output.reset_level {
game_state.logic.reset_level (&level);
}
}
// dbg! (game_state.logic.player.pos);