R-Type 0.1
Loading...
Searching...
No Matches
serverGameScene.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};
54
56} // namespace rtype::server
Round in progress: simulates the stage and returns to the lobby when every player left.
Definition serverGameScene.hpp:17
void onEnter(rtk::EngineContext &context)
Builds the stage and sends every entity to the players.
Definition serverGameScene.cpp:11
void onExit(rtk::EngineContext &context)
Destroys every entity and resets the game state.
Definition serverGameScene.cpp:48
ServerGameScene(ServerDependency &dep)
Creates the scene.
Definition serverGameScene.cpp:9
static constexpr ServerSceneType Type
Identifier of this scene.
Definition serverGameScene.hpp:20
std::optional< ServerSceneType > onUpdate(rtk::EngineContext &context, const ServerInput &input, float dt)
Processes network events, advances the tick and sends a snapshot every 3 ticks.
Definition serverGameScene.cpp:24
ServerSceneType
Identifiers of the server scenes.
Definition serverScene.hpp:14
@ InGame
Round in progress.
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