class
#include <bn_regular_bg_map_ptr.h>
regular_bg_map_ptr std::shared_ptr like smart pointer that retains shared ownership of a regular background map.
Several regular_
The regular background map is released when the last remaining regular_
Public static functions
-
static auto find(const regular_
bg_ map_ item& map_item, const regular_ bg_ tiles_ ptr& tiles, const bg_ palette_ ptr& palette) -> optional<regular_ bg_ map_ ptr> - Searches for a regular_
bg_ map_ ptr which references the given information. -
static auto find(const regular_
bg_ item& item) -> optional<regular_ bg_ map_ ptr> - Searches for a regular_
bg_ map_ ptr which references the given information. -
static auto create(const regular_
bg_ map_ item& map_item, regular_ bg_ tiles_ ptr tiles, bg_ palette_ ptr palette) -> regular_ bg_ map_ ptr - Searches for a regular_
bg_ map_ ptr which references the given information. If it is not found, it creates a regular_ bg_ map_ ptr which references it. -
static auto create(const regular_
bg_ item& item) -> regular_ bg_ map_ ptr - Searches for a regular_
bg_ map_ ptr which references the given information. If it is not found, it creates a regular_ bg_ map_ ptr which references it. -
static auto create_new(const regular_
bg_ map_ item& map_item, regular_ bg_ tiles_ ptr tiles, bg_ palette_ ptr palette) -> regular_ bg_ map_ ptr - Creates a regular_
bg_ map_ ptr which references the given map cells. -
static auto create_new(const regular_
bg_ item& item) -> regular_ bg_ map_ ptr - Creates a regular_
bg_ map_ ptr which references the given map cells. -
static auto allocate(const size& dimensions,
regular_
bg_ tiles_ ptr tiles, bg_ palette_ ptr palette) -> regular_ bg_ map_ ptr - Creates a regular_
bg_ map_ ptr which references a chunk of VRAM map cells not visible on the screen. -
static auto create_optional(const regular_
bg_ map_ item& map_item, regular_ bg_ tiles_ ptr tiles, bg_ palette_ ptr palette) -> optional<regular_ bg_ map_ ptr> - Searches for a regular_
bg_ map_ ptr which references the given information. If it is not found, it creates a regular_ bg_ map_ ptr which references it. -
static auto create_optional(const regular_
bg_ item& item) -> optional<regular_ bg_ map_ ptr> - Searches for a regular_
bg_ map_ ptr which references the given information. If it is not found, it creates a regular_ bg_ map_ ptr which references it. -
static auto create_new_optional(const regular_
bg_ map_ item& map_item, regular_ bg_ tiles_ ptr tiles, bg_ palette_ ptr palette) -> optional<regular_ bg_ map_ ptr> - Creates a regular_
bg_ map_ ptr which references the given map cells. -
static auto create_new_optional(const regular_
bg_ item& item) -> optional<regular_ bg_ map_ ptr> - Creates a regular_
bg_ map_ ptr which references the given map cells. -
static auto allocate_optional(const size& dimensions,
regular_
bg_ tiles_ ptr tiles, bg_ palette_ ptr palette) -> optional<regular_ bg_ map_ ptr> - Creates a regular_
bg_ map_ ptr which references a chunk of VRAM map cells not visible on the screen.
Constructors, destructors, conversion operators
-
regular_bg_map_ptr(const regular_
bg_ map_ ptr& other) - Copy constructor.
-
regular_bg_map_ptr(regular_
bg_ map_ ptr&& other) noexcept - Move constructor.
- ~regular_bg_map_ptr()
- Releases the referenced map cells if no more regular_
bg_ map_ ptr objects reference to them.
Public functions
-
auto operator=(const regular_
bg_ map_ ptr& other) -> regular_ bg_ map_ ptr& - Copy assignment operator.
-
auto operator=(regular_
bg_ map_ ptr&& other) -> regular_ bg_ map_ ptr& noexcept - Move assignment operator.
- auto id() const -> int
- Returns the internal id.
- auto dimensions() const -> size
- Returns the size in map cells of the referenced map.
- auto big() const -> bool
- Indicates if this map is big or not.
-
auto bpp() const -> bpp_
mode - Returns the bits per pixel of the referenced color palette.
- auto tiles_offset() const -> int
- Returns how much tiles to offset in the cells of this map before writing them in VRAM.
- auto palette_banks_offset() const -> int
- Returns how much palette banks to offset in the cells of this map before writing them in VRAM.
-
auto compression() const -> compression_
type - Returns the compression of the referenced map cells.
-
auto cells_ref() const -> optional<span<const regular_
bg_ map_ cell>> - Returns the referenced map cells unless it was created with allocate or allocate_optional. In that case, it returns bn::
nullopt. -
void set_cells_ref(const regular_
bg_ map_ item& map_item) - Sets the map cells to handle.
- void reload_cells_ref()
- Uploads the referenced map cells to VRAM again to make visible the possible changes in them.
-
auto tiles() const -> const regular_
bg_ tiles_ ptr& - Returns the referenced tiles.
-
void set_tiles(const regular_
bg_ tiles_ ptr& tiles) - Sets the referenced tiles.
-
void set_tiles(regular_
bg_ tiles_ ptr&& tiles) - Sets the referenced tiles.
-
void set_tiles(const regular_
bg_ tiles_ item& tiles_item) - Replaces the referenced tiles with a new tile set created with the given regular_
bg_ tiles_ item. -
auto palette() const -> const bg_
palette_ ptr& - Returns the referenced color palette.
-
void set_palette(const bg_
palette_ ptr& palette) - Sets the referenced color palette.
-
void set_palette(bg_
palette_ ptr&& palette) - Sets the referenced color palette.
-
void set_palette(const bg_
palette_ item& palette_item) - Replaces the referenced color palette with a new tile set created with the given bg_
palette_ item. -
void set_tiles_and_palette(regular_
bg_ tiles_ ptr tiles, bg_ palette_ ptr palette) - Sets the tiles and the color palette to reference.
-
void set_tiles_and_palette(const regular_
bg_ tiles_ item& tiles_item, const bg_ palette_ item& palette_item) - Replaces the referenced tiles and color palette with the created with the given regular_
bg_ tiles_ item and bg_ palette_ item. -
auto vram() -> optional<span<regular_
bg_ map_ cell>> - Returns the allocated memory in VRAM if this regular_bg_map_cell was created with allocate or allocate_optional; bn::
nullopt otherwise. - auto handle() const -> int
- Returns the internal handle.
-
void swap(regular_
bg_ map_ ptr& other) - Exchanges the contents of this regular_
bg_ map_ ptr with those of the other one.
Friends
-
void swap(regular_
bg_ map_ ptr& a, regular_ bg_ map_ ptr& b) - Exchanges the contents of a regular_
bg_ map_ ptr with those of another one. -
auto operator==(const regular_
bg_ map_ ptr& a, const regular_ bg_ map_ ptr& b) -> bool defaulted - Default equal operator.
Function documentation
static optional<regular_ bg_ map_ ptr> bn:: regular_bg_map_ptr:: find(const regular_ bg_ map_ item& map_item,
const regular_ bg_ tiles_ ptr& tiles,
const bg_ palette_ ptr& palette)
Searches for a regular_
Parameters | |
---|---|
map_item | regular_ |
tiles | Referenced tiles of the map to search. |
palette | Referenced color palette of the map to search. |
Returns | regular_ |
static optional<regular_ bg_ map_ ptr> bn:: regular_bg_map_ptr:: find(const regular_ bg_ item& item)
Searches for a regular_
Parameters | |
---|---|
item | regular_ |
Returns | regular_ |
static regular_ bg_ map_ ptr bn:: regular_bg_map_ptr:: create(const regular_ bg_ map_ item& map_item,
regular_ bg_ tiles_ ptr tiles,
bg_ palette_ ptr palette)
Searches for a regular_
Parameters | |
---|---|
map_item | regular_ |
tiles | Referenced tiles of the map to search or handle. |
palette | Referenced color palette of the map to search or handle. |
Returns | regular_ |
The map cells are not copied but referenced, so they should outlive the regular_
static regular_ bg_ map_ ptr bn:: regular_bg_map_ptr:: create(const regular_ bg_ item& item)
Searches for a regular_
Parameters | |
---|---|
item | regular_ |
Returns | regular_ |
The map cells are not copied but referenced, so they should outlive the regular_
static regular_ bg_ map_ ptr bn:: regular_bg_map_ptr:: create_new(const regular_ bg_ map_ item& map_item,
regular_ bg_ tiles_ ptr tiles,
bg_ palette_ ptr palette)
Creates a regular_
Parameters | |
---|---|
map_item | regular_ |
tiles | Referenced tiles of the map to handle. |
palette | Referenced color palette of the map to handle. |
Returns | regular_ |
The map system does not support multiple regular_
The map cells are not copied but referenced, so they should outlive the regular_
static regular_ bg_ map_ ptr bn:: regular_bg_map_ptr:: create_new(const regular_ bg_ item& item)
Creates a regular_
Parameters | |
---|---|
item | regular_ |
Returns | regular_ |
The map system does not support multiple regular_
The map cells are not copied but referenced, so they should outlive the regular_
static regular_ bg_ map_ ptr bn:: regular_bg_map_ptr:: allocate(const size& dimensions,
regular_ bg_ tiles_ ptr tiles,
bg_ palette_ ptr palette)
Creates a regular_
Parameters | |
---|---|
dimensions | Size in map cells of the map to allocate. |
tiles | Referenced tiles of the map to allocate. |
palette | Referenced color palette of the map to allocate. |
Returns | regular_ |
static optional<regular_ bg_ map_ ptr> bn:: regular_bg_map_ptr:: create_optional(const regular_ bg_ map_ item& map_item,
regular_ bg_ tiles_ ptr tiles,
bg_ palette_ ptr palette)
Searches for a regular_
Parameters | |
---|---|
map_item | regular_ |
tiles | Referenced tiles of the map to search or handle. |
palette | Referenced color palette of the map to search or handle. |
Returns | regular_ |
The map cells are not copied but referenced, so they should outlive the regular_
static optional<regular_ bg_ map_ ptr> bn:: regular_bg_map_ptr:: create_optional(const regular_ bg_ item& item)
Searches for a regular_
Parameters | |
---|---|
item | regular_ |
Returns | regular_ |
The map cells are not copied but referenced, so they should outlive the regular_
static optional<regular_ bg_ map_ ptr> bn:: regular_bg_map_ptr:: create_new_optional(const regular_ bg_ map_ item& map_item,
regular_ bg_ tiles_ ptr tiles,
bg_ palette_ ptr palette)
Creates a regular_
Parameters | |
---|---|
map_item | regular_ |
tiles | Referenced tiles of the map to handle. |
palette | Referenced color palette of the map to handle. |
Returns | regular_ |
The map system does not support multiple regular_
The map cells are not copied but referenced, so they should outlive the regular_
static optional<regular_ bg_ map_ ptr> bn:: regular_bg_map_ptr:: create_new_optional(const regular_ bg_ item& item)
Creates a regular_
Parameters | |
---|---|
item | regular_ |
Returns | regular_ |
The map system does not support multiple regular_
The map cells are not copied but referenced, so they should outlive the regular_
static optional<regular_ bg_ map_ ptr> bn:: regular_bg_map_ptr:: allocate_optional(const size& dimensions,
regular_ bg_ tiles_ ptr tiles,
bg_ palette_ ptr palette)
Creates a regular_
Parameters | |
---|---|
dimensions | Size in map cells of the map to allocate. |
tiles | Referenced tiles of the map to allocate. |
palette | Referenced color palette of the map to allocate. |
Returns | regular_ |
bn:: regular_bg_map_ptr:: regular_bg_map_ptr(const regular_ bg_ map_ ptr& other)
Copy constructor.
Parameters | |
---|---|
other | regular_ |
bn:: regular_bg_map_ptr:: regular_bg_map_ptr(regular_ bg_ map_ ptr&& other) noexcept
Move constructor.
Parameters | |
---|---|
other | regular_ |
regular_ bg_ map_ ptr& bn:: regular_bg_map_ptr:: operator=(const regular_ bg_ map_ ptr& other)
Copy assignment operator.
Parameters | |
---|---|
other | regular_ |
Returns | Reference to this. |
regular_ bg_ map_ ptr& bn:: regular_bg_map_ptr:: operator=(regular_ bg_ map_ ptr&& other) noexcept
Move assignment operator.
Parameters | |
---|---|
other | regular_ |
Returns | Reference to this. |
bool bn:: regular_bg_map_ptr:: big() const
Indicates if this map is big or not.
Big backgrounds are slower CPU wise and don't support wrapping (they can't be moved beyond their boundaries), but can have any width or height multiple of 256 pixels.
void bn:: regular_bg_map_ptr:: set_cells_ref(const regular_ bg_ map_ item& map_item)
Sets the map cells to handle.
Parameters | |
---|---|
map_item | regular_ |
The map system does not support multiple regular_
The map cells are not copied but referenced, so they should outlive the regular_
void bn:: regular_bg_map_ptr:: set_tiles(const regular_ bg_ tiles_ ptr& tiles)
Sets the referenced tiles.
Parameters | |
---|---|
tiles | regular_ |
It must be compatible with the referenced color palette.
void bn:: regular_bg_map_ptr:: set_tiles(regular_ bg_ tiles_ ptr&& tiles)
Sets the referenced tiles.
Parameters | |
---|---|
tiles | regular_ |
It must be compatible with the referenced color palette.
void bn:: regular_bg_map_ptr:: set_tiles(const regular_ bg_ tiles_ item& tiles_item)
Replaces the referenced tiles with a new tile set created with the given regular_
Parameters | |
---|---|
tiles_item | It creates the new background tiles to reference. |
Before creating a new background tile set, the regular_
The new background tiles must be compatible with the referenced color palette.
void bn:: regular_bg_map_ptr:: set_palette(const bg_ palette_ ptr& palette)
Sets the referenced color palette.
Parameters | |
---|---|
palette | bg_ |
It must be compatible with the referenced tiles.
void bn:: regular_bg_map_ptr:: set_palette(bg_ palette_ ptr&& palette)
Sets the referenced color palette.
Parameters | |
---|---|
palette | bg_ |
It must be compatible with the referenced tiles.
void bn:: regular_bg_map_ptr:: set_palette(const bg_ palette_ item& palette_item)
Replaces the referenced color palette with a new tile set created with the given bg_
Parameters | |
---|---|
palette_item | It creates the new color palette to reference. |
Before creating a new color palette, the bg_
The new color palette must be compatible with the referenced tiles.
void bn:: regular_bg_map_ptr:: set_tiles_and_palette(regular_ bg_ tiles_ ptr tiles,
bg_ palette_ ptr palette)
Sets the tiles and the color palette to reference.
Parameters | |
---|---|
tiles | regular_ |
palette | bg_ |
void bn:: regular_bg_map_ptr:: set_tiles_and_palette(const regular_ bg_ tiles_ item& tiles_item,
const bg_ palette_ item& palette_item)
Replaces the referenced tiles and color palette with the created with the given regular_
Parameters | |
---|---|
tiles_item | It creates the new background tiles to reference. |
palette_item | It creates the color palette to reference. |
Before creating new resources, the resources referenced by this map are removed, so VRAM usage is reduced.
void bn:: regular_bg_map_ptr:: swap(regular_ bg_ map_ ptr& other)
Exchanges the contents of this regular_
Parameters | |
---|---|
other | regular_ |
void swap(regular_ bg_ map_ ptr& a,
regular_ bg_ map_ ptr& b)
Exchanges the contents of a regular_
Parameters | |
---|---|
a | First regular_ |
b | Second regular_ |