Simplified main
This commit is contained in:
parent
29df5f872d
commit
59466243ec
|
@ -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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue