|
R-Type
Distributed multiplayer game engine in C++
|
Base class for all menu implementations. More...
#include <BaseMenu.hpp>


Public Member Functions | |
| 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. | |
| virtual void | Initialize ()=0 |
| Initialize menu (must be implemented by derived classes). | |
| void | SetSoundEffectService (Audio::ISoundEffectService *soundService) |
| Set the sound effect service for playing UI sounds. | |
Protected Member Functions | |
| 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 | |
| UI::IUIFactory & | _uiFactory |
| std::shared_ptr< UI::IMenu > | _menu |
| Audio::ISoundEffectService * | _soundService {nullptr} |
Base class for all menu implementations.
Provides common functionality for menu management including:
Definition at line 26 of file BaseMenu.hpp.
|
explicit |
Constructor with UI factory reference.
| uiFactory | Factory for creating UI elements. |
Definition at line 12 of file BaseMenu.cpp.
References _menu, _uiFactory, and UI::IUIFactory::CreateMenu().

|
virtualdefault |
Virtual destructor.
|
protected |
Create a button with standard styling and positioning.
| label | Button text label. |
| offsetY | Vertical offset from center. |
| width | Button width. |
| height | Button height. |
| backgroundColor | Button background color (RGBA). |
| hoverColor | Button hover color (RGBA). |
| callback | Function to call when button is clicked. |
Definition at line 60 of file BaseMenu.cpp.
References _uiFactory, UI::CENTER_BOTH, UI::IUIFactory::CreateButton(), and WrapWithClickSound().
Referenced by Game::AccessibilityMenu::Initialize(), Game::ConfirmQuitMenu::Initialize(), Game::DefeatMenu::Initialize(), Game::KeyBindingsMenu::Initialize(), Game::MainMenu::Initialize(), Game::SettingsMenu::Initialize(), and Game::VictoryMenu::Initialize().

|
virtual |
Hide the menu.
Definition at line 34 of file BaseMenu.cpp.
References _menu.
Referenced by Game::AccessibilityMenu::Initialize(), Game::SettingsMenu::Initialize(), and Game::ConfirmQuitMenu::OnCancelClicked().
|
pure virtual |
Initialize menu (must be implemented by derived classes).
Implemented in Game::AccessibilityMenu, Game::AddServerMenu, Game::ConfirmQuitMenu, Game::ConnectionMenu, Game::CreateRoomMenu, Game::DefeatMenu, Game::KeyBindingsMenu, Game::LoginMenu, Game::MainMenu, Game::RoomListMenu, Game::ServerListMenu, Game::SettingsMenu, Game::VictoryMenu, and Game::WaitingRoomMenu.
|
virtual |
Check if menu is currently visible.
Definition at line 40 of file BaseMenu.cpp.
References _menu.
Referenced by Game::DefeatMenu::Render(), Game::VictoryMenu::Render(), Game::AccessibilityMenu::ShouldDimBackground(), and Game::SettingsMenu::ShouldDimBackground().
|
virtual |
Render menu (should be called every frame).
Reimplemented in Game::AccessibilityMenu, Game::AddServerMenu, Game::ConnectionMenu, Game::CreateRoomMenu, Game::DefeatMenu, Game::KeyBindingsMenu, Game::LoginMenu, Game::RoomListMenu, Game::ServerListMenu, Game::SettingsMenu, Game::VictoryMenu, and Game::WaitingRoomMenu.
Definition at line 22 of file BaseMenu.cpp.
References _menu.
Referenced by Game::AccessibilityMenu::Render(), Game::AddServerMenu::Render(), Game::ConnectionMenu::Render(), Game::CreateRoomMenu::Render(), Game::DefeatMenu::Render(), Game::LoginMenu::Render(), Game::RoomListMenu::Render(), Game::ServerListMenu::Render(), Game::SettingsMenu::Render(), Game::VictoryMenu::Render(), and Game::WaitingRoomMenu::Render().
| void Game::BaseMenu::SetSoundEffectService | ( | Audio::ISoundEffectService * | soundService | ) |
Set the sound effect service for playing UI sounds.
| soundService | Pointer to sound effect service (can be nullptr to disable sounds). |
Definition at line 44 of file BaseMenu.cpp.
References _soundService.
|
virtual |
Show the menu.
Reimplemented in Game::MainMenu, and Game::RoomListMenu.
Definition at line 28 of file BaseMenu.cpp.
References _menu.
Referenced by Game::MainMenu::Show(), and Game::RoomListMenu::Show().
|
virtual |
Update menu state (should be called every frame).
Reimplemented in Game::AccessibilityMenu, Game::AddServerMenu, Game::ConnectionMenu, Game::CreateRoomMenu, Game::KeyBindingsMenu, Game::LoginMenu, Game::RoomListMenu, Game::ServerListMenu, Game::SettingsMenu, and Game::WaitingRoomMenu.
Definition at line 16 of file BaseMenu.cpp.
References _menu.
Referenced by Game::AccessibilityMenu::Update(), Game::AddServerMenu::Update(), Game::ConnectionMenu::Update(), Game::CreateRoomMenu::Update(), Game::LoginMenu::Update(), Game::RoomListMenu::Update(), Game::ServerListMenu::Update(), Game::SettingsMenu::Update(), and Game::WaitingRoomMenu::Update().
|
protected |
Wrap a callback to play click sound before executing.
| callback | Original callback function. |
Definition at line 48 of file BaseMenu.cpp.
References _soundService, and Audio::ISoundEffectService::PlayClickSound().
Referenced by CreateCenteredButton(), Game::AddServerMenu::Initialize(), Game::ConnectionMenu::Initialize(), Game::CreateRoomMenu::Initialize(), Game::DefeatMenu::Initialize(), Game::LoginMenu::Initialize(), Game::MainMenu::Initialize(), Game::RoomListMenu::Initialize(), Game::ServerListMenu::Initialize(), Game::VictoryMenu::Initialize(), Game::WaitingRoomMenu::Initialize(), Game::RoomListMenu::RebuildRoomList(), Game::ServerListMenu::RebuildServerList(), and Game::ServerListMenu::UpdateAddServerButtonState().

|
protected |
Definition at line 101 of file BaseMenu.hpp.
Referenced by BaseMenu(), Hide(), Game::AccessibilityMenu::Initialize(), Game::AddServerMenu::Initialize(), Game::ConfirmQuitMenu::Initialize(), Game::ConnectionMenu::Initialize(), Game::CreateRoomMenu::Initialize(), Game::DefeatMenu::Initialize(), Game::KeyBindingsMenu::Initialize(), Game::LoginMenu::Initialize(), Game::MainMenu::Initialize(), Game::RoomListMenu::Initialize(), Game::ServerListMenu::Initialize(), Game::SettingsMenu::Initialize(), Game::VictoryMenu::Initialize(), Game::WaitingRoomMenu::Initialize(), IsVisible(), Game::WaitingRoomMenu::RebuildPlayerList(), Game::RoomListMenu::RebuildRoomList(), Game::ServerListMenu::RebuildServerList(), Render(), Game::AccessibilityMenu::Render(), Game::AddServerMenu::Render(), Game::ConnectionMenu::Render(), Game::CreateRoomMenu::Render(), Game::RoomListMenu::Render(), Game::ServerListMenu::Render(), Game::SettingsMenu::Render(), Game::WaitingRoomMenu::Render(), Show(), Update(), Game::CreateRoomMenu::Update(), Game::RoomListMenu::Update(), Game::SettingsMenu::Update(), Game::WaitingRoomMenu::Update(), Game::SettingsMenu::UpdateAutoMatchmakingVisuals(), Game::SettingsMenu::UpdateChatToggleVisuals(), Game::AccessibilityMenu::UpdateColorblindFilterVisuals(), Game::SettingsMenu::UpdateFpsToggleVisuals(), Game::SettingsMenu::UpdateTargetFpsVisuals(), and Game::SettingsMenu::UpdateToggleVisuals().
|
protected |
Definition at line 102 of file BaseMenu.hpp.
Referenced by SetSoundEffectService(), Game::MainMenu::Show(), Game::RoomListMenu::Show(), and WrapWithClickSound().
|
protected |
Definition at line 100 of file BaseMenu.hpp.
Referenced by BaseMenu(), CreateCenteredButton(), Game::AddServerMenu::CreateInput(), Game::AddServerMenu::Initialize(), Game::ConnectionMenu::Initialize(), Game::CreateRoomMenu::Initialize(), Game::KeyBindingsMenu::Initialize(), Game::LoginMenu::Initialize(), Game::MainMenu::Initialize(), Game::RoomListMenu::Initialize(), Game::ServerListMenu::Initialize(), Game::WaitingRoomMenu::Initialize(), Game::RoomListMenu::RebuildRoomList(), Game::ServerListMenu::RebuildServerList(), and Game::SettingsMenu::SettingsMenu().