Air-Trap 1.0.0
A multiplayer R-Type clone game engine built with C++23 and ECS architecture
Loading...
Searching...
No Matches
LobbyScene.hpp
Go to the documentation of this file.
1
8#ifndef RTYPE_CLIENT_SCENES_LOBBYSCENE_HPP_
9 #define RTYPE_CLIENT_SCENES_LOBBYSCENE_HPP_
10
11 #include "Interfaces/IScene.hpp"
12 #include "RType/ECS/Registry.hpp"
13 #include "UI/UiFactory.hpp"
14 #include "Utils/GameState.hpp"
15 #include "Systems/NetworkSyncSystem.hpp"
17 #include "Core/Settings.hpp"
18 #include <SFML/Graphics.hpp>
19 #include <memory>
20
21namespace rtp::client {
22 namespace scenes {
31 {
32 public:
40 LobbyScene(ecs::Registry& UiRegistry,
41 Settings& settings,
42 TranslationManager& translationManager,
43 NetworkSyncSystem& network,
44 graphics::UiFactory& uiFactory,
45 std::function<void(GameState)> changeState);
46
50 using ChangeStateFn = std::function<void(GameState)>;
51
55 void onEnter(void) override;
56
60 void onExit(void) override;
61
66 void handleEvent(const sf::Event& event) override;
67
72 void update(float dt) override;
73
74 private:
82 uint32_t _uiSelectedRoomId = 0;
83 std::size_t _roomsHash = 0;
84 bool _uiBuilt = false;
86 void buildUi(void);
87 };
88 } // namespace scenes
89} // namespace rtp::client
90
91#endif // RTYPE_CLIENT_SCENES_LOBBYSCENE_HPP_
System to handle network-related operations on the client side.
Manages game settings and preferences.
Definition Settings.hpp:67
Manages game translations for all UI elements.
Factory class for creating UI components in the ECS registry.
Definition UiFactory.hpp:72
Interface for different scenes in the client application.
Definition IScene.hpp:23
Scene for the game lobby.
NetworkSyncSystem & _network
Reference to the client network.
uint32_t _uiSelectedRoomId
Currently selected room ID in the UI.
ecs::Registry & _uiRegistry
Reference to the ECS registry.
Settings & _settings
Reference to the application settings.
ChangeStateFn _changeState
Function to change the game state.
TranslationManager & _translationManager
Reference to the translation manager.
bool _uiBuilt
Tracks if the UI has been built at least once.
void update(float dt) override
Update the scene state.
void onExit(void) override
Called when the scene is exited.
graphics::UiFactory & _uiFactory
UI Factory for creating UI components.
std::size_t _roomsHash
Hash of the last room list displayed.
void onEnter(void) override
Called when the scene is entered.
void handleEvent(const sf::Event &event) override
Handle an incoming event.
std::function< void(GameState)> ChangeStateFn
Type alias for a function that changes the game state.
R-Type client namespace.