1786005497
This commit is contained in:
@@ -36,11 +36,15 @@ impl Trekstor {
|
||||
}
|
||||
|
||||
pub fn update(&mut self, update: UpdateFn) {
|
||||
let mut last_frame_time = Instant::now();
|
||||
loop {
|
||||
self.input.handle_event();
|
||||
self.current_time = Instant::now();
|
||||
|
||||
println!("Frame");
|
||||
println!(
|
||||
"FPS: {}",
|
||||
(self.current_time - last_frame_time).as_secs_f64()
|
||||
);
|
||||
|
||||
if !update(&mut self.screen, &self.input) {
|
||||
return;
|
||||
@@ -54,6 +58,7 @@ impl Trekstor {
|
||||
if dt < self.update_timestep {
|
||||
sleep(self.update_timestep - dt);
|
||||
}
|
||||
last_frame_time = Instant::now();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user