Add exit-confirm modal (fullscreen dim, centered P2 text) and keyboard shortcuts
Add an in-game exit confirmation modal for Playing state: ESC opens modal and pauses the game; YES resets and returns to Menu; NO hides modal and resumes. Draw a full-window translucent dim background (reset viewport) so overlay covers any window size / fullscreen. Use PressStart2P (pixel P2) font for all modal text and center title/body/button labels using measured text widths. Add FontAtlas::measure(...) to accurately measure text sizes (used for proper centering). Ensure popup rendering and mouse hit-testing use the same logical/content-local coordinate math so visuals and clicks align. Add keyboard shortcuts for modal (Enter = confirm, Esc = cancel) and suppress other gameplay input while modal is active. Add helper scripts for debug build+run: build-debug-and-run.ps1 and build-debug-and-run.bat. Minor fixes to related rendering & state wiring; verified Debug build completes and modal behavior in runtime.
This commit is contained in:
@ -12,6 +12,10 @@ class Starfield3D;
|
||||
class FontAtlas;
|
||||
class LineEffect;
|
||||
|
||||
// Forward declare StateManager so StateContext can hold a pointer without
|
||||
// including the StateManager header here.
|
||||
class StateManager;
|
||||
|
||||
// Shared context passed to states so they can access common resources
|
||||
struct StateContext {
|
||||
// Core subsystems (may be null if not available)
|
||||
@ -41,6 +45,9 @@ struct StateContext {
|
||||
// Menu popups (exposed from main)
|
||||
bool* showLevelPopup = nullptr;
|
||||
bool* showSettingsPopup = nullptr;
|
||||
bool* showExitConfirmPopup = nullptr; // If true, show "Exit game?" confirmation while playing
|
||||
// Pointer to the application's StateManager so states can request transitions
|
||||
StateManager* stateManager = nullptr;
|
||||
};
|
||||
|
||||
class State {
|
||||
|
||||
Reference in New Issue
Block a user