feat(engine): add Undo, Pause, Help UI buttons in HUD action bar
Continues the UI-first pass started by the New Game button. Per the design principle in CLAUDE.md / ARCHITECTURE.md §1, every player action must be reachable from a visible UI control with the keyboard shortcut as an optional accelerator. Refactor the single New Game button into a flex-row "action bar" anchored top-right with four buttons: Undo, Pause, Help, New Game (left → right; New Game rightmost as the most consequential action). Plumbing: - New `PauseRequestEvent` and `HelpRequestEvent` in events.rs. - pause_plugin::toggle_pause reads either Esc or PauseRequestEvent so the button and the keyboard accelerator drive the same code path (with the existing drag / game-over / selection guards). - help_plugin::toggle_help_screen reads either F1 or HelpRequestEvent; also fix the stale module-doc claim that H toggles help (it's F1 — H is bound to hint cycle in input_plugin). - hud_plugin now spawns four ActionButton-marked buttons via a ChildSpawnerCommands helper, with one click handler per button firing its respective request event. A single paint_action_buttons system covers hover/pressed colour for all of them via the shared ActionButton marker. The click handlers defensively re-register their request events so the plugin works in isolation under MinimalPlugins (tests). add_message is idempotent. - ARCHITECTURE.md HudPlugin row updated to call out the action bar. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -67,14 +67,17 @@ pub use font_plugin::{FontPlugin, FontResource};
|
||||
pub use cursor_plugin::CursorPlugin;
|
||||
pub use events::{
|
||||
AchievementUnlockedEvent, CardFaceRevealedEvent, CardFlippedEvent, DrawRequestEvent,
|
||||
ForfeitEvent, GameWonEvent, HintVisualEvent, InfoToastEvent, ManualSyncRequestEvent,
|
||||
MoveRejectedEvent, MoveRequestEvent, NewGameConfirmEvent, NewGameRequestEvent,
|
||||
StateChangedEvent, SyncCompleteEvent, UndoRequestEvent, XpAwardedEvent,
|
||||
ForfeitEvent, GameWonEvent, HelpRequestEvent, HintVisualEvent, InfoToastEvent,
|
||||
ManualSyncRequestEvent, MoveRejectedEvent, MoveRequestEvent, NewGameConfirmEvent,
|
||||
NewGameRequestEvent, PauseRequestEvent, StateChangedEvent, SyncCompleteEvent,
|
||||
UndoRequestEvent, XpAwardedEvent,
|
||||
};
|
||||
pub use game_plugin::{ConfirmNewGameScreen, GameMutation, GameOverScreen, GamePlugin, GameStatePath};
|
||||
pub use help_plugin::{HelpPlugin, HelpScreen};
|
||||
pub use home_plugin::{HomePlugin, HomeScreen};
|
||||
pub use hud_plugin::{HudAutoComplete, HudPlugin};
|
||||
pub use hud_plugin::{
|
||||
ActionButton, HelpButton, HudAutoComplete, HudPlugin, NewGameButton, PauseButton, UndoButton,
|
||||
};
|
||||
pub use leaderboard_plugin::{LeaderboardPlugin, LeaderboardResource, LeaderboardScreen};
|
||||
pub use input_plugin::InputPlugin;
|
||||
pub use onboarding_plugin::{OnboardingPlugin, OnboardingScreen};
|
||||
|
||||
Reference in New Issue
Block a user