summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--render/examples/bunnymark.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/render/examples/bunnymark.rs b/render/examples/bunnymark.rs
index 1579cf0..1e171c1 100644
--- a/render/examples/bunnymark.rs
+++ b/render/examples/bunnymark.rs
@@ -24,6 +24,7 @@ struct State {
texture_id: TextureId,
bunnies: Vec<Bunny>,
previous_timestamp: Option<Instant>,
+ bad_frames: u8,
seed: [u64; 2],
stopped: bool,
}
@@ -35,6 +36,7 @@ impl State {
bunnies: Vec::with_capacity(10_000_000),
previous_timestamp: None,
seed: [0x0D15EA5E8BADF00D, 0xDECAFBADDEADBEAF],
+ bad_frames: 0,
stopped: false,
}
}
@@ -56,7 +58,12 @@ impl State {
));
if fps < 15.0 {
- self.stopped = true;
+ self.bad_frames += 1;
+ if self.bad_frames == 3 {
+ self.stopped = true;
+ }
+ } else {
+ self.bad_frames = 0;
}
self.previous_timestamp = Some(Instant::now());