This file contains the network protocol.
Abstract class for scene.
Pre-game lobby scene where players wait before match starts.
void event(const eng::Event &event) override
Handle input events.
bool m_hasLobbyInfo
Whether lobby info has been received.
void processEventBus()
Process events from event bus.
bool isHost() const
Check if local player is the lobby host.
void startGame()
Initiate game start sequence.
int m_selectedButton
Currently selected button index.
static constexpr int BUTTON_START
Start game button index (host only)
void setIsHost(const bool isHost)
Set whether local player is the lobby host.
std::uint32_t m_lobbyId
Current lobby ID.
void handleLobbyUpdate(const utl::Event &event)
Handle lobby update event from server.
void leaveLobby() const
Send leave lobby request to server.
bool m_playMusic
Music playback state.
void setupEventSubscriptions() const
Subscribe to event bus events.
~WaitingRoomScene() override=default
Destructor.
bool m_isHost
Whether local player is lobby host.
static constexpr int BUTTON_LEAVE
Leave lobby button index.
void setLobbyInfo(const rnp::LobbyInfo &lobbyInfo)
Update lobby information.
static constexpr int BUTTON_COUNT
Total number of buttons.
WaitingRoomScene(const WaitingRoomScene &other)=delete
Deleted copy constructor (non-copyable)
WaitingRoomScene(WaitingRoomScene &&other)=delete
Deleted move constructor (non-movable)
void update(float dt, const eng::WindowSize &size) override
Update the waiting room scene (called each frame)
std::function< void()> onGameStart
Callback invoked when game starts.
WaitingRoomScene & operator=(const WaitingRoomScene &other)=delete
Deleted copy assignment operator (non-copyable)
ecs::Entity m_readyButtonEntity
Ready button entity.
void handleGameStart(const utl::Event &event) const
Handle game start event from server.
WaitingRoomScene & operator=(WaitingRoomScene &&other)=delete
Deleted move assignment operator (non-movable)
ecs::Entity m_leaveButtonEntity
Leave button entity.
ecs::Entity m_playerCountEntity
Entity displaying player count.
void updatePlayerDisplay()
Update the player list display.
void setLobbyId(std::uint32_t lobbyId)
Set the lobby ID.
WaitingRoomScene(eng::id assignedId, const std::shared_ptr< eng::IRenderer > &renderer)
Constructor.
std::vector< ecs::Entity > m_playerEntities
Entities for player name displays.
ecs::Entity m_lobbyIdEntity
Entity displaying lobby ID.
std::function< void()> onLeaveLobby
Callback invoked when player leaves lobby.
float m_animationTime
Timer for UI animations.
ecs::Entity m_startButtonEntity
Start game button entity (host only)
static constexpr int BUTTON_READY
Ready button index.
void clearPlayerEntities()
Clear all player display entities.
std::uint32_t getLobbyId() const
Get current lobby ID.
const std::shared_ptr< eng::IRenderer > & m_renderer
Renderer interface reference.
rnp::LobbyInfo m_currentLobbyInfo
Current lobby state.
bool & playMusic()
Get reference to music playback flag.
ecs::Entity m_statusEntity
Entity displaying lobby status.
Event structure for inter-component communication.
This file contains the IScene class.
Lobby information structure.