mirror of
https://github.com/lucaspalomodevelop/binbreak.git
synced 2026-03-13 00:07:28 +00:00
feat: add skip_first_dt flag to prevent timer jump on new puzzle start
This commit is contained in:
parent
f6d1b8b6f6
commit
7be94e225a
@ -42,6 +42,14 @@ The game should run fine in any terminal. If you want retro CRT effects, here ar
|
||||
- Windows: Windows Terminal (enable experimental "retro mode")
|
||||
- Linux: Rio (with CRT shader), Cool Retro Term
|
||||
|
||||
## Resource Conscious
|
||||
In most game-states, the game will sleep until your next input, resulting in 0% CPU usage while idle.
|
||||

|
||||
|
||||
Only during an active puzzle (timer running), the game runs at ~30 FPS, which results in some CPU usage.
|
||||

|
||||
|
||||
|
||||
## Build/Run from source
|
||||
You may be inclined to not run binaries from the internet, and want to build from source instead.
|
||||
|
||||
|
||||
@ -542,6 +542,7 @@ pub struct BinaryNumbersPuzzle {
|
||||
guess_result: Option<GuessResult>,
|
||||
last_points_awarded: u32,
|
||||
stats_snapshot: Option<StatsSnapshot>,
|
||||
skip_first_dt: bool, // Skip first dt to prevent timer jump when starting new puzzle
|
||||
}
|
||||
|
||||
impl BinaryNumbersPuzzle {
|
||||
@ -585,6 +586,7 @@ impl BinaryNumbersPuzzle {
|
||||
guess_result,
|
||||
last_points_awarded,
|
||||
stats_snapshot: None,
|
||||
skip_first_dt: true, // Skip first dt to prevent timer jump
|
||||
}
|
||||
}
|
||||
|
||||
@ -608,6 +610,12 @@ impl BinaryNumbersPuzzle {
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip first dt to prevent timer jump when starting new puzzle
|
||||
if self.skip_first_dt {
|
||||
self.skip_first_dt = false;
|
||||
return;
|
||||
}
|
||||
|
||||
self.time_left = (self.time_left - dt).max(0.0);
|
||||
|
||||
if self.time_left <= 0.0 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user