feat(engine): hide score and timer in Zen mode per spec
Zen mode is intended for relaxed play with no performance pressure.
The HUD now clears score and elapsed-time displays when GameMode::Zen
is active, matching the ARCHITECTURE.md spec ("No timer. No score
display."). The mode badge still shows "ZEN" so the player knows
which mode they're in.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -83,8 +83,14 @@ fn update_hud(
|
|||||||
// Score, moves, and mode only need updating when the game state changes.
|
// Score, moves, and mode only need updating when the game state changes.
|
||||||
if game.is_changed() {
|
if game.is_changed() {
|
||||||
let g = &game.0;
|
let g = &game.0;
|
||||||
|
let is_zen = g.mode == GameMode::Zen;
|
||||||
if let Ok(mut t) = score_q.get_single_mut() {
|
if let Ok(mut t) = score_q.get_single_mut() {
|
||||||
**t = format!("Score: {}", g.score);
|
// Zen mode suppresses score display per spec ("No score display").
|
||||||
|
**t = if is_zen {
|
||||||
|
String::new()
|
||||||
|
} else {
|
||||||
|
format!("Score: {}", g.score)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
if let Ok(mut t) = moves_q.get_single_mut() {
|
if let Ok(mut t) = moves_q.get_single_mut() {
|
||||||
**t = format!("Moves: {}", g.move_count);
|
**t = format!("Moves: {}", g.move_count);
|
||||||
@@ -103,8 +109,10 @@ fn update_hud(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Time display: show Time Attack countdown every frame when active;
|
// Time display: show Time Attack countdown every frame when active;
|
||||||
// otherwise show game elapsed time (updates once per second via game.is_changed()).
|
// Zen mode suppresses the timer per spec ("No timer").
|
||||||
let update_time = ta_active || game.is_changed();
|
// Otherwise show game elapsed time (updates once per second via game.is_changed()).
|
||||||
|
let is_zen = game.0.mode == GameMode::Zen;
|
||||||
|
let update_time = (ta_active || game.is_changed()) && !is_zen;
|
||||||
if update_time {
|
if update_time {
|
||||||
if let Ok(mut t) = time_q.get_single_mut() {
|
if let Ok(mut t) = time_q.get_single_mut() {
|
||||||
if let Some(ta) = time_attack.as_ref().filter(|ta| ta.active) {
|
if let Some(ta) = time_attack.as_ref().filter(|ta| ta.active) {
|
||||||
@@ -119,6 +127,11 @@ fn update_hud(
|
|||||||
**t = format!("{m}:{s:02}");
|
**t = format!("{m}:{s:02}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if is_zen && game.is_changed() {
|
||||||
|
// Clear the time display when entering Zen mode.
|
||||||
|
if let Ok(mut t) = time_q.get_single_mut() {
|
||||||
|
**t = String::new();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user