4#include "flint/graphics/renderer.h"
5#include "flint/window/IWindow.h"
22 virtual ~State() =
default;
35 virtual void update(
float deltaTime) = 0;
62 std::string m_contextName;
160 const std::vector<std::unique_ptr<State>> &
getStates()
const;
183 std::vector<std::unique_ptr<State>> m_states;
184 std::deque<PendingTransition> m_transitionQueue;
High-level SDL GPU renderer managing pipeline state, batching, and frame presentation.
Abstract interface for a platform window.
void applyTransitions()
Execute all pending transitions in FIFO order.
void replaceState(std::unique_ptr< State > state)
Replace the current state with a new one.
State * currentState() const
Get currently active (top) state.
void pushState(std::unique_ptr< State > state)
Push a new state onto the stack and activate it.
State * peekBelow(const State *top) const
Return the state directly below top on the stack.
void popState()
Pop the current state and resume the one beneath.
void queueTransition(TransitionType type, std::unique_ptr< State > newState)
Enqueue a state transition to be applied on the next applyTransitions() call.
const std::vector< std::unique_ptr< State > > & getStates() const
Return read-only access to the full state deque.
bool empty() const
Check if there are any states in the stack.
TransitionType
Describes the kind of stack operation to perform on transition.
void renderAllBelow(GPURenderer &gpuRenderer, IWindow &window, State *topState) const
Render all states below topState in bottom-up order.
Manages a stack of States and applies queued transitions.
void clearStates()
Remove all states from the stack, calling onExit() on each.
virtual void update(float deltaTime)=0
Advance the simulation logic for this state by deltaTime seconds.
virtual void onExit()
Called immediately before this state is removed from the top of the stack.
virtual void onEnter()
Called immediately after this state becomes the top of the stack.
virtual void render(GPURenderer &gpuRenderer, IWindow &window)=0
Issue all draw calls necessary to visualize this state.
virtual void handleInput(IWindow &window)=0
Process raw input events and translate them into state-specific actions.
Abstract base for a single game state (scene / screen).
std::unique_ptr< State > state
Transition description queued for later application.