R-Type 0.1
Loading...
Searching...
No Matches
serverLobbyScene.hpp
1#pragma once
2
3#include "sceneManager/sceneConcept.hpp"
4#include "serverScene.hpp"
5#include <optional>
6
7namespace rtype::server {
18public:
21
27
32 void onEnter(rtk::EngineContext &context);
33
42 std::optional<ServerSceneType> onUpdate(rtk::EngineContext &context,
43 const ServerInput &input, float dt);
44
49 void onExit(rtk::EngineContext &context);
50
51private:
52 ServerDependency &_dependency;
53 float _lobbyTimer = 0.0f;
54 int _lastPrintedCountdown = -1;
55};
56
58} // namespace rtype::server
Waiting room: starts the round with 2 players, or after 30 seconds with 1 player.
Definition serverLobbyScene.hpp:17
void onEnter(rtk::EngineContext &context)
Resets the lobby timer.
Definition serverLobbyScene.cpp:12
static constexpr ServerSceneType Type
Identifier of this scene.
Definition serverLobbyScene.hpp:20
std::optional< ServerSceneType > onUpdate(rtk::EngineContext &context, const ServerInput &input, float dt)
Processes network events and starts the round when the conditions are met.
Definition serverLobbyScene.cpp:22
ServerLobbyScene(ServerDependency &dep)
Creates the scene.
Definition serverLobbyScene.cpp:9
void onExit(rtk::EngineContext &context)
Does nothing.
Definition serverLobbyScene.cpp:68
ServerSceneType
Identifiers of the server scenes.
Definition serverScene.hpp:14
@ Lobby
Waiting for players.
Engine services handed to the game and its scenes.
Definition EngineContext.hpp:20
Object passed to every server scene constructor.
Definition serverScene.hpp:28
Input passed to server scenes, empty because inputs come from the network.
Definition serverScene.hpp:23