|
R-Type
Distributed multiplayer game engine in C++
|
#include <LoginMenu.hpp>


Public Member Functions | |
| LoginMenu (UI::IUIFactory &uiFactory, Graphics::IGraphics &graphics) | |
| Constructor. | |
| ~LoginMenu () override=default | |
| 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). | |
| bool | IsLoginSubmitted () const |
| bool | IsRegisterSubmitted () const |
| bool | IsGuestSubmitted () const |
| std::string | GetUsername () const |
| std::string | GetPassword () const |
| void | SetErrorMessage (const std::string &message) |
| void | SetSuccessMessage (const std::string &message) |
| void | ResetMessages () |
| void | SetOnBack (std::function< void()> onBack) |
| void | Reset () |
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 | OnLoginClicked () |
| void | OnRegisterClicked () |
| void | OnGuestClicked () |
| void | HandleTabNavigation () |
Private Attributes | |
| Graphics::IGraphics & | _graphics |
| std::shared_ptr< UI::ITextInput > | _usernameInput |
| std::shared_ptr< UI::ITextInput > | _passwordInput |
| bool | _loginSubmitted = false |
| bool | _registerSubmitted = false |
| bool | _guestSubmitted = false |
| std::function< void()> | _onBack |
| std::string | _errorMessage |
| std::string | _successMessage |
| const float | INPUT_WIDTH = 300.0f |
| const float | INPUT_HEIGHT = 40.0f |
| const float | SPACING = 15.0f |
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} |
Definition at line 16 of file LoginMenu.hpp.
| Game::LoginMenu::LoginMenu | ( | UI::IUIFactory & | uiFactory, |
| Graphics::IGraphics & | graphics | ||
| ) |
Constructor.
Definition at line 14 of file LoginMenu.cpp.
|
overridedefault |
| std::string Game::LoginMenu::GetPassword | ( | ) | const |
Definition at line 241 of file LoginMenu.cpp.
References _passwordInput.
Referenced by OnLoginClicked(), and OnRegisterClicked().
| std::string Game::LoginMenu::GetUsername | ( | ) | const |
Definition at line 237 of file LoginMenu.cpp.
References _usernameInput.
Referenced by OnLoginClicked(), and OnRegisterClicked().
|
private |
Definition at line 189 of file LoginMenu.cpp.
References _graphics, _passwordInput, _usernameInput, and Graphics::IGraphics::IsKeyPressed().
Referenced by Update().

|
overridevirtual |
Initialize menu (must be implemented by derived classes).
Implements Game::BaseMenu.
Definition at line 21 of file LoginMenu.cpp.
References _graphics, Game::BaseMenu::_menu, _onBack, _passwordInput, Game::BaseMenu::_uiFactory, _usernameInput, UI::CENTER_HORIZONTAL, UI::IUIFactory::CreateButton(), UI::IUIFactory::CreateTextInput(), Graphics::IGraphics::GetScreenHeight(), INPUT_HEIGHT, INPUT_WIDTH, OnGuestClicked(), OnLoginClicked(), OnRegisterClicked(), SPACING, and Game::BaseMenu::WrapWithClickSound().

| bool Game::LoginMenu::IsGuestSubmitted | ( | ) | const |
Definition at line 233 of file LoginMenu.cpp.
References _guestSubmitted.
| bool Game::LoginMenu::IsLoginSubmitted | ( | ) | const |
Definition at line 227 of file LoginMenu.cpp.
References _loginSubmitted.
| bool Game::LoginMenu::IsRegisterSubmitted | ( | ) | const |
Definition at line 230 of file LoginMenu.cpp.
References _registerSubmitted.
|
private |
Definition at line 222 of file LoginMenu.cpp.
References _guestSubmitted.
Referenced by Initialize().
|
private |
Definition at line 204 of file LoginMenu.cpp.
References _loginSubmitted, GetPassword(), GetUsername(), ResetMessages(), and SetErrorMessage().
Referenced by Initialize(), and Update().

|
private |
Definition at line 213 of file LoginMenu.cpp.
References _registerSubmitted, GetPassword(), GetUsername(), ResetMessages(), and SetErrorMessage().
Referenced by Initialize().

|
overridevirtual |
Render menu (should be called every frame).
Reimplemented from Game::BaseMenu.
Definition at line 148 of file LoginMenu.cpp.
References _errorMessage, _graphics, _passwordInput, _successMessage, _usernameInput, Graphics::IGraphics::ClearWindow(), Graphics::IGraphics::DrawRectFilled(), Graphics::IGraphics::DrawText(), UI::TextUtils::EstimateTextWidth(), Graphics::IGraphics::GetScreenHeight(), Graphics::IGraphics::GetScreenWidth(), and Game::BaseMenu::Render().

| void Game::LoginMenu::Reset | ( | ) |
Definition at line 260 of file LoginMenu.cpp.
References _guestSubmitted, _loginSubmitted, _passwordInput, _registerSubmitted, _usernameInput, and ResetMessages().

| void Game::LoginMenu::ResetMessages | ( | ) |
Definition at line 255 of file LoginMenu.cpp.
References _errorMessage, and _successMessage.
Referenced by OnLoginClicked(), OnRegisterClicked(), and Reset().
| void Game::LoginMenu::SetErrorMessage | ( | const std::string & | message | ) |
Definition at line 245 of file LoginMenu.cpp.
References _errorMessage, and _successMessage.
Referenced by OnLoginClicked(), and OnRegisterClicked().
| void Game::LoginMenu::SetOnBack | ( | std::function< void()> | onBack | ) |
Definition at line 17 of file LoginMenu.cpp.
References _onBack.
| void Game::LoginMenu::SetSuccessMessage | ( | const std::string & | message | ) |
Definition at line 250 of file LoginMenu.cpp.
References _errorMessage, and _successMessage.
|
overridevirtual |
Update menu state (should be called every frame).
Reimplemented from Game::BaseMenu.
Definition at line 132 of file LoginMenu.cpp.
References _graphics, _passwordInput, _usernameInput, HandleTabNavigation(), Graphics::IGraphics::IsKeyPressed(), OnLoginClicked(), and Game::BaseMenu::Update().

|
private |
Definition at line 66 of file LoginMenu.hpp.
Referenced by Render(), ResetMessages(), SetErrorMessage(), and SetSuccessMessage().
|
private |
Definition at line 51 of file LoginMenu.hpp.
Referenced by HandleTabNavigation(), Initialize(), Render(), and Update().
|
private |
Definition at line 60 of file LoginMenu.hpp.
Referenced by IsGuestSubmitted(), OnGuestClicked(), and Reset().
|
private |
Definition at line 58 of file LoginMenu.hpp.
Referenced by IsLoginSubmitted(), OnLoginClicked(), and Reset().
|
private |
Definition at line 63 of file LoginMenu.hpp.
Referenced by Initialize(), and SetOnBack().
|
private |
Definition at line 55 of file LoginMenu.hpp.
Referenced by GetPassword(), HandleTabNavigation(), Initialize(), Render(), Reset(), and Update().
|
private |
Definition at line 59 of file LoginMenu.hpp.
Referenced by IsRegisterSubmitted(), OnRegisterClicked(), and Reset().
|
private |
Definition at line 67 of file LoginMenu.hpp.
Referenced by Render(), ResetMessages(), SetErrorMessage(), and SetSuccessMessage().
|
private |
Definition at line 54 of file LoginMenu.hpp.
Referenced by GetUsername(), HandleTabNavigation(), Initialize(), Render(), Reset(), and Update().
|
private |
Definition at line 71 of file LoginMenu.hpp.
Referenced by Initialize().
|
private |
Definition at line 70 of file LoginMenu.hpp.
Referenced by Initialize().
|
private |
Definition at line 72 of file LoginMenu.hpp.
Referenced by Initialize().