|
Air-Trap 1.0.0
A multiplayer R-Type clone game engine built with C++23 and ECS architecture
|
Scene for creating a new game room. More...
#include <CreateRoomScene.hpp>
Public Types | |
| using | ChangeStateFn = std::function< void(GameState)> |
| Type alias for a function that changes the game state. | |
Public Member Functions | |
| CreateRoomScene (ecs::Registry &UiRegistry, Settings &settings, TranslationManager &translationManager, NetworkSyncSystem &network, graphics::UiFactory &uiFactory, std::function< void(GameState)> changeState) | |
| Constructor for CreateRoomScene. | |
| void | onEnter (void) override |
| Called when the scene is entered. | |
| void | onExit (void) override |
| Called when the scene is exited. | |
| void | handleEvent (const sf::Event &event) override |
| Handle an incoming event. | |
| void | update (float dt) override |
| Update the scene state. | |
Public Member Functions inherited from rtp::client::interfaces::IScene | |
| virtual | ~IScene (void)=default |
Private Attributes | |
| ecs::Registry & | _uiRegistry |
| Reference to the ECS registry. | |
| Settings & | _settings |
| Reference to the application settings. | |
| TranslationManager & | _translationManager |
| Reference to the translation manager. | |
| NetworkSyncSystem & | _network |
| Reference to the client network. | |
| graphics::UiFactory & | _uiFactory |
| UI Factory for creating UI components. | |
| ChangeStateFn | _changeState |
| Function to change the game state. | |
| std::string | _uiRoomName = "Room" |
| Name of the room to be created. | |
| uint32_t | _uiMaxPlayers = 4 |
| Maximum number of players in the room. | |
| float | _uiDifficulty = 0.5f |
| Difficulty setting for the room. | |
| float | _uiSpeed = 1.0f |
| Game speed setting for the room. | |
| uint32_t | _uiDuration = 10 |
| Duration of the game in minutes. | |
| uint32_t | _uiSeed = 42 |
| Seed for random generation. | |
| uint32_t | _uiLevelId = 1 |
| Level ID for the game. | |
Scene for creating a new game room.
This scene allows players to set up a new game room by specifying parameters such as room name, maximum players, and game settings.
Definition at line 31 of file CreateRoomScene.hpp.
| using rtp::client::scenes::CreateRoomScene::ChangeStateFn = std::function<void(GameState)> |
Type alias for a function that changes the game state.
Definition at line 51 of file CreateRoomScene.hpp.
| rtp::client::scenes::CreateRoomScene::CreateRoomScene | ( | ecs::Registry & | UiRegistry, |
| Settings & | settings, | ||
| TranslationManager & | translationManager, | ||
| NetworkSyncSystem & | network, | ||
| graphics::UiFactory & | uiFactory, | ||
| std::function< void(GameState)> | changeState | ||
| ) |
Constructor for CreateRoomScene.
| registry | Reference to the ECS registry |
| settings | Reference to the application settings |
| network | Reference to the client network |
| window | Reference to the SFML render window |
Definition at line 17 of file CreateRoomScene.cpp.
|
overridevirtual |
Handle an incoming event.
| event | The event to handle. |
Implements rtp::client::interfaces::IScene.
Definition at line 165 of file CreateRoomScene.cpp.
|
overridevirtual |
Called when the scene is entered.
Implements rtp::client::interfaces::IScene.
Definition at line 32 of file CreateRoomScene.cpp.
References _changeState, _network, _uiDifficulty, _uiDuration, _uiFactory, _uiLevelId, _uiMaxPlayers, _uiRegistry, _uiRoomName, _uiSeed, _uiSpeed, rtp::client::graphics::UiFactory::createButton(), rtp::client::graphics::UiFactory::createDropdown(), rtp::client::graphics::UiFactory::createSlider(), rtp::client::graphics::UiFactory::createText(), rtp::client::graphics::UiFactory::createTextInput(), rtp::log::info(), rtp::client::Lobby, rtp::net::Public, and rtp::client::NetworkSyncSystem::tryCreateRoom().
|
overridevirtual |
Called when the scene is exited.
Implements rtp::client::interfaces::IScene.
Definition at line 160 of file CreateRoomScene.cpp.
References rtp::log::info().
|
overridevirtual |
Update the scene state.
| dt | Time delta since the last update. |
Implements rtp::client::interfaces::IScene.
Definition at line 170 of file CreateRoomScene.cpp.
References _changeState, _network, rtp::client::NetworkSyncSystem::getState(), rtp::client::NetworkSyncSystem::InGame, rtp::client::NetworkSyncSystem::InRoom, rtp::client::Playing, and rtp::client::RoomWaiting.
|
private |
Function to change the game state.
Definition at line 81 of file CreateRoomScene.hpp.
|
private |
Reference to the client network.
Definition at line 79 of file CreateRoomScene.hpp.
|
private |
Reference to the application settings.
Definition at line 77 of file CreateRoomScene.hpp.
|
private |
Reference to the translation manager.
Definition at line 78 of file CreateRoomScene.hpp.
|
private |
Difficulty setting for the room.
Definition at line 85 of file CreateRoomScene.hpp.
Referenced by onEnter().
|
private |
Duration of the game in minutes.
Definition at line 87 of file CreateRoomScene.hpp.
Referenced by onEnter().
|
private |
UI Factory for creating UI components.
Definition at line 80 of file CreateRoomScene.hpp.
Referenced by onEnter().
|
private |
|
private |
Maximum number of players in the room.
Definition at line 84 of file CreateRoomScene.hpp.
Referenced by onEnter().
|
private |
Reference to the ECS registry.
Definition at line 76 of file CreateRoomScene.hpp.
Referenced by onEnter().
|
private |
Name of the room to be created.
Definition at line 83 of file CreateRoomScene.hpp.
Referenced by onEnter().
|
private |
Seed for random generation.
Definition at line 88 of file CreateRoomScene.hpp.
Referenced by onEnter().
|
private |
Game speed setting for the room.
Definition at line 86 of file CreateRoomScene.hpp.
Referenced by onEnter().