|
R-Type
Distributed multiplayer game engine in C++
|
Menu for creating a new game room. More...
#include <CreateRoomMenu.hpp>


Public Member Functions | |
| CreateRoomMenu (UI::IUIFactory &uiFactory, Graphics::IGraphics &graphics) | |
| ~CreateRoomMenu () override=default | |
| void | SetOnCreate (std::function< void(const std::string &, uint32_t, bool, float)> onCreate) |
| Set callback triggered when Create button is clicked. | |
| void | SetOnCancel (std::function< void()> onCancel) |
| Set callback triggered when Cancel button is clicked. | |
| 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 | OnCreateClicked () |
| void | OnCancelClicked () |
| bool | ValidateInput () |
| void | UpdateSpeedButtonText () |
Private Attributes | |
| std::function< void(const std::string &, uint32_t, bool, float)> | _onCreate {} |
| std::function< void()> | _onCancel {} |
| Graphics::IGraphics & | _graphics |
| std::shared_ptr< UI::ITextInput > | _roomNameInput |
| std::shared_ptr< UI::IButton > | _maxPlayersButton |
| std::shared_ptr< UI::IButton > | _privateButton |
| std::shared_ptr< UI::IButton > | _gameSpeedButton |
| std::shared_ptr< UI::IButton > | _createButton |
| std::shared_ptr< UI::IButton > | _cancelButton |
| uint32_t | _selectedMaxPlayers = 4 |
| bool | _isPrivate = false |
| float | _gameSpeedMultiplier = 1.0f |
| std::string | _errorMessage |
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 for creating a new game room.
Definition at line 23 of file CreateRoomMenu.hpp.
|
explicit |
Definition at line 13 of file CreateRoomMenu.cpp.
|
overridedefault |
|
overridevirtual |
Initialize menu (must be implemented by derived classes).
Implements Game::BaseMenu.
Definition at line 25 of file CreateRoomMenu.cpp.
References _cancelButton, _createButton, _errorMessage, _gameSpeedButton, _gameSpeedMultiplier, _graphics, _isPrivate, _maxPlayersButton, Game::BaseMenu::_menu, _privateButton, _roomNameInput, _selectedMaxPlayers, Game::BaseMenu::_uiFactory, UI::IUIFactory::CreateButton(), UI::IUIFactory::CreateTextInput(), Graphics::IGraphics::GetScreenWidth(), OnCancelClicked(), OnCreateClicked(), UpdateSpeedButtonText(), and Game::BaseMenu::WrapWithClickSound().

|
private |
Definition at line 230 of file CreateRoomMenu.cpp.
References _errorMessage, _gameSpeedMultiplier, _onCancel, _roomNameInput, LOG_INFO, and UpdateSpeedButtonText().
Referenced by Initialize().

|
private |
Definition at line 200 of file CreateRoomMenu.cpp.
References _errorMessage, _gameSpeedMultiplier, _isPrivate, _maxPlayersButton, _onCreate, _privateButton, _roomNameInput, _selectedMaxPlayers, LOG_INFO, LOG_WARNING, UpdateSpeedButtonText(), and ValidateInput().
Referenced by Initialize().

|
overridevirtual |
Render menu (should be called every frame).
Reimplemented from Game::BaseMenu.
Definition at line 149 of file CreateRoomMenu.cpp.
References _errorMessage, _graphics, Game::BaseMenu::_menu, _roomNameInput, Graphics::IGraphics::DrawText(), Graphics::IGraphics::GetScreenWidth(), and Game::BaseMenu::Render().

| void Game::CreateRoomMenu::SetOnCancel | ( | std::function< void()> | onCancel | ) |
Set callback triggered when Cancel button is clicked.
Definition at line 21 of file CreateRoomMenu.cpp.
References _onCancel.
| void Game::CreateRoomMenu::SetOnCreate | ( | std::function< void(const std::string &, uint32_t, bool, float)> | onCreate | ) |
Set callback triggered when Create button is clicked.
| onCreate | Callback receiving (roomName, maxPlayers, isPrivate, gameSpeedMultiplier) |
Definition at line 16 of file CreateRoomMenu.cpp.
References _onCreate.
|
overridevirtual |
Update menu state (should be called every frame).
Reimplemented from Game::BaseMenu.
Definition at line 136 of file CreateRoomMenu.cpp.
References Game::BaseMenu::_menu, _roomNameInput, and Game::BaseMenu::Update().

|
private |
Definition at line 244 of file CreateRoomMenu.cpp.
References _gameSpeedButton, and _gameSpeedMultiplier.
Referenced by Initialize(), OnCancelClicked(), and OnCreateClicked().
|
private |
Definition at line 178 of file CreateRoomMenu.cpp.
References _errorMessage, and _roomNameInput.
Referenced by OnCreateClicked().
|
private |
Definition at line 59 of file CreateRoomMenu.hpp.
Referenced by Initialize().
|
private |
Definition at line 58 of file CreateRoomMenu.hpp.
Referenced by Initialize().
|
private |
Definition at line 65 of file CreateRoomMenu.hpp.
Referenced by Initialize(), OnCancelClicked(), OnCreateClicked(), Render(), and ValidateInput().
|
private |
Definition at line 57 of file CreateRoomMenu.hpp.
Referenced by Initialize(), and UpdateSpeedButtonText().
|
private |
Definition at line 63 of file CreateRoomMenu.hpp.
Referenced by Initialize(), OnCancelClicked(), OnCreateClicked(), and UpdateSpeedButtonText().
|
private |
Definition at line 52 of file CreateRoomMenu.hpp.
Referenced by Initialize(), and Render().
|
private |
Definition at line 62 of file CreateRoomMenu.hpp.
Referenced by Initialize(), and OnCreateClicked().
|
private |
Definition at line 55 of file CreateRoomMenu.hpp.
Referenced by Initialize(), and OnCreateClicked().
|
private |
Definition at line 50 of file CreateRoomMenu.hpp.
Referenced by OnCancelClicked(), and SetOnCancel().
|
private |
Definition at line 49 of file CreateRoomMenu.hpp.
Referenced by OnCreateClicked(), and SetOnCreate().
|
private |
Definition at line 56 of file CreateRoomMenu.hpp.
Referenced by Initialize(), and OnCreateClicked().
|
private |
Definition at line 54 of file CreateRoomMenu.hpp.
Referenced by Initialize(), OnCancelClicked(), OnCreateClicked(), Render(), Update(), and ValidateInput().
|
private |
Definition at line 61 of file CreateRoomMenu.hpp.
Referenced by Initialize(), and OnCreateClicked().