|
Air-Trap 1.0.0
A multiplayer R-Type clone game engine built with C++23 and ECS architecture
|
Scene for user login. More...
#include <LoginScene.hpp>
Public Types | |
| using | ChangeStateFn = std::function< void(GameState)> |
| Type alias for a function that changes the game state. | |
Public Member Functions | |
| LoginScene (ecs::Registry &UiRegistry, Settings &settings, TranslationManager &translationManager, NetworkSyncSystem &network, graphics::UiFactory &uiFactory, std::function< void(GameState)> changeState) | |
| Constructor for LoginScene. | |
| void | onEnter (void) override |
| Called when the scene is entered. | |
| void | onExit (void) override |
| Called when the scene is exited. | |
| void | handleEvent (const sf::Event &event) override |
| Handle an incoming event. | |
| void | update (float dt) override |
| Update the scene state. | |
Public Member Functions inherited from rtp::client::interfaces::IScene | |
| virtual | ~IScene (void)=default |
Private Attributes | |
| ecs::Registry & | _uiRegistry |
| Reference to the ECS registry. | |
| Settings & | _settings |
| Reference to the application settings. | |
| TranslationManager & | _translationManager |
| Reference to the translation manager. | |
| NetworkSyncSystem & | _network |
| Reference to the client network. | |
| graphics::UiFactory & | _uiFactory |
| UI Factory for creating UI components. | |
| ChangeStateFn | _changeState |
| Function to change the game state. | |
| std::string | _uiUsername |
| Username input from the UI. | |
| std::string | _uiPassword |
| Password input from the UI. | |
Scene for user login.
This scene handles user authentication, including input fields for username and password, and a login button.
Definition at line 31 of file LoginScene.hpp.
| using rtp::client::scenes::LoginScene::ChangeStateFn = std::function<void(GameState)> |
Type alias for a function that changes the game state.
Definition at line 51 of file LoginScene.hpp.
| rtp::client::scenes::LoginScene::LoginScene | ( | ecs::Registry & | UiRegistry, |
| Settings & | settings, | ||
| TranslationManager & | translationManager, | ||
| NetworkSyncSystem & | network, | ||
| graphics::UiFactory & | uiFactory, | ||
| std::function< void(GameState)> | changeState | ||
| ) |
Constructor for LoginScene.
| registry | Reference to the ECS registry |
| settings | Reference to the application settings |
| network | Reference to the client network |
| window | Reference to the SFML render window |
Definition at line 17 of file LoginScene.cpp.
|
overridevirtual |
Handle an incoming event.
| event | The event to handle. |
Implements rtp::client::interfaces::IScene.
Definition at line 111 of file LoginScene.cpp.
|
overridevirtual |
Called when the scene is entered.
Implements rtp::client::interfaces::IScene.
Definition at line 32 of file LoginScene.cpp.
References _network, _settings, _uiFactory, _uiPassword, _uiRegistry, _uiUsername, rtp::client::graphics::UiFactory::createButton(), rtp::client::graphics::UiFactory::createText(), rtp::client::graphics::UiFactory::createTextInput(), rtp::client::Settings::getSelectedWeapon(), rtp::log::info(), rtp::client::NetworkSyncSystem::tryLogin(), and rtp::client::NetworkSyncSystem::tryRegister().
|
overridevirtual |
Called when the scene is exited.
Implements rtp::client::interfaces::IScene.
Definition at line 106 of file LoginScene.cpp.
References rtp::log::info().
|
overridevirtual |
Update the scene state.
| dt | Time delta since the last update. |
Implements rtp::client::interfaces::IScene.
Definition at line 116 of file LoginScene.cpp.
References _changeState, _network, rtp::client::NetworkSyncSystem::isLoggedIn(), and rtp::client::Menu.
|
private |
Function to change the game state.
Definition at line 81 of file LoginScene.hpp.
Referenced by update().
|
private |
Reference to the client network.
Definition at line 79 of file LoginScene.hpp.
|
private |
Reference to the application settings.
Definition at line 77 of file LoginScene.hpp.
Referenced by onEnter().
|
private |
Reference to the translation manager.
Definition at line 78 of file LoginScene.hpp.
|
private |
UI Factory for creating UI components.
Definition at line 80 of file LoginScene.hpp.
Referenced by onEnter().
|
private |
|
private |
Reference to the ECS registry.
Definition at line 76 of file LoginScene.hpp.
Referenced by onEnter().
|
private |