R-Type 0.1
Loading...
Searching...
No Matches
rtype::server::ServerGameScene Class Reference

Round in progress: simulates the stage and returns to the lobby when every player left. More...

#include <Scene/serverGameScene.hpp>

Public Member Functions

 ServerGameScene (ServerDependency &dep)
 Creates the scene.
 
void onEnter (rtk::EngineContext &context)
 Builds the stage and sends every entity to the players.
 
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.
 
void onExit (rtk::EngineContext &context)
 Destroys every entity and resets the game state.
 

Static Public Attributes

static constexpr ServerSceneType Type = ServerSceneType::InGame
 Identifier of this scene.
 

Detailed Description

Round in progress: simulates the stage and returns to the lobby when every player left.

Constructor & Destructor Documentation

◆ ServerGameScene()

rtype::server::ServerGameScene::ServerGameScene ( ServerDependency & dep)

Creates the scene.

Parameters
depGame that owns the scene.

Member Function Documentation

◆ onEnter()

void rtype::server::ServerGameScene::onEnter ( rtk::EngineContext & context)

Builds the stage and sends every entity to the players.

Parameters
contextEngine services.

◆ onUpdate()

std::optional< ServerSceneType > rtype::server::ServerGameScene::onUpdate ( rtk::EngineContext & context,
const ServerInput & input,
float dt )

Processes network events, advances the tick and sends a snapshot every 3 ticks.

Parameters
contextEngine services.
inputUnused.
dtElapsed time since the last frame, in seconds.
Returns
The next scene, or std::nullopt to stay.

◆ onExit()

void rtype::server::ServerGameScene::onExit ( rtk::EngineContext & context)

Destroys every entity and resets the game state.

Parameters
contextEngine services.