|
R-Type
Distributed multiplayer game engine in C++
|
Simple quit confirmation dialog. More...
#include <ConfirmQuitMenu.hpp>


Public Member Functions | |
| ConfirmQuitMenu (UI::IUIFactory &uiFactory) | |
| Construct a new ConfirmQuitMenu. | |
| ~ConfirmQuitMenu () override=default | |
| void | Initialize () override |
| Initialize UI elements (creates buttons). | |
| void | SetOnConfirm (std::function< void()> callback) |
| Set callback invoked when user confirms quit. | |
| void | SetOnCancel (std::function< void()> callback) |
| Set callback invoked when user cancels. | |
Public Member Functions inherited from Game::BaseMenu | |
| BaseMenu (UI::IUIFactory &uiFactory) | |
| Constructor with UI factory reference. | |
| virtual | ~BaseMenu ()=default |
| Virtual destructor. | |
| virtual void | Update () |
| Update menu state (should be called every frame). | |
| virtual void | Render () |
| Render menu (should be called every frame). | |
| virtual void | Show () |
| Show the menu. | |
| virtual void | Hide () |
| Hide the menu. | |
| virtual bool | IsVisible () const |
| Check if menu is currently visible. | |
| void | SetSoundEffectService (Audio::ISoundEffectService *soundService) |
| Set the sound effect service for playing UI sounds. | |
Private Member Functions | |
| void | OnConfirmClicked () |
| void | OnCancelClicked () |
Private Attributes | |
| std::function< void()> | _onConfirm {} |
| std::function< void()> | _onCancel {} |
Additional Inherited Members | |
Protected Member Functions inherited from Game::BaseMenu | |
| std::function< void()> | WrapWithClickSound (std::function< void()> callback) |
| Wrap a callback to play click sound before executing. | |
| std::shared_ptr< UI::IButton > | CreateCenteredButton (const char *label, float offsetY, float width, float height, unsigned int backgroundColor, unsigned int hoverColor, std::function< void()> callback) |
| Create a button with standard styling and positioning. | |
Protected Attributes inherited from Game::BaseMenu | |
| UI::IUIFactory & | _uiFactory |
| std::shared_ptr< UI::IMenu > | _menu |
| Audio::ISoundEffectService * | _soundService {nullptr} |
Simple quit confirmation dialog.
Business-level class: it uses the UI library, but does not depend on Graphics. It is meant to be displayed either fullscreen (main menu context) or as an overlay (in-game context) depending on how the caller renders it.
Definition at line 24 of file ConfirmQuitMenu.hpp.
|
explicit |
Construct a new ConfirmQuitMenu.
| uiFactory | UI factory used to create menus and buttons. |
Definition at line 12 of file ConfirmQuitMenu.cpp.
|
overridedefault |
|
overridevirtual |
Initialize UI elements (creates buttons).
Implements Game::BaseMenu.
Definition at line 14 of file ConfirmQuitMenu.cpp.
References Game::BaseMenu::_menu, Game::BaseMenu::CreateCenteredButton(), OnCancelClicked(), and OnConfirmClicked().

|
private |
Definition at line 51 of file ConfirmQuitMenu.cpp.
References _onCancel, Game::BaseMenu::Hide(), and LOG_INFO.
Referenced by Initialize().

|
private |
Definition at line 44 of file ConfirmQuitMenu.cpp.
References _onConfirm, and LOG_INFO.
Referenced by Initialize().
| void Game::ConfirmQuitMenu::SetOnCancel | ( | std::function< void()> | callback | ) |
Set callback invoked when user cancels.
Definition at line 40 of file ConfirmQuitMenu.cpp.
References _onCancel.
| void Game::ConfirmQuitMenu::SetOnConfirm | ( | std::function< void()> | callback | ) |
Set callback invoked when user confirms quit.
Definition at line 36 of file ConfirmQuitMenu.cpp.
References _onConfirm.
|
private |
Definition at line 53 of file ConfirmQuitMenu.hpp.
Referenced by OnCancelClicked(), and SetOnCancel().
|
private |
Definition at line 52 of file ConfirmQuitMenu.hpp.
Referenced by OnConfirmClicked(), and SetOnConfirm().