From 59466243ec6f85b26aa745ade2489ca5db94ea36 Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Thu, 4 Oct 2018 11:38:42 +0200 Subject: [PATCH] Simplified main --- src/game/main.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/game/main.rs b/src/game/main.rs index 2413f2d..e3720ac 100644 --- a/src/game/main.rs +++ b/src/game/main.rs @@ -28,7 +28,7 @@ fn main() { let mut renderer = Renderer::new(game_width, game_height); - let mut after_loop = None; + let mut after_loop = Instant::now(); let mut running = true; loop { @@ -53,13 +53,8 @@ fn main() { } // Manage the physics - let duration = if let Some(instant) = after_loop { - Instant::now().duration_since(instant) - } else { - Duration::from_millis(20) - }; - - after_loop = Some(Instant::now()); + let duration = Instant::now().duration_since(after_loop); + after_loop = Instant::now(); scene.update(&duration);