18 std::function<
void(
GameState)> changeState)
19 : _uiRegistry(UiRegistry),
21 _translationManager(translationManager),
23 _uiFactory(uiFactory),
24 _changeState(changeState)
33 const std::string bestName = summary.
bestPlayer.empty() ?
"Player" : summary.bestPlayer;
39 "assets/fonts/title.ttf",
48 bestName +
" has best score " + std::to_string(summary.bestScore),
49 "assets/fonts/main.ttf",
58 "Your score: " + std::to_string(summary.playerScore),
59 "assets/fonts/main.ttf",
84 if (
const auto* kp = event.getIf<sf::Event::KeyPressed>()) {
85 if (kp->code == sf::Keyboard::Key::Enter ||
86 kp->code == sf::Keyboard::Key::Escape) {
System to handle network-related operations on the client side.
void tryLeaveRoom(void)
Send a request to leave the current room on the server.
GameOverSummary getGameOverSummary(void) const
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 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.
ecs::Registry & _uiRegistry
graphics::UiFactory & _uiFactory
void onEnter(void) override
Called when the scene is entered.
void onExit(void) override
Called when the scene is exited.
NetworkSyncSystem & _network
void update(float dt) override
Update the scene state.
void handleEvent(const sf::Event &event) override
Handle an incoming event.
GameOverScene(ecs::Registry &UiRegistry, Settings &settings, TranslationManager &translationManager, NetworkSyncSystem &network, graphics::UiFactory &uiFactory, std::function< void(GameState)> changeState)
ChangeStateFn _changeState
void info(LogFmt< std::type_identity_t< Args >... > fmt, Args &&...args) noexcept
Log an informational message.