← API Reference Class

template<typename TStateId> asge::game::state::IGameState abstract

One node of a game's state stack (menu, gameplay, pause overlay, ...).

#include <GameState.hpp>

GameStateStack owns the traversal: it calls Update() top-down (stopping at the first state whose BlocksUpdateBelow() is true) and Render() bottom-up over however many states RendersBelow() lets show through, dispatching OnSystemEvent() to the topmost state only. OnEnter()/OnExit() bracket a state's time at the top of a Push/Pop/Replace.

Public Member Functions

#virtual ~IGameState()=default
#virtual std::optional< Transition< TStateId > > Update(float inDeltaTime, input::InputState const &inInput)=0

Advances this state by one frame; an engaged result requests a stack transition.

#virtual void Render(video::IRenderer &inRenderer)=0

Draws this state's frame.

#virtual void RenderBackground(video::IRenderer &)

Draws under the scene: called after the clear, before Game draws the ECS scene.

No-op by default.

#virtual graphics::RGBA_Color ClearColor() const noexcept

Background color Game clears the frame with before drawing the scene; opaque black by default.

#virtual void OnSystemEvent(event::SystemEvent const &inSysEvent)=0

Called for every system event while this state is topmost.

#virtual void OnEnter()

Called once when this state becomes topmost via Push/Replace.

#virtual void OnExit()

Called once when this state stops being topmost via Pop/Replace.

#virtual bool BlocksUpdateBelow() const noexcept

True (the default) if states below this one should not receive Update().

#virtual bool RendersBelow() const noexcept

True if this state is drawn over whatever is below it rather than covering it.