Skip to main content

GameStateInputResponseSystem Class

Responds to gamepad input and issues game state commands. More...

Declaration

class helios::engine::mechanics::gamestate::systems::GameStateInputResponseSystem { ... }

Base class

classSystem

Abstract base class for game systems. More...

Public Member Functions Index

voidupdate (helios::engine::runtime::world::UpdateContext &updateContext) noexcept override

Processes input and submits state transition commands. More...

Description

Responds to gamepad input and issues game state commands.

Listens for the Start button and triggers appropriate state transitions based on the current game state (e.g., Title -> Running, Running -> Paused).

Definition at line 33 of file GameStateInputResponseSystem.ixx.

Public Member Functions

update()

void helios::engine::mechanics::gamestate::systems::GameStateInputResponseSystem::update (helios::engine::runtime::world::UpdateContext & updateContext)
inline noexcept virtual

Processes input and submits state transition commands.

Parameters
updateContext

The current update context.

Definition at line 44 of file GameStateInputResponseSystem.ixx.

44 void update(helios::engine::runtime::world::UpdateContext& updateContext) noexcept override {
45
46 auto gameState = updateContext.gameWorld().session().state<GameState>();
47
48 if (updateContext.inputSnapshot().gamepadState().isButtonPressed(GamepadInput::Start)) {
49
50 switch (gameState) {
52 updateContext.commandBuffer().add<StateCommand<GameState>>(
54 );
55 break;
56
58 updateContext.commandBuffer().add<StateCommand<GameState>>(
60 );
61 break;
62
63 default:
64 break;
65 }
66 }
67
68 }

References helios::engine::mechanics::gamestate::types::Running, helios::input::types::Start, helios::engine::mechanics::gamestate::types::StartRequested, helios::engine::mechanics::gamestate::types::Title and helios::engine::mechanics::gamestate::types::TogglePause.


The documentation for this class was generated from the following file:


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.