|
R-Type
Distributed multiplayer game engine in C++
|
Defeat screen displayed when the player dies. More...
#include <DefeatMenu.hpp>


Public Member Functions | |
| DefeatMenu (UI::IUIFactory &uiFactory) | |
| Construct a new DefeatMenu. | |
| ~DefeatMenu () override=default | |
| void | Initialize () override |
| Initialize UI elements (creates buttons and text). | |
| void | SetOnReturnToMenu (std::function< void()> callback) |
| Set callback invoked when user clicks return to menu button. | |
| void | SetDefeatReason (const std::string &reason) |
| Set the defeat reason/message to display. | |
| void | Render () override |
| Custom render to display defeat message. | |
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 | 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 | OnReturnToMenuClicked () |
Private Attributes | |
| std::function< void()> | _onReturnToMenu {} |
| std::string | _defeatReason {"DEFEAT"} |
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} |
Defeat screen displayed when the player dies.
Shows defeat message and allows player to return to main menu.
Definition at line 23 of file DefeatMenu.hpp.
|
explicit |
Construct a new DefeatMenu.
| uiFactory | UI factory used to create menus and buttons. |
Definition at line 12 of file DefeatMenu.cpp.
|
overridedefault |
|
overridevirtual |
Initialize UI elements (creates buttons and text).
Implements Game::BaseMenu.
Definition at line 14 of file DefeatMenu.cpp.
References Game::BaseMenu::_menu, Game::BaseMenu::CreateCenteredButton(), OnReturnToMenuClicked(), and Game::BaseMenu::WrapWithClickSound().

|
private |
Definition at line 52 of file DefeatMenu.cpp.
References _onReturnToMenu, and LOG_INFO.
Referenced by Initialize().
|
overridevirtual |
Custom render to display defeat message.
Reimplemented from Game::BaseMenu.
Definition at line 38 of file DefeatMenu.cpp.
References Game::BaseMenu::IsVisible(), and Game::BaseMenu::Render().

| void Game::DefeatMenu::SetDefeatReason | ( | const std::string & | reason | ) |
Set the defeat reason/message to display.
| reason | Reason for defeat (e.g., "Player Defeated", "Game Over") |
Definition at line 34 of file DefeatMenu.cpp.
References _defeatReason.
| void Game::DefeatMenu::SetOnReturnToMenu | ( | std::function< void()> | callback | ) |
Set callback invoked when user clicks return to menu button.
Definition at line 30 of file DefeatMenu.cpp.
References _onReturnToMenu.
|
private |
Definition at line 57 of file DefeatMenu.hpp.
Referenced by SetDefeatReason().
|
private |
Definition at line 56 of file DefeatMenu.hpp.
Referenced by OnReturnToMenuClicked(), and SetOnReturnToMenu().