bn::regular_bg_tiles_item class

Contains the required information to generate regular background tiles.

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

The tiles are not copied but referenced, so they should outlive the regular_bg_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

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

Public functions

auto tiles_ref() const -> const span<const tile>& constexpr
Returns the reference to one or more background tiles.
auto bpp() const -> bpp_mode constexpr
Returns the bits per pixel of the referenced tiles.
auto compression() const -> compression_type constexpr
Returns the compression type.
auto decompress(span<tile> decompressed_tiles_ref) const -> regular_bg_tiles_item
Decompresses the stored data in the tiles referenced by decompressed_tiles_ref.
auto find_tiles() const -> optional<regular_bg_tiles_ptr>
Searches for a regular_bg_tiles_ptr which reference the background tiles.
auto create_tiles() const -> regular_bg_tiles_ptr
Searches for a regular_bg_tiles_ptr which reference the background tiles. If they are not found, it creates a regular_bg_tiles_ptr which reference them.
auto create_new_tiles() const -> regular_bg_tiles_ptr
Creates a new regular_bg_tiles_ptr which reference the background tiles.
auto create_tiles_optional() const -> optional<regular_bg_tiles_ptr>
Searches for a regular_bg_tiles_ptr which reference the background tiles. If they are not found, it creates a regular_bg_tiles_ptr which reference them.
auto create_new_tiles_optional() const -> optional<regular_bg_tiles_ptr>
Creates a new regular_bg_tiles_ptr which reference the background tiles.

Friends

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

Function documentation

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

Constructor.

Parameters
tiles_ref Reference to one or more background tiles.
bpp tiles_ref bits per pixel.

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

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

Constructor.

Parameters
tiles_ref Reference to one or more background tiles.
bpp tiles_ref bits per pixel.
compression Compression type.

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

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

Returns the reference to one or more background tiles.

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

regular_bg_tiles_item bn::regular_bg_tiles_item::decompress(span<tile> decompressed_tiles_ref) const

Decompresses the stored data in the tiles referenced by decompressed_tiles_ref.

Parameters
decompressed_tiles_ref Destination of the decompressed tiles.
Returns A regular_bg_tiles_item pointing to the decompressed tiles.

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

optional<regular_bg_tiles_ptr> bn::regular_bg_tiles_item::find_tiles() const

Searches for a regular_bg_tiles_ptr which reference the background tiles.

Returns regular_bg_tiles_ptr which reference the background tiles if they have been found; bn::nullopt otherwise.

regular_bg_tiles_ptr bn::regular_bg_tiles_item::create_tiles() const

Searches for a regular_bg_tiles_ptr which reference the background tiles. If they are not found, it creates a regular_bg_tiles_ptr which reference them.

Returns regular_bg_tiles_ptr which reference the background tiles if they have been found; otherwise it returns a regular_bg_tiles_ptr which reference them.

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

regular_bg_tiles_ptr bn::regular_bg_tiles_item::create_new_tiles() const

Creates a new regular_bg_tiles_ptr which reference the background tiles.

Returns regular_bg_tiles_ptr which reference the background tiles.

The background tiles system does not support multiple regular_bg_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 regular_bg_tiles_ptr to avoid dangling references.

optional<regular_bg_tiles_ptr> bn::regular_bg_tiles_item::create_tiles_optional() const

Searches for a regular_bg_tiles_ptr which reference the background tiles. If they are not found, it creates a regular_bg_tiles_ptr which reference them.

Returns regular_bg_tiles_ptr which reference the background tiles if they have been found; otherwise it returns a new regular_bg_tiles_ptr which reference them if it could be allocated; bn::nullopt otherwise.

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

optional<regular_bg_tiles_ptr> bn::regular_bg_tiles_item::create_new_tiles_optional() const

Creates a new regular_bg_tiles_ptr which reference the background tiles.

Returns regular_bg_tiles_ptr which reference the background tiles if it could be allocated; bn::nullopt otherwise.

The background tiles system does not support multiple regular_bg_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 regular_bg_tiles_ptr to avoid dangling references.

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

Equal operator.

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

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

Not equal operator.

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