From 7ec1e68a0079f4cbfe58b3e4cb2f3e6fc74f8a3c Mon Sep 17 00:00:00 2001 From: Dennis Ranke Date: Thu, 14 Jul 2022 00:05:15 +0200 Subject: [PATCH] very slightly improve frame timings when not quite reaching 60 fps --- src/run_native.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/run_native.rs b/src/run_native.rs index 058c5a3..190c3b7 100644 --- a/src/run_native.rs +++ b/src/run_native.rs @@ -223,7 +223,9 @@ impl State { let time = (now - instance.start_time).as_millis() as i32; { let offset = ((time as u32 as i64 * 6) % 100 - 50) / 6; - result = Ok(now + Duration::from_millis((16 - offset) as u64)); + let max = now + Duration::from_millis(17); + let next_center = now + Duration::from_millis((16 - offset) as u64); + result = Ok(next_center.min(max)); } {