actually use the fixed timestep
parent
8872a45d50
commit
77ed8db317
|
@ -75,7 +75,10 @@ async fn main () -> Result <()> {
|
||||||
let mut depth_buffer = vec! [0u32; 320 * 2 * 240 * 2];
|
let mut depth_buffer = vec! [0u32; 320 * 2 * 240 * 2];
|
||||||
|
|
||||||
'running: loop {
|
'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 ();
|
let mut player_gamepad = virtual_gamepad::VirtualGamepad::default ();
|
||||||
|
|
||||||
for event in event_pump.poll_iter () {
|
for event in event_pump.poll_iter () {
|
||||||
|
@ -139,10 +142,12 @@ async fn main () -> Result <()> {
|
||||||
|
|
||||||
let p_gp = player_gamepad;
|
let p_gp = player_gamepad;
|
||||||
|
|
||||||
|
for _ in 0..frames_to_do {
|
||||||
let logic_step_output = game_state.logic.step (&level.phys_tris, &phys_params, p_gp);
|
let logic_step_output = game_state.logic.step (&level.phys_tris, &phys_params, p_gp);
|
||||||
if logic_step_output.reset_level {
|
if logic_step_output.reset_level {
|
||||||
game_state.logic.reset_level (&level);
|
game_state.logic.reset_level (&level);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// dbg! (game_state.logic.player.pos);
|
// dbg! (game_state.logic.player.pos);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue