diff --git a/README.md b/README.md index ad09f07..b1a1ca7 100644 --- a/README.md +++ b/README.md @@ -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. +![sc9.png](docs/sc9.png) + +Only during an active puzzle (timer running), the game runs at ~30 FPS, which results in some CPU usage. +![sc8.png](docs/sc8.png) + + ## Build/Run from source You may be inclined to not run binaries from the internet, and want to build from source instead. diff --git a/src/binary_numbers.rs b/src/binary_numbers.rs index 8c3ea01..f6e589b 100644 --- a/src/binary_numbers.rs +++ b/src/binary_numbers.rs @@ -542,6 +542,7 @@ pub struct BinaryNumbersPuzzle { guess_result: Option, last_points_awarded: u32, stats_snapshot: Option, + 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 {