1786005842
This commit is contained in:
@@ -40,6 +40,11 @@ impl Trekstor {
|
|||||||
self.input.handle_event();
|
self.input.handle_event();
|
||||||
self.current_time = Instant::now();
|
self.current_time = Instant::now();
|
||||||
let dt = self.current_time - self.last_time;
|
let dt = self.current_time - self.last_time;
|
||||||
|
self.last_time = self.current_time;
|
||||||
|
|
||||||
|
if dt < self.update_timestep {
|
||||||
|
sleep(self.update_timestep - dt);
|
||||||
|
}
|
||||||
|
|
||||||
println!("FPS: {}", 1.0 / dt.as_secs_f64());
|
println!("FPS: {}", 1.0 / dt.as_secs_f64());
|
||||||
|
|
||||||
@@ -49,11 +54,6 @@ impl Trekstor {
|
|||||||
|
|
||||||
self.screen.flush();
|
self.screen.flush();
|
||||||
self.input.finish();
|
self.input.finish();
|
||||||
|
|
||||||
if dt <= self.update_timestep {
|
|
||||||
sleep(self.update_timestep - dt);
|
|
||||||
}
|
|
||||||
self.last_time = self.current_time;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user