26 std::function<
void(
GameState)> changeState)
27 : _uiRegistry(UiRegistry),
29 _translationManager(translationManager),
31 _uiFactory(uiFactory),
32 _changeState(changeState)
48 auto &buttons = buttonsOpt.value().get();
51 panel.idleColor[0] = 20; panel.idleColor[1] = 20; panel.idleColor[2] = 20;
52 panel.hoverColor[0] = 20; panel.hoverColor[1] = 20; panel.hoverColor[2] = 20;
53 panel.pressedColor[0] = 20; panel.pressedColor[1] = 20; panel.pressedColor[2] = 20;
61 "assets/fonts/main.ttf",
84 "Waiting for players...",
85 "assets/fonts/title.ttf",
143 auto &texts = textsOpt.value().get();
169 auto &buttons = buttonsOpt.value().get();
172 panel.idleColor[0] = 20; panel.idleColor[1] = 20; panel.idleColor[2] = 20;
173 panel.hoverColor[0] = 20; panel.hoverColor[1] = 20; panel.hoverColor[2] = 20;
174 panel.pressedColor[0] = 20; panel.pressedColor[1] = 20; panel.pressedColor[2] = 20;
182 "assets/fonts/main.ttf",
192 "assets/fonts/main.ttf",
200 auto &inputs = inputsOpt.value().get();
202 inputs[
_chatInput].onSubmit = [
this](
const std::string&) {
232 auto &texts = textsOpt.value().get();
237 std::string combined;
238 for (
const auto &line : history) {
239 if (!combined.empty())
252 auto &inputs = inputsOpt.
value().get();
257 const std::string message = input.value;
System to handle network-related operations on the client side.
bool isInGame(void) const
Check if the client is in game.
void trySetReady(bool isReady)
Send a request to set the client's ready status in the current room.
void tryLeaveRoom(void)
Send a request to leave the current room on the server.
void trySendMessage(const std::string &message) const
Send a chat message to the server.
std::string getLastChatMessage(void) const
Get the last received room chat message.
const std::deque< std::string > & getChatHistory(void) const
Get chat history buffer (most recent last)
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.
ChangeStateFn _changeState
Function to change the game state.
void updateChatHistoryText(void)
NetworkSyncSystem & _network
Reference to the client network.
graphics::UiFactory & _uiFactory
UI Factory for creating UI components.
ecs::Entity _chatCompactPanel
Compact chat background panel.
void update(float dt) override
Update the scene state.
void onExit(void) override
Called when the scene is exited.
ecs::Entity _chatToggleButton
Toggle button for chat.
ecs::Registry & _uiRegistry
Reference to the ECS registry.
void sendChatMessage(void)
void onEnter(void) override
Called when the scene is entered.
RoomWaitingScene(ecs::Registry &UiRegistry, Settings &settings, TranslationManager &translationManager, NetworkSyncSystem &network, graphics::UiFactory &uiFactory, std::function< void(GameState)> changeState)
Constructor for RoomWaitingScene.
bool _uiReady
Player ready status in the UI.
ecs::Entity _chatInput
Text input entity for chat.
void handleEvent(const sf::Event &event) override
Handle an incoming event.
bool _chatOpen
Whether expanded chat is open.
ecs::Entity _chatPanel
Expanded chat panel.
ecs::Entity _chatHistoryText
Text entity for chat history.
ecs::Entity _chatCompactText
Text entity for last chat message.
constexpr bool isNull(void) const noexcept
auto get(this const Self &self) -> std::expected< std::reference_wrapper< ConstLike< Self, SparseArray< T > > >, rtp::Error >
@ Playing
In-game playing state.
void info(LogFmt< std::type_identity_t< Args >... > fmt, Args &&...args) noexcept
Log an informational message.
Component representing text to render.
std::string content
Text content.