template<int MaxSize>
bn::sprite_animate_action class

Changes the tile set of a sprite_ptr when the action is updated a given number of times.

Template parameters
MaxSize Maximum number of indexes to sprite tile sets to store.

Each time the tile set of a sprite_ptr must be changed, it is searched for and created if it has not been found, so the tile sets are not cached.

Public static functions

static auto once(const sprite_ptr& sprite, int wait_updates, const sprite_tiles_item& tiles_item, const span<const uint16_t>& graphics_indexes) -> sprite_animate_action
Generates a sprite_animate_action which loops over the given sprite tile sets only once.
static auto once(sprite_ptr&& sprite, int wait_updates, const sprite_tiles_item& tiles_item, const span<const uint16_t>& graphics_indexes) -> sprite_animate_action
Generates a sprite_animate_action which loops over the given sprite tile sets only once.
static auto forever(const sprite_ptr& sprite, int wait_updates, const sprite_tiles_item& tiles_item, const span<const uint16_t>& graphics_indexes) -> sprite_animate_action
Generates a sprite_animate_action which loops over the given sprite tile sets forever.
static auto forever(sprite_ptr&& sprite, int wait_updates, const sprite_tiles_item& tiles_item, const span<const uint16_t>& graphics_indexes) -> sprite_animate_action
Generates a sprite_animate_action which loops over the given sprite tile sets forever.

Public functions

void update()
Changes the tile set of the given sprite_ptr when the given amount of update calls are done.
auto done() const -> bool
Indicates if the action must not be updated anymore.
auto sprite() const -> const sprite_ptr&
Returns the sprite_ptr to modify.
auto wait_updates() const -> int
Returns the number of times the action must be updated before changing the tiles of the given sprite_ptr.
auto tiles_item() const -> const sprite_tiles_item&
Returns the sprite_tiles_item used to create the new sprite tiles to use by the given sprite_ptr.
auto graphics_indexes() const -> const ivector<uint16_t>&
Returns the indexes of the tile sets to reference in the given sprite_tiles_item.
auto update_forever() const -> bool
Indicates if the action can be updated forever or not.
auto current_index() const -> int
Returns the current index of the given graphics_indexes (not the current index of the tile set to reference in the given tiles_item).

Function documentation

template<int MaxSize>
static sprite_animate_action bn::sprite_animate_action<MaxSize>::once(const sprite_ptr& sprite, int wait_updates, const sprite_tiles_item& tiles_item, const span<const uint16_t>& graphics_indexes)

Generates a sprite_animate_action which loops over the given sprite tile sets only once.

Parameters
sprite sprite_ptr to copy.
wait_updates Number of times the action must be updated before changing the tiles of the given sprite_ptr.
tiles_item It creates the new sprite tiles to use by the given sprite_ptr.
graphics_indexes Indexes of the tile sets to reference in tiles_item.
Returns The requested sprite_animate_action.

template<int MaxSize>
static sprite_animate_action bn::sprite_animate_action<MaxSize>::once(sprite_ptr&& sprite, int wait_updates, const sprite_tiles_item& tiles_item, const span<const uint16_t>& graphics_indexes)

Generates a sprite_animate_action which loops over the given sprite tile sets only once.

Parameters
sprite sprite_ptr to move.
wait_updates Number of times the action must be updated before changing the tiles of the given sprite_ptr.
tiles_item It creates the new sprite tiles to use by the given sprite_ptr.
graphics_indexes Indexes of the tile sets to reference in the given sprite_tiles_item.
Returns The requested sprite_animate_action.

template<int MaxSize>
static sprite_animate_action bn::sprite_animate_action<MaxSize>::forever(const sprite_ptr& sprite, int wait_updates, const sprite_tiles_item& tiles_item, const span<const uint16_t>& graphics_indexes)

Generates a sprite_animate_action which loops over the given sprite tile sets forever.

Parameters
sprite sprite_ptr to copy.
wait_updates Number of times the action must be updated before changing the tiles of the given sprite_ptr.
tiles_item It creates the new sprite tiles to use by the given sprite_ptr.
graphics_indexes Indexes of the tile sets to reference in the given sprite_tiles_item.
Returns The requested sprite_animate_action.

template<int MaxSize>
static sprite_animate_action bn::sprite_animate_action<MaxSize>::forever(sprite_ptr&& sprite, int wait_updates, const sprite_tiles_item& tiles_item, const span<const uint16_t>& graphics_indexes)

Generates a sprite_animate_action which loops over the given sprite tile sets forever.

Parameters
sprite sprite_ptr to move.
wait_updates Number of times the action must be updated before changing the tiles of the given sprite_ptr.
tiles_item It creates the new sprite tiles to use by the given sprite_ptr.
graphics_indexes Indexes of the tile sets to reference in the given sprite_tiles_item.
Returns The requested sprite_animate_action.