Simplified main

This commit is contained in:
Thomas Forgione 2018-10-04 11:38:42 +02:00
parent 29df5f872d
commit 59466243ec
No known key found for this signature in database
GPG Key ID: 203DAEA747F48F41
1 changed files with 3 additions and 8 deletions

View File

@ -28,7 +28,7 @@ fn main() {
let mut renderer = Renderer::new(game_width, game_height); let mut renderer = Renderer::new(game_width, game_height);
let mut after_loop = None; let mut after_loop = Instant::now();
let mut running = true; let mut running = true;
loop { loop {
@ -53,13 +53,8 @@ fn main() {
} }
// Manage the physics // Manage the physics
let duration = if let Some(instant) = after_loop { let duration = Instant::now().duration_since(after_loop);
Instant::now().duration_since(instant) after_loop = Instant::now();
} else {
Duration::from_millis(20)
};
after_loop = Some(Instant::now());
scene.update(&duration); scene.update(&duration);