🐛 bug: sleep less, to hit 60 FPS

main
_ 2022-01-09 13:49:57 +00:00
parent d570ee4cc8
commit 2c41ea1e6b
1 changed files with 6 additions and 6 deletions

View File

@ -336,19 +336,19 @@ async fn main () -> Result <()> {
graphics.draw (&game_state, &mut gl_state, &level, &camera); graphics.draw (&game_state, &mut gl_state, &level, &camera);
graphics.frames += 1; graphics.frames += 1;
if graphics.frames == next_mpf_print { if graphics.frames == next_upf_print {
let now = Instant::now (); let now = Instant::now ();
let mpf = (now - last_mpf_instant).as_millis () / 60; let upf = (now - last_upf_instant).as_micros () / 60;
dbg! (mpf); dbg! (upf);
next_mpf_print += 60; next_upf_print += 60;
last_mpf_instant = now; last_upf_instant = now;
} }
window.gl_swap_window (); window.gl_swap_window ();
tokio::time::sleep (Duration::from_millis (15)).await; tokio::time::sleep (Duration::from_millis (10)).await;
} }
Ok (()) Ok (())