|
Flint Engine
Modular C++20 2D game engine powered by SDL3
|
Manages a stack of States and applies queued transitions. More...
#include <flint/core/state.h>
Collaboration diagram for Flint::StateManager:Classes | |
| struct | PendingTransition |
| Transition description queued for later application. More... | |
Public Types | |
| enum class | TransitionType { PUSH , POP , REPLACE , CLEAR } |
| Describes the kind of stack operation to perform on transition. More... | |
Public Member Functions | |
| void | pushState (std::unique_ptr< State > state) |
| Push a new state onto the stack and activate it. | |
| void | popState () |
| Pop the current state and resume the one beneath. | |
| void | replaceState (std::unique_ptr< State > state) |
| Replace the current state with a new one. | |
| State * | currentState () const |
| Get currently active (top) state. | |
| bool | empty () const |
| Check if there are any states in the stack. | |
| void | queueTransition (TransitionType type, std::unique_ptr< State > newState) |
| Enqueue a state transition to be applied on the next applyTransitions() call. | |
| void | applyTransitions () |
| Execute all pending transitions in FIFO order. | |
| void | clearStates () |
| Remove all states from the stack, calling onExit() on each. | |
| const std::vector< std::unique_ptr< State > > & | getStates () const |
| Return read-only access to the full state deque. | |
| void | renderAllBelow (GPURenderer &gpuRenderer, IWindow &window, State *topState) const |
Render all states below topState in bottom-up order. | |
| State * | peekBelow (const State *top) const |
Return the state directly below top on the stack. | |
Manages a stack of States and applies queued transitions.
Transitions are deferred: call queueTransition() any time during a frame and the actual push/pop/replace will happen when applyTransitions() is called (typically once per frame before update/render).