🐛 bug: sleep less, to hit 60 FPS
parent
d570ee4cc8
commit
2c41ea1e6b
|
@ -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 (())
|
||||||
|
|
Loading…
Reference in New Issue