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",
70 "assets/fonts/main.ttf",
78 {
"2",
"3",
"4",
"5",
"6",
"7",
"8"},
87 "assets/fonts/main.ttf",
105 "assets/fonts/main.ttf",
123 "assets/fonts/main.ttf",
131 {
"1",
"2",
"3",
"4"},
133 [
this](
int index) {
_uiLevelId =
static_cast<uint32_t
>(index + 1); }
142 const std::string name =
System to handle network-related operations on the client side.
State getState(void) const
Get the current state of the client.
void tryCreateRoom(const std::string &roomName, uint32_t maxPlayers, float difficulty, float speed, uint32_t duration, uint32_t seed, uint32_t levelId, uint8_t roomType)
Send a request to create a new room on the server.
Manages game settings and preferences.
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.
static ecs::Entity createDropdown(ecs::Registry ®istry, const position &position, const size &size, const std::vector< std::string > &options, const int selectedIndex, std::function< void(int index)> onSelect=nullptr)
static ecs::Entity createSlider(ecs::Registry ®istry, const position &position, const size &size, float minValue, float maxValue, float initialValue, std::function< void(float)> onChange=nullptr)
uint32_t _uiLevelId
Level ID for the game.
ecs::Registry & _uiRegistry
Reference to the ECS registry.
CreateRoomScene(ecs::Registry &UiRegistry, Settings &settings, TranslationManager &translationManager, NetworkSyncSystem &network, graphics::UiFactory &uiFactory, std::function< void(GameState)> changeState)
Constructor for CreateRoomScene.
void handleEvent(const sf::Event &event) override
Handle an incoming event.
graphics::UiFactory & _uiFactory
UI Factory for creating UI components.
ChangeStateFn _changeState
Function to change the game state.
float _uiSpeed
Game speed setting for the room.
uint32_t _uiDuration
Duration of the game in minutes.
void onExit(void) override
Called when the scene is exited.
NetworkSyncSystem & _network
Reference to the client network.
void update(float dt) override
Update the scene state.
std::string _uiRoomName
Name of the room to be created.
uint32_t _uiSeed
Seed for random generation.
void onEnter(void) override
Called when the scene is entered.
float _uiDifficulty
Difficulty setting for the room.
uint32_t _uiMaxPlayers
Maximum number of players in the room.
@ RoomWaiting
Room waiting state.
@ Playing
In-game playing state.
void info(LogFmt< std::type_identity_t< Args >... > fmt, Args &&...args) noexcept
Log an informational message.