FlowState class

Base class for structural application states.

A FlowState is the top-level context that determines what the engine is doing: main menu, loading screen, in-game, post-match, etc.

States form a stack managed by FlowManagerBase:

  • TransitionTo() — replaces the entire stack with a new state.
  • PushState() — pushes an overlay (e.g. pause menu over gameplay).
  • PopState() — returns to the previous state.

States declare their subsystem needs via GetRequirements(); the manager creates and destroys Worlds, NetSessions, etc. as states transition in/out.

All methods run on the Sentinel (main) thread.

Constructors, destructors, conversion operators

~FlowState() defaulted virtual
FlowState() protected defaulted

Public functions

void OnEnter(FlowManagerBase& flow, WorldBase* world) virtual
void OnExit() virtual
Called when this state is being replaced or popped.
void Tick(SimFloat dt) virtual
Called each Sentinel frame while this state is the top of the stack.
void OnNetEvent(uint8_t eventID) virtual
auto GetRequirements() const -> StateRequirements virtual
Declare what this state needs from the engine.
auto GetName() const -> const char* virtual
Display name for debugging/logging.

Protected variables

FlowManagerBase* Flow

Function documentation

void FlowState::OnEnter(FlowManagerBase& flow, WorldBase* world) virtual

Called when this state becomes active (pushed or transitioned to). world may be nullptr if GetRequirements().NeedsWorld is false.

void FlowState::OnNetEvent(uint8_t eventID) virtual

Called on the Sentinel thread when a net flow event arrives from the NetThread. eventID is a FlowEventID enum value cast to uint8_t.