1 #ifndef GAME_BATTLES_BATTLECONTROLLER_HPP
2 #define GAME_BATTLES_BATTLECONTROLLER_HPP
88 virtual void onUpdate(
bool viewSynced,
bool queueEmpty) = 0;
91 enum struct SubState : std::uint8_t { WaitingView = 1, Done = 2 };
93 std::queue<Command> commandQueue;
96 bool updateCommandQueue();
Core classes and functionality for both the editor and game.
Convenience struct that owns all the components required for a battle and resolves some boilerplate s...
Interface for battle controllers. Battle controllers manage the flow of state and interaction for bat...
void init(Battle &battle, BattleView &view, BattleState &state)
Sets internal references to the view and state of the battle.
void queueCommand(Command &&command, bool addWait=false)
Enqueues a command to manipulate battle state or the view.
void update()
Updates the processing of the command queue.
BattleController()
Initializes some internal state.
virtual void onCommandQueued(const Command &cmd)=0
Called when a command is first enqueued but not processed. May be used to send commands over the netw...
virtual ~BattleController()=default
Destroy the Battle Controller object.
virtual void onCommandProcessed(const Command &cmd)=0
This is called after a command is processed. Derived classes may perform specific actions for command...
virtual void onUpdate(bool viewSynced, bool queueEmpty)=0
Derived controllers may use this method for update logic every frame.
Stores and represents the current state of a battle. This is the base class for local and remote batt...
This is the top level class for rendering battles. It takes commands and state from a BattleControlle...
Emitted by the BattleFSM. All UI is handled via a queue of commands. Commands are resolved in the ord...