|
R-Type
Distributed multiplayer game engine in C++
|
Menu displayed while waiting for game to start. More...
#include <WaitingRoomMenu.hpp>


Public Member Functions | |
| WaitingRoomMenu (UI::IUIFactory &uiFactory, Graphics::IGraphics &graphics) | |
| ~WaitingRoomMenu () override=default | |
| void | SetOnStartGame (std::function< void()> onStartGame) |
| Set callback triggered when Start Game button is clicked (host only) | |
| void | SetOnBack (std::function< void()> onBack) |
| Set callback triggered when Back button is clicked. | |
| void | UpdatePlayerList (const std::vector< PlayerInfo > &players) |
| Update the player list. | |
| void | SetRoomInfo (const std::string &roomName, uint32_t currentPlayers, uint32_t maxPlayers) |
| Set room name and player count info. | |
| void | SetIsHost (bool isHost) |
| Set whether current player is host (enables Start Game button) | |
| void | SetIsSpectator (bool isSpectator) |
| Set whether current player is spectator (shows spectator banner) | |
| void | Initialize () override |
| Initialize menu (must be implemented by derived classes). | |
| void | Update () override |
| Update menu state (should be called every frame). | |
| void | Render () override |
| Render menu (should be called every frame). | |
Public Member Functions inherited from Game::BaseMenu | |
| BaseMenu (UI::IUIFactory &uiFactory) | |
| Constructor with UI factory reference. | |
| virtual | ~BaseMenu ()=default |
| Virtual destructor. | |
| 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 | OnStartGameClicked () |
| void | OnBackClicked () |
| void | RebuildPlayerList () |
Private Attributes | |
| std::function< void()> | _onStartGame {} |
| std::function< void()> | _onBack {} |
| Graphics::IGraphics & | _graphics |
| std::string | _roomName |
| uint32_t | _currentPlayers = 0 |
| uint32_t | _maxPlayers = 4 |
| bool | _isHost = false |
| bool | _isSpectator = false |
| std::vector< PlayerInfo > | _players |
| std::shared_ptr< UI::IButton > | _startGameButton |
| std::shared_ptr< UI::IButton > | _backButton |
Static Private Attributes | |
| static constexpr float | PLAYER_ITEM_HEIGHT = 50.0f |
| static constexpr float | PLAYER_ITEM_SPACING = 10.0f |
| static constexpr float | LIST_START_Y = 150.0f |
| static constexpr size_t | MAX_VISIBLE_PLAYERS = 8 |
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} |
Menu displayed while waiting for game to start.
Definition at line 36 of file WaitingRoomMenu.hpp.
|
explicit |
Definition at line 14 of file WaitingRoomMenu.cpp.
|
overridedefault |
|
overridevirtual |
Initialize menu (must be implemented by derived classes).
Implements Game::BaseMenu.
Definition at line 47 of file WaitingRoomMenu.cpp.
References _backButton, _graphics, _isHost, Game::BaseMenu::_menu, _startGameButton, Game::BaseMenu::_uiFactory, UI::IUIFactory::CreateButton(), Graphics::IGraphics::GetScreenHeight(), Graphics::IGraphics::GetScreenWidth(), OnBackClicked(), OnStartGameClicked(), RebuildPlayerList(), and Game::BaseMenu::WrapWithClickSound().
Referenced by SetIsHost().

|
private |
Definition at line 183 of file WaitingRoomMenu.cpp.
References _onBack, and LOG_INFO.
Referenced by Initialize().
|
private |
Definition at line 176 of file WaitingRoomMenu.cpp.
References _onStartGame, and LOG_INFO.
Referenced by Initialize().
|
private |
Definition at line 165 of file WaitingRoomMenu.cpp.
References Game::BaseMenu::_menu.
Referenced by Initialize(), and UpdatePlayerList().
|
overridevirtual |
Render menu (should be called every frame).
Reimplemented from Game::BaseMenu.
Definition at line 102 of file WaitingRoomMenu.cpp.
References _currentPlayers, _graphics, _maxPlayers, Game::BaseMenu::_menu, _players, _roomName, Graphics::IGraphics::DrawRect(), Graphics::IGraphics::DrawRectFilled(), Graphics::IGraphics::DrawText(), Graphics::IGraphics::GetScreenWidth(), and Game::BaseMenu::Render().

| void Game::WaitingRoomMenu::SetIsHost | ( | bool | isHost | ) |
Set whether current player is host (enables Start Game button)
Definition at line 37 of file WaitingRoomMenu.cpp.
References _isHost, and Initialize().

| void Game::WaitingRoomMenu::SetIsSpectator | ( | bool | isSpectator | ) |
Set whether current player is spectator (shows spectator banner)
Definition at line 43 of file WaitingRoomMenu.cpp.
References _isSpectator.
| void Game::WaitingRoomMenu::SetOnBack | ( | std::function< void()> | onBack | ) |
Set callback triggered when Back button is clicked.
Definition at line 21 of file WaitingRoomMenu.cpp.
References _onBack.
| void Game::WaitingRoomMenu::SetOnStartGame | ( | std::function< void()> | onStartGame | ) |
Set callback triggered when Start Game button is clicked (host only)
Definition at line 17 of file WaitingRoomMenu.cpp.
References _onStartGame.
| void Game::WaitingRoomMenu::SetRoomInfo | ( | const std::string & | roomName, |
| uint32_t | currentPlayers, | ||
| uint32_t | maxPlayers | ||
| ) |
Set room name and player count info.
Definition at line 30 of file WaitingRoomMenu.cpp.
References _currentPlayers, _maxPlayers, and _roomName.
|
overridevirtual |
Update menu state (should be called every frame).
Reimplemented from Game::BaseMenu.
Definition at line 95 of file WaitingRoomMenu.cpp.
References Game::BaseMenu::_menu, and Game::BaseMenu::Update().

| void Game::WaitingRoomMenu::UpdatePlayerList | ( | const std::vector< PlayerInfo > & | players | ) |
Update the player list.
Definition at line 25 of file WaitingRoomMenu.cpp.
References _players, and RebuildPlayerList().

|
private |
Definition at line 93 of file WaitingRoomMenu.hpp.
Referenced by Initialize().
|
private |
Definition at line 86 of file WaitingRoomMenu.hpp.
Referenced by Render(), and SetRoomInfo().
|
private |
Definition at line 83 of file WaitingRoomMenu.hpp.
Referenced by Initialize(), and Render().
|
private |
Definition at line 88 of file WaitingRoomMenu.hpp.
Referenced by Initialize(), and SetIsHost().
|
private |
Definition at line 89 of file WaitingRoomMenu.hpp.
Referenced by SetIsSpectator().
|
private |
Definition at line 87 of file WaitingRoomMenu.hpp.
Referenced by Render(), and SetRoomInfo().
|
private |
Definition at line 81 of file WaitingRoomMenu.hpp.
Referenced by OnBackClicked(), and SetOnBack().
|
private |
Definition at line 80 of file WaitingRoomMenu.hpp.
Referenced by OnStartGameClicked(), and SetOnStartGame().
|
private |
Definition at line 91 of file WaitingRoomMenu.hpp.
Referenced by Render(), and UpdatePlayerList().
|
private |
Definition at line 85 of file WaitingRoomMenu.hpp.
Referenced by Render(), and SetRoomInfo().
|
private |
Definition at line 92 of file WaitingRoomMenu.hpp.
Referenced by Initialize().
|
staticconstexprprivate |
Definition at line 97 of file WaitingRoomMenu.hpp.
|
staticconstexprprivate |
Definition at line 98 of file WaitingRoomMenu.hpp.
|
staticconstexprprivate |
Definition at line 95 of file WaitingRoomMenu.hpp.
|
staticconstexprprivate |
Definition at line 96 of file WaitingRoomMenu.hpp.