class
#include <bn_affine_bg_map_ptr.h>
affine_bg_map_ptr std::shared_ptr like smart pointer that retains shared ownership of an affine background map.
Several affine_
The affine background map is released when the last remaining affine_
Public static functions
-
static auto find(const affine_
bg_ map_ item& map_item, const affine_ bg_ tiles_ ptr& tiles, const bg_ palette_ ptr& palette) -> optional<affine_ bg_ map_ ptr> - Searches for an affine_
bg_ map_ ptr which references the given information. -
static auto find(const affine_
bg_ map_ item& map_item, const affine_ bg_ tiles_ ptr& tiles, const bg_ palette_ ptr& palette, int map_index) -> optional<affine_ bg_ map_ ptr> - Searches for an affine_
bg_ map_ ptr which references the given information. -
static auto find(const affine_
bg_ item& item) -> optional<affine_ bg_ map_ ptr> - Searches for an affine_
bg_ map_ ptr which references the given information. -
static auto find(const affine_
bg_ item& item, int map_index) -> optional<affine_ bg_ map_ ptr> - Searches for an affine_
bg_ map_ ptr which references the given information. -
static auto create(const affine_
bg_ map_ item& map_item, affine_ bg_ tiles_ ptr tiles, bg_ palette_ ptr palette) -> affine_ bg_ map_ ptr - Searches for an affine_
bg_ map_ ptr which references the given information. If it is not found, it creates an affine_ bg_ map_ ptr which references it. -
static auto create(const affine_
bg_ map_ item& map_item, affine_ bg_ tiles_ ptr tiles, bg_ palette_ ptr palette, int map_index) -> affine_ bg_ map_ ptr - Searches for an affine_
bg_ map_ ptr which references the given information. If it is not found, it creates an affine_ bg_ map_ ptr which references it. -
static auto create(const affine_
bg_ item& item) -> affine_ bg_ map_ ptr - Searches for an affine_
bg_ map_ ptr which references the given information. If it is not found, it creates an affine_ bg_ map_ ptr which references it. -
static auto create(const affine_
bg_ item& item, int map_index) -> affine_ bg_ map_ ptr - Searches for an affine_
bg_ map_ ptr which references the given information. If it is not found, it creates an affine_ bg_ map_ ptr which references it. -
static auto create_new(const affine_
bg_ map_ item& map_item, affine_ bg_ tiles_ ptr tiles, bg_ palette_ ptr palette) -> affine_ bg_ map_ ptr - Creates an affine_
bg_ map_ ptr which references the given map cells. -
static auto create_new(const affine_
bg_ map_ item& map_item, affine_ bg_ tiles_ ptr tiles, bg_ palette_ ptr palette, int map_index) -> affine_ bg_ map_ ptr - Creates an affine_
bg_ map_ ptr which references the given map cells. -
static auto create_new(const affine_
bg_ item& item) -> affine_ bg_ map_ ptr - Creates an affine_
bg_ map_ ptr which references the given map cells. -
static auto create_new(const affine_
bg_ item& item, int map_index) -> affine_ bg_ map_ ptr - Creates an affine_
bg_ map_ ptr which references the given map cells. -
static auto allocate(const size& dimensions,
affine_
bg_ tiles_ ptr tiles, bg_ palette_ ptr palette) -> affine_ bg_ map_ ptr - Creates an affine_
bg_ map_ ptr which references a chunk of VRAM map cells not visible on the screen. -
static auto create_optional(const affine_
bg_ map_ item& map_item, affine_ bg_ tiles_ ptr tiles, bg_ palette_ ptr palette) -> optional<affine_ bg_ map_ ptr> - Searches for an affine_
bg_ map_ ptr which references the given information. If it is not found, it creates an affine_ bg_ map_ ptr which references it. -
static auto create_optional(const affine_
bg_ map_ item& map_item, affine_ bg_ tiles_ ptr tiles, bg_ palette_ ptr palette, int map_index) -> optional<affine_ bg_ map_ ptr> - Searches for an affine_
bg_ map_ ptr which references the given information. If it is not found, it creates an affine_ bg_ map_ ptr which references it. -
static auto create_optional(const affine_
bg_ item& item) -> optional<affine_ bg_ map_ ptr> - Searches for an affine_
bg_ map_ ptr which references the given information. If it is not found, it creates an affine_ bg_ map_ ptr which references it. -
static auto create_optional(const affine_
bg_ item& item, int map_index) -> optional<affine_ bg_ map_ ptr> - Searches for an affine_
bg_ map_ ptr which references the given information. If it is not found, it creates an affine_ bg_ map_ ptr which references it. -
static auto create_new_optional(const affine_
bg_ map_ item& map_item, affine_ bg_ tiles_ ptr tiles, bg_ palette_ ptr palette) -> optional<affine_ bg_ map_ ptr> - Creates an affine_
bg_ map_ ptr which references the given map cells. -
static auto create_new_optional(const affine_
bg_ map_ item& map_item, affine_ bg_ tiles_ ptr tiles, bg_ palette_ ptr palette, int map_index) -> optional<affine_ bg_ map_ ptr> - Creates an affine_
bg_ map_ ptr which references the given map cells. -
static auto create_new_optional(const affine_
bg_ item& item) -> optional<affine_ bg_ map_ ptr> - Creates an affine_
bg_ map_ ptr which references the given map cells. -
static auto create_new_optional(const affine_
bg_ item& item, int map_index) -> optional<affine_ bg_ map_ ptr> - Creates an affine_
bg_ map_ ptr which references the given map cells. -
static auto allocate_optional(const size& dimensions,
affine_
bg_ tiles_ ptr tiles, bg_ palette_ ptr palette) -> optional<affine_ bg_ map_ ptr> - Creates an affine_
bg_ map_ ptr which references a chunk of VRAM map cells not visible on the screen.
Constructors, destructors, conversion operators
-
affine_bg_map_ptr(const affine_
bg_ map_ ptr& other) - Copy constructor.
-
affine_bg_map_ptr(affine_
bg_ map_ ptr&& other) noexcept - Move constructor.
- ~affine_bg_map_ptr()
- Releases the referenced map cells if no more affine_
bg_ map_ ptr objects reference to them.
Public functions
-
auto operator=(const affine_
bg_ map_ ptr& other) -> affine_ bg_ map_ ptr& - Copy assignment operator.
-
auto operator=(affine_
bg_ map_ ptr&& other) -> affine_ 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 big_canvas_size() const -> affine_
bg_ big_ map_ canvas_ size - Returns the size of the canvas used to render this big map.
- auto tiles_offset() const -> int
- Returns how much tiles 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 affine_
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 affine_
bg_ map_ item& map_item) - Sets the map cells to handle.
-
void set_cells_ref(const affine_
bg_ map_ item& map_item, int map_index) - 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 affine_
bg_ tiles_ ptr& - Returns the referenced tiles.
-
void set_tiles(const affine_
bg_ tiles_ ptr& tiles) - Sets the referenced tiles.
-
void set_tiles(affine_
bg_ tiles_ ptr&& tiles) - Sets the referenced tiles.
-
void set_tiles(const affine_
bg_ tiles_ item& tiles_item) - Replaces the referenced tiles with a new tile set created with the given affine_
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. -
auto vram() -> optional<span<affine_
bg_ map_ cell>> - Returns the allocated memory in VRAM if this affine_bg_map_cell was created with allocate or allocate_optional; bn::
nullopt otherwise. - auto handle() const -> int
- Returns the internal handle.
-
void swap(affine_
bg_ map_ ptr& other) - Exchanges the contents of this affine_
bg_ map_ ptr with those of the other one.
Friends
-
void swap(affine_
bg_ map_ ptr& a, affine_ bg_ map_ ptr& b) - Exchanges the contents of an affine_
bg_ map_ ptr with those of another one. -
auto operator==(const affine_
bg_ map_ ptr& a, const affine_ bg_ map_ ptr& b) -> bool defaulted - Default equal operator.
Function documentation
static optional<affine_ bg_ map_ ptr> bn:: affine_bg_map_ptr:: find(const affine_ bg_ map_ item& map_item,
const affine_ bg_ tiles_ ptr& tiles,
const bg_ palette_ ptr& palette)
Searches for an affine_
Parameters | |
---|---|
map_item | affine_ |
tiles | Referenced tiles of the map to search. |
palette | Referenced color palette of the map to search. |
Returns | affine_ |
static optional<affine_ bg_ map_ ptr> bn:: affine_bg_map_ptr:: find(const affine_ bg_ map_ item& map_item,
const affine_ bg_ tiles_ ptr& tiles,
const bg_ palette_ ptr& palette,
int map_index)
Searches for an affine_
Parameters | |
---|---|
map_item | affine_ |
tiles | Referenced tiles of the map to search. |
palette | Referenced color palette of the map to search. |
map_index | Index of the referenced map to search. |
Returns | affine_ |
static optional<affine_ bg_ map_ ptr> bn:: affine_bg_map_ptr:: find(const affine_ bg_ item& item)
Searches for an affine_
Parameters | |
---|---|
item | affine_ |
Returns | affine_ |
static optional<affine_ bg_ map_ ptr> bn:: affine_bg_map_ptr:: find(const affine_ bg_ item& item,
int map_index)
Searches for an affine_
Parameters | |
---|---|
item | affine_ |
map_index | Index of the referenced map to search. |
Returns | affine_ |
static affine_ bg_ map_ ptr bn:: affine_bg_map_ptr:: create(const affine_ bg_ map_ item& map_item,
affine_ bg_ tiles_ ptr tiles,
bg_ palette_ ptr palette)
Searches for an affine_
Parameters | |
---|---|
map_item | affine_ |
tiles | Referenced tiles of the map to search or handle. |
palette | Referenced color palette of the map to search or handle. |
Returns | affine_ |
The map cells are not copied but referenced, so they should outlive the affine_
static affine_ bg_ map_ ptr bn:: affine_bg_map_ptr:: create(const affine_ bg_ map_ item& map_item,
affine_ bg_ tiles_ ptr tiles,
bg_ palette_ ptr palette,
int map_index)
Searches for an affine_
Parameters | |
---|---|
map_item | affine_ |
tiles | Referenced tiles of the map to search or handle. |
palette | Referenced color palette of the map to search or handle. |
map_index | Index of the referenced map to search or handle. |
Returns | affine_ |
The map cells are not copied but referenced, so they should outlive the affine_
static affine_ bg_ map_ ptr bn:: affine_bg_map_ptr:: create(const affine_ bg_ item& item)
Searches for an affine_
Parameters | |
---|---|
item | affine_ |
Returns | affine_ |
The map cells are not copied but referenced, so they should outlive the affine_
static affine_ bg_ map_ ptr bn:: affine_bg_map_ptr:: create(const affine_ bg_ item& item,
int map_index)
Searches for an affine_
Parameters | |
---|---|
item | affine_ |
map_index | Index of the referenced map to search or handle. |
Returns | affine_ |
The map cells are not copied but referenced, so they should outlive the affine_
static affine_ bg_ map_ ptr bn:: affine_bg_map_ptr:: create_new(const affine_ bg_ map_ item& map_item,
affine_ bg_ tiles_ ptr tiles,
bg_ palette_ ptr palette)
Creates an affine_
Parameters | |
---|---|
map_item | affine_ |
tiles | Referenced tiles of the map to handle. |
palette | Referenced color palette of the map to handle. |
Returns | affine_ |
The map system does not support multiple affine_
The map cells are not copied but referenced, so they should outlive the affine_
static affine_ bg_ map_ ptr bn:: affine_bg_map_ptr:: create_new(const affine_ bg_ map_ item& map_item,
affine_ bg_ tiles_ ptr tiles,
bg_ palette_ ptr palette,
int map_index)
Creates an affine_
Parameters | |
---|---|
map_item | affine_ |
tiles | Referenced tiles of the map to handle. |
palette | Referenced color palette of the map to handle. |
map_index | Index of the referenced map to handle. |
Returns | affine_ |
The map system does not support multiple affine_
The map cells are not copied but referenced, so they should outlive the affine_
static affine_ bg_ map_ ptr bn:: affine_bg_map_ptr:: create_new(const affine_ bg_ item& item)
Creates an affine_
Parameters | |
---|---|
item | affine_ |
Returns | affine_ |
The map system does not support multiple affine_
The map cells are not copied but referenced, so they should outlive the affine_
static affine_ bg_ map_ ptr bn:: affine_bg_map_ptr:: create_new(const affine_ bg_ item& item,
int map_index)
Creates an affine_
Parameters | |
---|---|
item | affine_ |
map_index | Index of the referenced map to handle. |
Returns | affine_ |
The map system does not support multiple affine_
The map cells are not copied but referenced, so they should outlive the affine_
static affine_ bg_ map_ ptr bn:: affine_bg_map_ptr:: allocate(const size& dimensions,
affine_ bg_ tiles_ ptr tiles,
bg_ palette_ ptr palette)
Creates an affine_
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 | affine_ |
static optional<affine_ bg_ map_ ptr> bn:: affine_bg_map_ptr:: create_optional(const affine_ bg_ map_ item& map_item,
affine_ bg_ tiles_ ptr tiles,
bg_ palette_ ptr palette)
Searches for an affine_
Parameters | |
---|---|
map_item | affine_ |
tiles | Referenced tiles of the map to search or handle. |
palette | Referenced color palette of the map to search or handle. |
Returns | affine_ |
The map cells are not copied but referenced, so they should outlive the affine_
static optional<affine_ bg_ map_ ptr> bn:: affine_bg_map_ptr:: create_optional(const affine_ bg_ map_ item& map_item,
affine_ bg_ tiles_ ptr tiles,
bg_ palette_ ptr palette,
int map_index)
Searches for an affine_
Parameters | |
---|---|
map_item | affine_ |
tiles | Referenced tiles of the map to search or handle. |
palette | Referenced color palette of the map to search or handle. |
map_index | Index of the referenced map to search or handle. |
Returns | affine_ |
The map cells are not copied but referenced, so they should outlive the affine_
static optional<affine_ bg_ map_ ptr> bn:: affine_bg_map_ptr:: create_optional(const affine_ bg_ item& item)
Searches for an affine_
Parameters | |
---|---|
item | affine_ |
Returns | affine_ |
The map cells are not copied but referenced, so they should outlive the affine_
static optional<affine_ bg_ map_ ptr> bn:: affine_bg_map_ptr:: create_optional(const affine_ bg_ item& item,
int map_index)
Searches for an affine_
Parameters | |
---|---|
item | affine_ |
map_index | Index of the referenced map to search or handle. |
Returns | affine_ |
The map cells are not copied but referenced, so they should outlive the affine_
static optional<affine_ bg_ map_ ptr> bn:: affine_bg_map_ptr:: create_new_optional(const affine_ bg_ map_ item& map_item,
affine_ bg_ tiles_ ptr tiles,
bg_ palette_ ptr palette)
Creates an affine_
Parameters | |
---|---|
map_item | affine_ |
tiles | Referenced tiles of the map to handle. |
palette | Referenced color palette of the map to handle. |
Returns | affine_ |
The map system does not support multiple affine_
The map cells are not copied but referenced, so they should outlive the affine_
static optional<affine_ bg_ map_ ptr> bn:: affine_bg_map_ptr:: create_new_optional(const affine_ bg_ map_ item& map_item,
affine_ bg_ tiles_ ptr tiles,
bg_ palette_ ptr palette,
int map_index)
Creates an affine_
Parameters | |
---|---|
map_item | affine_ |
tiles | Referenced tiles of the map to handle. |
palette | Referenced color palette of the map to handle. |
map_index | Index of the referenced map to handle. |
Returns | affine_ |
The map system does not support multiple affine_
The map cells are not copied but referenced, so they should outlive the affine_
static optional<affine_ bg_ map_ ptr> bn:: affine_bg_map_ptr:: create_new_optional(const affine_ bg_ item& item)
Creates an affine_
Parameters | |
---|---|
item | affine_ |
Returns | affine_ |
The map system does not support multiple affine_
The map cells are not copied but referenced, so they should outlive the affine_
static optional<affine_ bg_ map_ ptr> bn:: affine_bg_map_ptr:: create_new_optional(const affine_ bg_ item& item,
int map_index)
Creates an affine_
Parameters | |
---|---|
item | affine_ |
map_index | Index of the referenced map to handle. |
Returns | affine_ |
The map system does not support multiple affine_
The map cells are not copied but referenced, so they should outlive the affine_
static optional<affine_ bg_ map_ ptr> bn:: affine_bg_map_ptr:: allocate_optional(const size& dimensions,
affine_ bg_ tiles_ ptr tiles,
bg_ palette_ ptr palette)
Creates an affine_
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 | affine_ |
bn:: affine_bg_map_ptr:: affine_bg_map_ptr(const affine_ bg_ map_ ptr& other)
Copy constructor.
Parameters | |
---|---|
other | affine_ |
bn:: affine_bg_map_ptr:: affine_bg_map_ptr(affine_ bg_ map_ ptr&& other) noexcept
Move constructor.
Parameters | |
---|---|
other | affine_ |
affine_ bg_ map_ ptr& bn:: affine_bg_map_ptr:: operator=(const affine_ bg_ map_ ptr& other)
Copy assignment operator.
Parameters | |
---|---|
other | affine_ |
Returns | Reference to this. |
affine_ bg_ map_ ptr& bn:: affine_bg_map_ptr:: operator=(affine_ bg_ map_ ptr&& other) noexcept
Move assignment operator.
Parameters | |
---|---|
other | affine_ |
Returns | Reference to this. |
bool bn:: affine_bg_map_ptr:: big() const
Indicates if this map is big or not.
Big backgrounds are slower CPU wise, but can have any width or height multiple of 256 pixels.
void bn:: affine_bg_map_ptr:: set_cells_ref(const affine_ bg_ map_ item& map_item)
Sets the map cells to handle.
Parameters | |
---|---|
map_item | affine_ |
The map system does not support multiple affine_
The map cells are not copied but referenced, so they should outlive the affine_
void bn:: affine_bg_map_ptr:: set_cells_ref(const affine_ bg_ map_ item& map_item,
int map_index)
Sets the map cells to handle.
Parameters | |
---|---|
map_item | affine_ |
map_index | Index of the referenced map to set. |
The map system does not support multiple affine_
The map cells are not copied but referenced, so they should outlive the affine_
void bn:: affine_bg_map_ptr:: set_tiles(const affine_ bg_ tiles_ ptr& tiles)
Sets the referenced tiles.
Parameters | |
---|---|
tiles | affine_ |
void bn:: affine_bg_map_ptr:: set_tiles(affine_ bg_ tiles_ ptr&& tiles)
Sets the referenced tiles.
Parameters | |
---|---|
tiles | affine_ |
void bn:: affine_bg_map_ptr:: set_tiles(const affine_ bg_ tiles_ item& tiles_item)
Replaces the referenced tiles with a new tile set created with the given affine_
Parameters | |
---|---|
tiles_item | It creates the new background tiles to reference. |
Before creating a new background tile set, the affine_
void bn:: affine_bg_map_ptr:: set_palette(const bg_ palette_ ptr& palette)
Sets the referenced color palette.
Parameters | |
---|---|
palette | bg_ |
void bn:: affine_bg_map_ptr:: set_palette(bg_ palette_ ptr&& palette)
Sets the referenced color palette.
Parameters | |
---|---|
palette | bg_ |
void bn:: affine_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_
void bn:: affine_bg_map_ptr:: swap(affine_ bg_ map_ ptr& other)
Exchanges the contents of this affine_
Parameters | |
---|---|
other | affine_ |
void swap(affine_ bg_ map_ ptr& a,
affine_ bg_ map_ ptr& b)
Exchanges the contents of an affine_
Parameters | |
---|---|
a | First affine_ |
b | Second affine_ |