22 std::function<
void(
GameState)> changeState)
23 : _uiRegistry(UiRegistry),
25 _translationManager(translationManager),
27 _uiFactory(uiFactory),
28 _changeState(changeState)
40 "assets/fonts/title.ttf",
50 "assets/fonts/main.ttf",
58 "assets/fonts/main.ttf",
62 [
this](
const std::string& text) {
_uiUsername = text; },
63 [
this](
const std::string& text) {
_uiUsername = text; }
70 "assets/fonts/main.ttf",
78 "assets/fonts/main.ttf",
82 [
this](
const std::string& text) {
_uiPassword = text; },
83 [
this](
const std::string& text) {
_uiPassword = text; }
System to handle network-related operations on the client side.
void tryRegister(const std::string &username, const std::string &password) const
Send a request to server attempting to register with provided credentials.
void tryLogin(const std::string &username, const std::string &password, uint8_t weaponKind) const
Send a request to server attempting to log in with provided credentials.
bool isLoggedIn(void) const
Check if the client is logged in.
Manages game settings and preferences.
ecs::components::WeaponKind getSelectedWeapon() const
Manages game translations for all UI elements.
Factory class for creating UI components in the ECS registry.
static ecs::Entity createTextInput(ecs::Registry ®istry, const position &position, const size &size, const std::string &fontPath, unsigned int fontSize, const int maxLength=64, const std::string &placeholder="", std::function< void(const std::string &)> onSubmit=nullptr, std::function< void(const std::string &)> onChange=nullptr)
static ecs::Entity createText(ecs::Registry ®istry, const position &position, const std::string &content, const std::string &fontPath, unsigned int fontSize, const std::uint8_t zIndex=0, const color &textColor={255, 255, 255})
static ecs::Entity createButton(ecs::Registry ®istry, const position &position, const size &size, const std::string &label, std::function< void()> onClick=nullptr)
Create a button UI component.
Settings & _settings
Reference to the application settings.
NetworkSyncSystem & _network
Reference to the client network.
ecs::Registry & _uiRegistry
Reference to the ECS registry.
void handleEvent(const sf::Event &event) override
Handle an incoming event.
void onEnter(void) override
Called when the scene is entered.
void onExit(void) override
Called when the scene is exited.
ChangeStateFn _changeState
Function to change the game state.
std::string _uiUsername
Username input from the UI.
void update(float dt) override
Update the scene state.
std::string _uiPassword
Password input from the UI.
LoginScene(ecs::Registry &UiRegistry, Settings &settings, TranslationManager &translationManager, NetworkSyncSystem &network, graphics::UiFactory &uiFactory, std::function< void(GameState)> changeState)
Constructor for LoginScene.
graphics::UiFactory & _uiFactory
UI Factory for creating UI components.
void info(LogFmt< std::type_identity_t< Args >... > fmt, Args &&...args) noexcept
Log an informational message.