bn::sprite_tiles_item class

Contains the required information to generate sprite tiles.

The assets conversion tools generate an object of this type in the build folder for each *.bmp file with sprite type.

The tiles are not copied but referenced, so they should outlive the sprite_tiles_item to avoid dangling references.

Public static functions

static auto valid_tiles_count(int tiles_count, bpp_mode bpp) -> bool constexpr
Indicates if the specified tiles count are valid for the specified bits per pixel or not.

Constructors, destructors, conversion operators

sprite_tiles_item(const span<const tile>& tiles_ref, bpp_mode bpp) constexpr
Constructor.
sprite_tiles_item(const span<const tile>& tiles_ref, bpp_mode bpp, compression_type compression) constexpr
Constructor.
sprite_tiles_item(const span<const tile>& tiles_ref, bpp_mode bpp, int graphics_count) constexpr
Constructor.
sprite_tiles_item(const span<const tile>& tiles_ref, bpp_mode bpp, compression_type compression, int graphics_count) constexpr
Constructor.

Public functions

auto tiles_ref() const -> const span<const tile>& constexpr
Returns the reference to one or more sprite tile sets.
auto bpp() const -> bpp_mode constexpr
Returns the bits per pixel of the referenced tiles.
auto graphics_count() const -> int constexpr
Returns the number of sprite tile sets contained in tiles_ref.
auto tiles_count_per_graphic() const -> int constexpr
Returns the number of sprite tiles contained in each sprite tile set.
auto graphics_tiles_ref() const -> span<const tile> constexpr
Returns the reference to the first sprite tile set.
auto graphics_tiles_ref(int graphics_index) const -> span<const tile> constexpr
Returns the reference to the sprite tile set indicated by graphics_index.
auto compression() const -> compression_type constexpr
Returns the compression type.
auto uncompress(span<tile> uncompressed_tiles_ref) const -> sprite_tiles_item
Uncompresses the stored data in the tiles referenced by uncompressed_tiles_ref.
auto find_tiles() const -> optional<sprite_tiles_ptr>
Searches for a sprite_tiles_ptr which references the first sprite tile set.
auto find_tiles(int graphics_index) const -> optional<sprite_tiles_ptr>
Searches for a sprite_tiles_ptr which references the sprite tile set indicated by graphics_index.
auto create_tiles() const -> sprite_tiles_ptr
Searches for a sprite_tiles_ptr which references the first sprite tile set. If it is not found, it creates a sprite_tiles_ptr which references it.
auto create_tiles(int graphics_index) const -> sprite_tiles_ptr
Searches for a sprite_tiles_ptr which references the sprite tile set indicated by graphics_index. If it is not found, it creates a sprite_tiles_ptr which references it.
auto create_new_tiles() const -> sprite_tiles_ptr
Creates a new sprite_tiles_ptr which references the first sprite tile set.
auto create_new_tiles(int graphics_index) const -> sprite_tiles_ptr
Creates a new sprite_tiles_ptr which references the sprite tile set indicated by graphics_index.
auto create_tiles_optional() const -> optional<sprite_tiles_ptr>
Searches for a sprite_tiles_ptr which references the first sprite tile set. If it is not found, it creates a sprite_tiles_ptr which references it.
auto create_tiles_optional(int graphics_index) const -> optional<sprite_tiles_ptr>
Searches for a sprite_tiles_ptr which references the sprite tile set indicated by graphics_index. If it is not found, it creates a sprite_tiles_ptr which references it.
auto create_new_tiles_optional() const -> optional<sprite_tiles_ptr>
Creates a new sprite_tiles_ptr which references the first sprite tile set.
auto create_new_tiles_optional(int graphics_index) const -> optional<sprite_tiles_ptr>
Creates a new sprite_tiles_ptr which references the sprite tile set indicated by graphics_index.

Friends

auto operator==(const sprite_tiles_item& a, const sprite_tiles_item& b) -> friend bool constexpr
Equal operator.
auto operator!=(const sprite_tiles_item& a, const sprite_tiles_item& b) -> friend bool constexpr
Not equal operator.

Function documentation

bn::sprite_tiles_item::sprite_tiles_item(const span<const tile>& tiles_ref, bpp_mode bpp) constexpr

Constructor.

Parameters
tiles_ref Reference to one or more sprite tile sets.
bpp tiles_ref bits per pixel.

The tiles are not copied but referenced, so they should outlive the sprite_tiles_item to avoid dangling references.

bn::sprite_tiles_item::sprite_tiles_item(const span<const tile>& tiles_ref, bpp_mode bpp, compression_type compression) constexpr

Constructor.

Parameters
tiles_ref Reference to one or more sprite tile sets.
bpp tiles_ref bits per pixel.
compression Compression type.

The tiles are not copied but referenced, so they should outlive the sprite_tiles_item to avoid dangling references.

bn::sprite_tiles_item::sprite_tiles_item(const span<const tile>& tiles_ref, bpp_mode bpp, int graphics_count) constexpr

Constructor.

Parameters
tiles_ref Reference to one or more sprite tile sets.
bpp tiles_ref bits per pixel.
graphics_count Number of sprite tile sets contained in tiles_ref.

The tiles are not copied but referenced, so they should outlive the sprite_tiles_item to avoid dangling references.

bn::sprite_tiles_item::sprite_tiles_item(const span<const tile>& tiles_ref, bpp_mode bpp, compression_type compression, int graphics_count) constexpr

Constructor.

Parameters
tiles_ref Reference to one or more sprite tile sets.
bpp tiles_ref bits per pixel.
compression Compression type.
graphics_count Number of sprite tile sets contained in tiles_ref.

The tiles are not copied but referenced, so they should outlive the sprite_tiles_item to avoid dangling references.

const span<const tile>& bn::sprite_tiles_item::tiles_ref() const constexpr

Returns the reference to one or more sprite tile sets.

The tiles are not copied but referenced, so they should outlive the sprite_tiles_item to avoid dangling references.

sprite_tiles_item bn::sprite_tiles_item::uncompress(span<tile> uncompressed_tiles_ref) const

Uncompresses the stored data in the tiles referenced by uncompressed_tiles_ref.

Parameters
uncompressed_tiles_ref Destination of the uncompressed tiles.
Returns A sprite_tiles_item pointing to the uncompressed tiles.

If the source and destination tiles overlap, the behavior is undefined.

optional<sprite_tiles_ptr> bn::sprite_tiles_item::find_tiles() const

Searches for a sprite_tiles_ptr which references the first sprite tile set.

Returns sprite_tiles_ptr which references the first sprite tile set if it has been found; bn::nullopt otherwise.

optional<sprite_tiles_ptr> bn::sprite_tiles_item::find_tiles(int graphics_index) const

Searches for a sprite_tiles_ptr which references the sprite tile set indicated by graphics_index.

Parameters
graphics_index Index of the tile set to search.
Returns sprite_tiles_ptr which references the indicated sprite tile set if it has been found; bn::nullopt otherwise.

sprite_tiles_ptr bn::sprite_tiles_item::create_tiles() const

Searches for a sprite_tiles_ptr which references the first sprite tile set. If it is not found, it creates a sprite_tiles_ptr which references it.

Returns sprite_tiles_ptr which references the first sprite tile set if it has been found; otherwise it returns a sprite_tiles_ptr which references it.

The tiles are not copied but referenced, so they should outlive the sprite_tiles_ptr to avoid dangling references.

sprite_tiles_ptr bn::sprite_tiles_item::create_tiles(int graphics_index) const

Searches for a sprite_tiles_ptr which references the sprite tile set indicated by graphics_index. If it is not found, it creates a sprite_tiles_ptr which references it.

Parameters
graphics_index Index of the tile set to search or handle.
Returns sprite_tiles_ptr which references the sprite tile set indicated by graphics_index if it has been found; otherwise it returns a sprite_tiles_ptr which references it.

The tiles are not copied but referenced, so they should outlive the sprite_tiles_ptr to avoid dangling references.

sprite_tiles_ptr bn::sprite_tiles_item::create_new_tiles() const

Creates a new sprite_tiles_ptr which references the first sprite tile set.

Returns sprite_tiles_ptr which references the first sprite tile set.

The sprite tiles system does not support multiple sprite_tiles_ptr items referencing to the same tiles. If you are not sure if the given tiles are already referenced or not, you should use create_tiles methods.

The tiles are not copied but referenced, so they should outlive the sprite_tiles_ptr to avoid dangling references.

sprite_tiles_ptr bn::sprite_tiles_item::create_new_tiles(int graphics_index) const

Creates a new sprite_tiles_ptr which references the sprite tile set indicated by graphics_index.

Parameters
graphics_index Index of the tile set to reference.
Returns sprite_tiles_ptr which references the sprite tile set indicated by graphics_index.

The sprite tiles system does not support multiple sprite_tiles_ptr items referencing to the same tiles. If you are not sure if the given tiles are already referenced or not, you should use create_tiles methods.

The tiles are not copied but referenced, so they should outlive the sprite_tiles_ptr to avoid dangling references.

optional<sprite_tiles_ptr> bn::sprite_tiles_item::create_tiles_optional() const

Searches for a sprite_tiles_ptr which references the first sprite tile set. If it is not found, it creates a sprite_tiles_ptr which references it.

Returns sprite_tiles_ptr which references the first sprite tile set if it has been found; otherwise it returns a new sprite_tiles_ptr which references it if it could be allocated; bn::nullopt otherwise.

The tiles are not copied but referenced, so they should outlive the sprite_tiles_ptr to avoid dangling references.

optional<sprite_tiles_ptr> bn::sprite_tiles_item::create_tiles_optional(int graphics_index) const

Searches for a sprite_tiles_ptr which references the sprite tile set indicated by graphics_index. If it is not found, it creates a sprite_tiles_ptr which references it.

Parameters
graphics_index Index of the tile set to search or handle.
Returns sprite_tiles_ptr which references the sprite tile set indicated by graphics_index if it has been found; otherwise it returns a new sprite_tiles_ptr which references it if it could be allocated; bn::nullopt otherwise.

The tiles are not copied but referenced, so they should outlive the sprite_tiles_ptr to avoid dangling references.

optional<sprite_tiles_ptr> bn::sprite_tiles_item::create_new_tiles_optional() const

Creates a new sprite_tiles_ptr which references the first sprite tile set.

Returns sprite_tiles_ptr which references the first sprite tile set if it could be allocated; bn::nullopt otherwise.

The sprite tiles system does not support multiple sprite_tiles_ptr items referencing to the same tiles. If you are not sure if the given tiles are already referenced or not, you should use create_tiles methods.

The tiles are not copied but referenced, so they should outlive the sprite_tiles_ptr to avoid dangling references.

optional<sprite_tiles_ptr> bn::sprite_tiles_item::create_new_tiles_optional(int graphics_index) const

Creates a new sprite_tiles_ptr which references the sprite tile set indicated by graphics_index.

Parameters
graphics_index Index of the tile set to reference.
Returns sprite_tiles_ptr which references the sprite tile set indicated by graphics_index if it could be allocated; bn::nullopt otherwise.

The sprite tiles system does not support multiple sprite_tiles_ptr items referencing to the same tiles. If you are not sure if the given tiles are already referenced or not, you should use create_tiles methods.

The tiles are not copied but referenced, so they should outlive the sprite_tiles_ptr to avoid dangling references.

friend bool operator==(const sprite_tiles_item& a, const sprite_tiles_item& b) constexpr

Equal operator.

Parameters
a First sprite_tiles_item to compare.
b Second sprite_tiles_item to compare.
Returns true if the first sprite_tiles_item is equal to the second one, otherwise false.

friend bool operator!=(const sprite_tiles_item& a, const sprite_tiles_item& b) constexpr

Not equal operator.

Parameters
a First sprite_tiles_item to compare.
b Second sprite_tiles_item to compare.
Returns true if the first sprite_tiles_item is not equal to the second one, otherwise false.