summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index a01dbbd..7a54638 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -325,9 +325,10 @@ impl ApplicationHandler for App {
// don't ever update more than 3 times per frame, or else we can get a pseudo deadlock
while self.sim_updates_due >= 1.0 && updates_done < 3 {
self.sim_update();
+ self.sim_updates_due -= 1.0;
updates_done += 1;
}
- self.sim_updates_due -= updates_done as f32;
+ self.sim_updates_due = self.sim_updates_due.min(3.0);
}
// PHYSICS UPDATE
@@ -342,9 +343,10 @@ impl ApplicationHandler for App {
// don't ever update more than 3 times per frame, or else we can get a pseudo deadlock
while self.physics_updates_due >= 1.0 && updates_done < 3 {
self.physics_update(PHYSICS_DELTA_TIME);
+ self.physics_updates_due -= 1.0;
updates_done += 1;
}
- self.physics_updates_due -= updates_done as f32;
+ self.physics_updates_due = self.physics_updates_due.min(3.0);
}
if let Some(renderer_state) = &mut self.renderer_state