Raylib Bubbles
C++11 Raylib bubble shooter game.
|
Manages game actions and allows them to interact with the game board if necessary. More...
#include <action.hpp>
Classes | |
struct | ActionType |
Represents an action to be taken by the game. More... | |
struct | AnimState |
Represents the state of an object to be animated. More... | |
Public Member Functions | |
GameActionMgr (PlacedBoard &boardData) | |
Constructs a GameActionMgr object with the given dimensions and a reference to the game board. More... | |
Iterator methods for sequential access to animation states. | |
std::vector< ActionType >::iterator | begin () |
Builds an iterator to the beginning of the actions container. More... | |
std::vector< ActionType >::iterator | end () |
Builds an iterator to the end of the actions container. More... | |
General methods. | |
size_t | size () const |
Returns the number of actions currently in the manager. More... | |
Action management methods. | |
size_t | enqueue (ActionType action) |
Adds an action to the manager. More... | |
void | step (const float scale=1.0f) |
Steps all managed actions forward, by calling their step() methods. More... | |
void | prune () |
Prunes all actions that are no longer needed, using their shouldPrune() methods. More... | |
bool | find (const size_t id) const |
Checks if an action is still ongoing (was not pruned). More... | |
Manages game actions and allows them to interact with the game board if necessary.
This class allows management of game actions (animations that can reference the board) through a simple interface, making it straightforward to add, step and prune actions.
GameActionMgr::GameActionMgr | ( | PlacedBoard & | boardData | ) |
Constructs a GameActionMgr object with the given dimensions and a reference to the game board.
boardData | A reference to the placed game board object, which wraps the board dimensions with a board reference. |
|
inline |
Builds an iterator to the beginning of the actions container.
|
inline |
Builds an iterator to the end of the actions container.
size_t GameActionMgr::enqueue | ( | ActionType | action | ) |
Adds an action to the manager.
action | The action to be added. |
bool GameActionMgr::find | ( | const size_t | id | ) | const |
Checks if an action is still ongoing (was not pruned).
id | The id of the previously enqueued action to check. |
void GameActionMgr::prune | ( | ) |
Prunes all actions that are no longer needed, using their shouldPrune() methods.
size_t GameActionMgr::size | ( | ) | const |
Returns the number of actions currently in the manager.
void GameActionMgr::step | ( | const float | scale = 1.0f | ) |
Steps all managed actions forward, by calling their step() methods.
scale | The scale to step the actions by, for delta time calculations. |