class
#include <bn_regular_bg_tiles_ptr.h>
regular_bg_tiles_ptr std::shared_ptr like smart pointer that retains shared ownership of the tiles of a regular background.
Several regular_
The background tiles are released when the last remaining regular_
The tiles are not copied but referenced, so they should outlive the regular_
Public static functions
-
static auto find(const regular_
bg_ tiles_ item& tiles_item) -> optional<regular_ bg_ tiles_ ptr> - Searches for a regular_
bg_ tiles_ ptr which references the given tiles. -
static auto create(const regular_
bg_ tiles_ item& tiles_item) -> regular_ bg_ tiles_ ptr - Searches for a regular_
bg_ tiles_ ptr which references the given tiles. If it is not found, it creates a regular_ bg_ tiles_ ptr which references them. -
static auto allocate(int tiles_count,
bpp_
mode bpp) -> regular_ bg_ tiles_ ptr - Creates a regular_
bg_ tiles_ ptr which references a chunk of VRAM tiles not visible on the screen. -
static auto create_optional(const regular_
bg_ tiles_ item& tiles_item) -> optional<regular_ bg_ tiles_ ptr> - Searches for a regular_
bg_ tiles_ ptr which references the given tiles. If it is not found, it creates a regular_ bg_ tiles_ ptr which references them. -
static auto allocate_optional(int tiles_count,
bpp_
mode bpp) -> optional<regular_ bg_ tiles_ ptr> - Creates a regular_
bg_ tiles_ ptr which references a chunk of VRAM tiles not visible on the screen.
Constructors, destructors, conversion operators
-
regular_bg_tiles_ptr(const regular_
bg_ tiles_ ptr& other) - Copy constructor.
-
regular_bg_tiles_ptr(regular_
bg_ tiles_ ptr&& other) noexcept - Move constructor.
- ~regular_bg_tiles_ptr()
- Releases the referenced background tiles if no more regular_
bg_ tiles_ ptr objects reference to them.
Public functions
-
auto operator=(const regular_
bg_ tiles_ ptr& other) -> regular_ bg_ tiles_ ptr& - Copy assignment operator.
-
auto operator=(regular_
bg_ tiles_ ptr&& other) -> regular_ bg_ tiles_ ptr& noexcept - Move assignment operator.
- auto id() const -> int
- Returns the internal id.
- auto cbb() const -> int
- Returns the character base block of the referenced tiles.
- auto tiles_count() const -> int
- Returns the referenced number of tiles.
-
auto compression() const -> compression_
type - Returns the compression of the referenced tiles.
- auto tiles_ref() const -> optional<span<const tile>>
- Returns the referenced tiles unless it was created with allocate or allocate_optional. In that case, it returns bn::
nullopt. -
void set_tiles_ref(const regular_
bg_ tiles_ item& tiles_item) - Sets the tiles to handle.
- void reload_tiles_ref()
- Uploads the referenced tiles to VRAM again to make visible the possible changes in them.
- auto vram() -> optional<span<tile>>
- Returns the allocated memory in VRAM if this regular_
bg_ tiles_ ptr was created with allocate or allocate_optional; bn:: nullopt otherwise. - auto handle() const -> int
- Returns the internal handle.
-
void swap(regular_
bg_ tiles_ ptr& other) - Exchanges the contents of this regular_
bg_ tiles_ ptr with those of the other one.
Friends
-
void swap(regular_
bg_ tiles_ ptr& a, regular_ bg_ tiles_ ptr& b) - Exchanges the contents of a regular_
bg_ tiles_ ptr with those of another one. -
auto operator==(const regular_
bg_ tiles_ ptr& a, const regular_ bg_ tiles_ ptr& b) -> bool defaulted - Default equal operator.
Function documentation
static optional<regular_ bg_ tiles_ ptr> bn:: regular_bg_tiles_ptr:: find(const regular_ bg_ tiles_ item& tiles_item)
Searches for a regular_
Parameters | |
---|---|
tiles_item | regular_ |
Returns | regular_ |
static regular_ bg_ tiles_ ptr bn:: regular_bg_tiles_ptr:: create(const regular_ bg_ tiles_ item& tiles_item)
Searches for a regular_
Parameters | |
---|---|
tiles_item | regular_ |
Returns | regular_ |
The tiles are not copied but referenced, so they should outlive the regular_
static regular_ bg_ tiles_ ptr bn:: regular_bg_tiles_ptr:: allocate(int tiles_count,
bpp_ mode bpp)
Creates a regular_
Parameters | |
---|---|
tiles_count | Number of tiles to allocate. |
bpp | Bits per pixel of the tiles to allocate. |
Returns | regular_ |
static optional<regular_ bg_ tiles_ ptr> bn:: regular_bg_tiles_ptr:: create_optional(const regular_ bg_ tiles_ item& tiles_item)
Searches for a regular_
Parameters | |
---|---|
tiles_item | regular_ |
Returns | regular_ |
The tiles are not copied but referenced, so they should outlive the regular_
static optional<regular_ bg_ tiles_ ptr> bn:: regular_bg_tiles_ptr:: allocate_optional(int tiles_count,
bpp_ mode bpp)
Creates a regular_
Parameters | |
---|---|
tiles_count | Number of tiles to allocate. |
bpp | Bits per pixel of the tiles to allocate. |
Returns | regular_ |
bn:: regular_bg_tiles_ptr:: regular_bg_tiles_ptr(const regular_ bg_ tiles_ ptr& other)
Copy constructor.
Parameters | |
---|---|
other | regular_ |
bn:: regular_bg_tiles_ptr:: regular_bg_tiles_ptr(regular_ bg_ tiles_ ptr&& other) noexcept
Move constructor.
Parameters | |
---|---|
other | regular_ |
regular_ bg_ tiles_ ptr& bn:: regular_bg_tiles_ptr:: operator=(const regular_ bg_ tiles_ ptr& other)
Copy assignment operator.
Parameters | |
---|---|
other | regular_ |
Returns | Reference to this. |
regular_ bg_ tiles_ ptr& bn:: regular_bg_tiles_ptr:: operator=(regular_ bg_ tiles_ ptr&& other) noexcept
Move assignment operator.
Parameters | |
---|---|
other | regular_ |
Returns | Reference to this. |
void bn:: regular_bg_tiles_ptr:: set_tiles_ref(const regular_ bg_ tiles_ item& tiles_item)
Sets the tiles to handle.
Parameters | |
---|---|
tiles_item | regular_ |
Remember that the background tiles system does not support multiple regular_
Remember also that the tiles are not copied but referenced, so they should outlive the regular_
void bn:: regular_bg_tiles_ptr:: swap(regular_ bg_ tiles_ ptr& other)
Exchanges the contents of this regular_
Parameters | |
---|---|
other | regular_ |
void swap(regular_ bg_ tiles_ ptr& a,
regular_ bg_ tiles_ ptr& b)
Exchanges the contents of a regular_
Parameters | |
---|---|
a | First regular_ |
b | Second regular_ |