class
#include <bn_sprite_ptr.h>
sprite_ptr std::shared_ptr like smart pointer that retains shared ownership of a sprite.
Several sprite_
The sprite is released when the last remaining sprite_
Public static functions
-
static auto create(const sprite_
item& item) -> sprite_ ptr - Creates a sprite_
ptr from the given sprite_ item. -
static auto create(const sprite_
item& item, int graphics_index) -> sprite_ ptr - Creates a sprite_
ptr from the given sprite_ item. -
static auto create(const sprite_
shape_ size& shape_size, sprite_ tiles_ ptr tiles, sprite_ palette_ ptr palette) -> sprite_ ptr - Creates a sprite_
ptr. -
static auto create(fixed x,
fixed y,
const sprite_
item& item) -> sprite_ ptr - Creates a sprite_
ptr from the given sprite_ item. -
static auto create(fixed x,
fixed y,
const sprite_
item& item, int graphics_index) -> sprite_ ptr - Creates a sprite_
ptr from the given sprite_ item. -
static auto create(const fixed_
point& position, const sprite_ item& item) -> sprite_ ptr - Creates a sprite_
ptr from the given sprite_ item. -
static auto create(const fixed_
point& position, const sprite_ item& item, int graphics_index) -> sprite_ ptr - Creates a sprite_
ptr from the given sprite_ item. -
static auto create(fixed x,
fixed y,
const sprite_
shape_ size& shape_size, sprite_ tiles_ ptr tiles, sprite_ palette_ ptr palette) -> sprite_ ptr - Creates a sprite_
ptr. -
static auto create(const fixed_
point& position, const sprite_ shape_ size& shape_size, sprite_ tiles_ ptr tiles, sprite_ palette_ ptr palette) -> sprite_ ptr - Creates a sprite_
ptr. -
static auto create(const sprite_
builder& builder) -> sprite_ ptr - Creates a sprite_
ptr from a sprite_ builder reference. -
static auto create(sprite_
builder&& builder) -> sprite_ ptr - Creates a sprite_
ptr from a moved sprite_ builder. -
static auto create_optional(const sprite_
item& item) -> optional<sprite_ ptr> - Creates a sprite_
ptr from the given sprite_ item. -
static auto create_optional(const sprite_
item& item, int graphics_index) -> optional<sprite_ ptr> - Creates a sprite_
ptr from the given sprite_ item. -
static auto create_optional(const sprite_
shape_ size& shape_size, sprite_ tiles_ ptr tiles, sprite_ palette_ ptr palette) -> optional<sprite_ ptr> - Creates a sprite_
ptr. -
static auto create_optional(fixed x,
fixed y,
const sprite_
item& item) -> optional<sprite_ ptr> - Creates a sprite_
ptr from the given sprite_ item. -
static auto create_optional(fixed x,
fixed y,
const sprite_
item& item, int graphics_index) -> optional<sprite_ ptr> - Creates a sprite_
ptr from the given sprite_ item. -
static auto create_optional(const fixed_
point& position, const sprite_ item& item) -> optional<sprite_ ptr> - Creates a sprite_
ptr from the given sprite_ item. -
static auto create_optional(const fixed_
point& position, const sprite_ item& item, int graphics_index) -> optional<sprite_ ptr> - Creates a sprite_
ptr from the given sprite_ item. -
static auto create_optional(fixed x,
fixed y,
const sprite_
shape_ size& shape_size, sprite_ tiles_ ptr tiles, sprite_ palette_ ptr palette) -> optional<sprite_ ptr> - Creates a sprite_
ptr. -
static auto create_optional(const fixed_
point& position, const sprite_ shape_ size& shape_size, sprite_ tiles_ ptr tiles, sprite_ palette_ ptr palette) -> optional<sprite_ ptr> - Creates a sprite_
ptr. -
static auto create_optional(const sprite_
builder& builder) -> optional<sprite_ ptr> - Creates a sprite_
ptr from a sprite_ builder reference. -
static auto create_optional(sprite_
builder&& builder) -> optional<sprite_ ptr> - Creates a sprite_
ptr from a moved sprite_ builder.
Constructors, destructors, conversion operators
-
sprite_ptr(const sprite_
ptr& other) - Copy constructor.
-
sprite_ptr(sprite_
ptr&& other) noexcept - Move constructor.
- ~sprite_ptr()
- Releases the referenced sprite if no more sprite_
ptr objects reference to it.
Public functions
-
auto operator=(const sprite_
ptr& other) -> sprite_ ptr& - Copy assignment operator.
-
auto operator=(sprite_
ptr&& other) -> sprite_ ptr& noexcept - Move assignment operator.
-
auto shape_size() const -> sprite_
shape_ size - Returns the shape and size of the sprite.
- auto dimensions() const -> size
- Returns the size in pixels of the sprite.
-
auto tiles() const -> const sprite_
tiles_ ptr& - Returns the tiles used by this sprite.
-
void set_tiles(const sprite_
tiles_ ptr& tiles) - Sets the tiles used by this sprite.
-
void set_tiles(sprite_
tiles_ ptr&& tiles) - Sets the tiles used by this sprite.
-
void set_tiles(const sprite_
shape_ size& shape_size, const sprite_ tiles_ ptr& tiles) - Sets the tiles, the shape and size of the sprite.
-
void set_tiles(const sprite_
shape_ size& shape_size, sprite_ tiles_ ptr&& tiles) - Sets the tiles, the shape and size of the sprite.
-
void set_tiles(const sprite_
tiles_ item& tiles_item) - Replaces the tiles used by this sprite with a new tile set created with the given sprite_
tiles_ item. -
void set_tiles(const sprite_
tiles_ item& tiles_item, int graphics_index) - Replaces the tiles used by this sprite with a new tile set created with the given sprite_
tiles_ item. -
void set_tiles(const sprite_
tiles_ item& tiles_item, const sprite_ shape_ size& shape_size) - Replaces the tiles used by this sprite with a new tile set created with the given sprite_
tiles_ item, changing also the shape and size of the sprite. -
void set_tiles(const sprite_
tiles_ item& tiles_item, const sprite_ shape_ size& shape_size, int graphics_index) - Replaces the tiles used by this sprite with a new tile set created with the given sprite_
tiles_ item, changing also the shape and size of the sprite. -
auto palette() const -> const sprite_
palette_ ptr& - Returns the color palette used by this sprite.
-
void set_palette(const sprite_
palette_ ptr& palette) - Sets the color palette to use by this sprite.
-
void set_palette(sprite_
palette_ ptr&& palette) - Sets the color palette to use by this sprite.
-
void set_palette(const sprite_
palette_ item& palette_item) - Replaces the color palette used by this sprite with a new one created with the given sprite_
palette_ item. -
void set_tiles_and_palette(sprite_
tiles_ ptr tiles, sprite_ palette_ ptr palette) - Sets the tiles and the color palette to use by this sprite.
-
void set_tiles_and_palette(const sprite_
shape_ size& shape_size, sprite_ tiles_ ptr tiles, sprite_ palette_ ptr palette) - Sets the tiles, the color palette, the shape and size to use by this sprite.
-
void set_item(const sprite_
item& item) - Replaces the tiles, the color palette, the shape and size used by this sprite with the created with the given sprite_
item. -
void set_item(const sprite_
item& item, int graphics_index) - Replaces the tiles, the color palette, the shape and size used by this sprite with the created with the given sprite_
item. - auto x() const -> fixed
- Returns the horizontal position of the sprite (relative to its camera, if it has one).
- void set_x(fixed x)
- Sets the horizontal position of the sprite (relative to its camera, if it has one).
- auto y() const -> fixed
- Returns the vertical position of the sprite (relative to its camera, if it has one).
- void set_y(fixed y)
- Sets the vertical position of the sprite (relative to its camera, if it has one).
-
auto position() const -> const fixed_
point& - Returns the position of the sprite (relative to its camera, if it has one).
- void set_position(fixed x, fixed y)
- Sets the position of the sprite (relative to its camera, if it has one).
-
void set_position(const fixed_
point& position) - Sets the position of the sprite (relative to its camera, if it has one).
- auto top_left_x() const -> fixed
- Returns the horizontal top-left position of the sprite (relative to its camera, if it has one).
- void set_top_left_x(fixed top_left_x)
- Sets the horizontal top-left position of the sprite (relative to its camera, if it has one).
- auto top_left_y() const -> fixed
- Returns the vertical top-left position of the sprite (relative to its camera, if it has one).
- void set_top_left_y(fixed top_left_y)
- Sets the vertical top-left position of the sprite (relative to its camera, if it has one).
-
auto top_left_position() const -> fixed_
point - Returns the top-left position of the sprite (relative to its camera, if it has one).
- void set_top_left_position(fixed top_left_x, fixed top_left_y)
- Sets the top-left position of the sprite (relative to its camera, if it has one).
-
void set_top_left_position(const fixed_
point& top_left_position) - Sets the top-left position of the sprite (relative to its camera, if it has one).
- auto rotation_angle() const -> fixed
- Returns the rotation angle in degrees of the sprite.
- void set_rotation_angle(fixed rotation_angle)
- Sets the rotation angle in degrees of the sprite.
- void set_rotation_angle_safe(fixed rotation_angle)
- Sets the rotation angle in degrees of the sprite.
- auto horizontal_scale() const -> fixed
- Returns the horizontal scale of the sprite.
- void set_horizontal_scale(fixed horizontal_scale)
- Sets the horizontal scale of the sprite.
- auto vertical_scale() const -> fixed
- Returns the vertical scale of the sprite.
- void set_vertical_scale(fixed vertical_scale)
- Sets the vertical scale of the sprite.
- void set_scale(fixed scale)
- Sets the scale of the sprite.
- void set_scale(fixed horizontal_scale, fixed vertical_scale)
- Sets the scale of the sprite.
- auto horizontal_shear() const -> fixed
- Returns the horizontal shear of the sprite.
- void set_horizontal_shear(fixed horizontal_shear)
- Sets the horizontal shear of the sprite.
- auto vertical_shear() const -> fixed
- Returns the vertical shear of the sprite.
- void set_vertical_shear(fixed vertical_shear)
- Sets the vertical shear of the sprite.
- void set_shear(fixed shear)
- Sets the shear of the sprite.
- void set_shear(fixed horizontal_shear, fixed vertical_shear)
- Sets the shear of the sprite.
- auto bg_priority() const -> int
- Returns the priority relative to backgrounds.
- void set_bg_priority(int bg_priority)
- Sets the priority relative to backgrounds.
- auto z_order() const -> int
- Returns the priority relative to other sprites.
- void set_z_order(int z_order)
- Sets the priority relative to other sprites.
- void put_above()
- Modify this sprite to be drawn above all of the other sprites with the same priority.
- void put_below()
- Modify this sprite to be drawn below all of the other sprites with the same priority.
- auto horizontal_flip() const -> bool
- Indicates if this sprite is flipped in the horizontal axis or not.
- void set_horizontal_flip(bool horizontal_flip)
- Sets if this sprite is flipped in the horizontal axis or not.
- auto vertical_flip() const -> bool
- Indicates if this sprite is flipped in the vertical axis or not.
- void set_vertical_flip(bool vertical_flip)
- Sets if this sprite is flipped in the vertical axis or not.
- auto mosaic_enabled() const -> bool
- Indicates if the mosaic effect must be applied to this sprite or not.
- void set_mosaic_enabled(bool mosaic_enabled)
- Sets if the mosaic effect must be applied to this sprite or not.
- auto blending_enabled() const -> bool
- Indicates if blending must be applied to this sprite or not.
- void set_blending_enabled(bool blending_enabled)
- Sets if blending must be applied to this sprite or not.
- auto window_enabled() const -> bool
- Indicates if this sprite must be part of the silhouette of the sprite window or not.
- void set_window_enabled(bool window_enabled)
- Sets if this sprite must be part of the silhouette of the sprite window or not.
- auto double_size() const -> bool
- Indicates if this sprite is being drawn using more pixels than the area specified by its shape and size or not.
-
auto double_size_mode() const -> sprite_
double_ size_ mode - Returns the area this sprite uses to be drawn when it has an attached sprite_
affine_ mat_ ptr. -
void set_double_size_mode(sprite_
double_ size_ mode double_size_mode) - Specifies the area this sprite uses to be drawn when it has an attached sprite_
affine_ mat_ ptr. - auto visible() const -> bool
- Indicates if this sprite must be committed to the GBA or not.
- void set_visible(bool visible)
- Sets if this sprite must be committed to the GBA or not.
-
auto camera() const -> const optional<camera_
ptr>& - Returns the camera_
ptr attached to this sprite (if any). -
void set_camera(const camera_
ptr& camera) - Sets the camera_
ptr attached to this sprite. -
void set_camera(camera_
ptr&& camera) - Sets the camera_
ptr attached to this sprite. -
void set_camera(const optional<camera_
ptr>& camera) - Sets or removes the camera_
ptr attached to this sprite. -
void set_camera(optional<camera_
ptr>&& camera) - Sets or removes the camera_
ptr attached to this sprite. - void remove_camera()
- Removes the camera_
ptr attached to this sprite (if any). -
auto affine_mat() const -> const optional<sprite_
affine_ mat_ ptr>& - Returns the sprite_
affine_ mat_ ptr attached to this sprite (if any). -
void set_affine_mat(const sprite_
affine_ mat_ ptr& affine_mat) - Sets the sprite_
affine_ mat_ ptr attached to this sprite. -
void set_affine_mat(sprite_
affine_ mat_ ptr&& affine_mat) - Sets the sprite_
affine_ mat_ ptr attached to this sprite. -
void set_affine_mat(const optional<sprite_
affine_ mat_ ptr>& affine_mat) - Sets or removes the sprite_
affine_ mat_ ptr attached to this sprite. -
void set_affine_mat(optional<sprite_
affine_ mat_ ptr>&& affine_mat) - Sets or removes the sprite_
affine_ mat_ ptr attached to this sprite. - void remove_affine_mat()
- Removes the sprite_
affine_ mat_ ptr attached to this sprite (if any). - auto remove_affine_mat_when_not_needed() const -> bool
- Indicates if the sprite_
affine_ mat_ ptr attached to this sprite (if any) must be removed when it is not needed anymore. - void set_remove_affine_mat_when_not_needed(bool remove_when_not_needed)
- Sets if the sprite_
affine_ mat_ ptr attached to this sprite (if any) must be removed when it is not needed anymore. -
auto first_attributes() const -> sprite_
first_ attributes - Returns the attributes to commit to the first GBA register of this sprite.
-
void set_first_attributes(const sprite_
first_ attributes& first_attributes) - Sets the attributes to commit to the first GBA register of this sprite.
-
auto regular_second_attributes() const -> sprite_
regular_ second_ attributes - Returns the attributes to commit to the second GBA register of this sprite when it is regular (it does not have an attached sprite_
affine_ mat_ ptr). -
void set_regular_second_attributes(const sprite_
regular_ second_ attributes& second_attributes) - Sets the attributes to commit to the second GBA register of this sprite when it is regular (it does not have an attached sprite_
affine_ mat_ ptr). -
auto affine_second_attributes() const -> sprite_
affine_ second_ attributes - Returns the attributes to commit to the second GBA register of this sprite when it is affine (it hash an attached sprite_
affine_ mat_ ptr). -
void set_affine_second_attributes(const sprite_
affine_ second_ attributes& second_attributes) - Sets the attributes to commit to the second GBA register of this sprite when it is affine (it hash an attached sprite_
affine_ mat_ ptr). -
auto third_attributes() const -> sprite_
third_ attributes - Returns the attributes to commit to the third GBA register of this sprite.
-
void set_third_attributes(const sprite_
third_ attributes& third_attributes) - Sets the attributes to commit to the third GBA register of this sprite.
- auto handle() const -> const void*
- Returns the internal handle.
-
void swap(sprite_
ptr& other) - Exchanges the contents of this sprite_
ptr with those of the other one.
Friends
-
void swap(sprite_
ptr& a, sprite_ ptr& b) - Exchanges the contents of a sprite_
ptr with those of another one. -
auto operator==(const sprite_
ptr& a, const sprite_ ptr& b) -> bool defaulted - Default equal operator.
Function documentation
static sprite_ ptr bn:: sprite_ptr:: create(const sprite_ item& item)
Creates a sprite_
Parameters | |
---|---|
item | sprite_ |
Returns | The requested sprite_ |
static sprite_ ptr bn:: sprite_ptr:: create(const sprite_ item& item,
int graphics_index)
Creates a sprite_
Parameters | |
---|---|
item | sprite_ |
graphics_index | Index of the tile set to reference in item.tiles_item(). |
Returns | The requested sprite_ |
static sprite_ ptr bn:: sprite_ptr:: create(const sprite_ shape_ size& shape_size,
sprite_ tiles_ ptr tiles,
sprite_ palette_ ptr palette)
Creates a sprite_
Parameters | |
---|---|
shape_size | Shape and size of the sprite. |
tiles | Smart pointer to a sprite tile set. |
palette | Smart pointer to a sprite color palette. |
Returns | The requested sprite_ |
static sprite_ ptr bn:: sprite_ptr:: create(fixed x,
fixed y,
const sprite_ item& item)
Creates a sprite_
Parameters | |
---|---|
x | Horizontal position of the sprite. |
y | Vertical position of the sprite. |
item | sprite_ |
Returns | The requested sprite_ |
static sprite_ ptr bn:: sprite_ptr:: create(fixed x,
fixed y,
const sprite_ item& item,
int graphics_index)
Creates a sprite_
Parameters | |
---|---|
x | Horizontal position of the sprite. |
y | Vertical position of the sprite. |
item | sprite_ |
graphics_index | Index of the tile set to reference in item.tiles_item(). |
Returns | The requested sprite_ |
static sprite_ ptr bn:: sprite_ptr:: create(const fixed_ point& position,
const sprite_ item& item)
Creates a sprite_
Parameters | |
---|---|
position | Position of the sprite. |
item | sprite_ |
Returns | The requested sprite_ |
static sprite_ ptr bn:: sprite_ptr:: create(const fixed_ point& position,
const sprite_ item& item,
int graphics_index)
Creates a sprite_
Parameters | |
---|---|
position | Position of the sprite. |
item | sprite_ |
graphics_index | Index of the tile set to reference in item.tiles_item(). |
Returns | The requested sprite_ |
static sprite_ ptr bn:: sprite_ptr:: create(fixed x,
fixed y,
const sprite_ shape_ size& shape_size,
sprite_ tiles_ ptr tiles,
sprite_ palette_ ptr palette)
Creates a sprite_
Parameters | |
---|---|
x | Horizontal position of the sprite. |
y | Vertical position of the sprite. |
shape_size | Shape and size of the sprite. |
tiles | Smart pointer to a sprite tile set. |
palette | Smart pointer to a sprite color palette. |
Returns | The requested sprite_ |
static sprite_ ptr bn:: sprite_ptr:: create(const fixed_ point& position,
const sprite_ shape_ size& shape_size,
sprite_ tiles_ ptr tiles,
sprite_ palette_ ptr palette)
Creates a sprite_
Parameters | |
---|---|
position | Position of the sprite. |
shape_size | Shape and size of the sprite. |
tiles | Smart pointer to a sprite tile set. |
palette | Smart pointer to a sprite color palette. |
Returns | The requested sprite_ |
static sprite_ ptr bn:: sprite_ptr:: create(const sprite_ builder& builder)
Creates a sprite_
Parameters | |
---|---|
builder | sprite_ |
Returns | The requested sprite_ |
static sprite_ ptr bn:: sprite_ptr:: create(sprite_ builder&& builder)
Creates a sprite_
Parameters | |
---|---|
builder | sprite_ |
Returns | The requested sprite_ |
static optional<sprite_ ptr> bn:: sprite_ptr:: create_optional(const sprite_ item& item)
Creates a sprite_
Parameters | |
---|---|
item | sprite_ |
Returns | The requested sprite_ |
static optional<sprite_ ptr> bn:: sprite_ptr:: create_optional(const sprite_ item& item,
int graphics_index)
Creates a sprite_
Parameters | |
---|---|
item | sprite_ |
graphics_index | Index of the tile set to reference in item.tiles_item(). |
Returns | The requested sprite_ |
static optional<sprite_ ptr> bn:: sprite_ptr:: create_optional(const sprite_ shape_ size& shape_size,
sprite_ tiles_ ptr tiles,
sprite_ palette_ ptr palette)
Creates a sprite_
Parameters | |
---|---|
shape_size | Shape and size of the sprite. |
tiles | Smart pointer to a sprite tile set. |
palette | Smart pointer to a sprite color palette. |
Returns | The requested sprite_ |
static optional<sprite_ ptr> bn:: sprite_ptr:: create_optional(fixed x,
fixed y,
const sprite_ item& item)
Creates a sprite_
Parameters | |
---|---|
x | Horizontal position of the sprite. |
y | Vertical position of the sprite. |
item | sprite_ |
Returns | The requested sprite_ |
static optional<sprite_ ptr> bn:: sprite_ptr:: create_optional(fixed x,
fixed y,
const sprite_ item& item,
int graphics_index)
Creates a sprite_
Parameters | |
---|---|
x | Horizontal position of the sprite. |
y | Vertical position of the sprite. |
item | sprite_ |
graphics_index | Index of the tile set to reference in item.tiles_item(). |
Returns | The requested sprite_ |
static optional<sprite_ ptr> bn:: sprite_ptr:: create_optional(const fixed_ point& position,
const sprite_ item& item)
Creates a sprite_
Parameters | |
---|---|
position | Position of the sprite. |
item | sprite_ |
Returns | The requested sprite_ |
static optional<sprite_ ptr> bn:: sprite_ptr:: create_optional(const fixed_ point& position,
const sprite_ item& item,
int graphics_index)
Creates a sprite_
Parameters | |
---|---|
position | Position of the sprite. |
item | sprite_ |
graphics_index | Index of the tile set to reference in item.tiles_item(). |
Returns | The requested sprite_ |
static optional<sprite_ ptr> bn:: sprite_ptr:: create_optional(fixed x,
fixed y,
const sprite_ shape_ size& shape_size,
sprite_ tiles_ ptr tiles,
sprite_ palette_ ptr palette)
Creates a sprite_
Parameters | |
---|---|
x | Horizontal position of the sprite. |
y | Vertical position of the sprite. |
shape_size | Shape and size of the sprite. |
tiles | Smart pointer to a sprite tile set. |
palette | Smart pointer to a sprite color palette. |
Returns | The requested sprite_ |
static optional<sprite_ ptr> bn:: sprite_ptr:: create_optional(const fixed_ point& position,
const sprite_ shape_ size& shape_size,
sprite_ tiles_ ptr tiles,
sprite_ palette_ ptr palette)
Creates a sprite_
Parameters | |
---|---|
position | Position of the sprite. |
shape_size | Shape and size of the sprite. |
tiles | Smart pointer to a sprite tile set. |
palette | Smart pointer to a sprite color palette. |
Returns | The requested sprite_ |
static optional<sprite_ ptr> bn:: sprite_ptr:: create_optional(const sprite_ builder& builder)
Creates a sprite_
Parameters | |
---|---|
builder | sprite_ |
Returns | The requested sprite_ |
static optional<sprite_ ptr> bn:: sprite_ptr:: create_optional(sprite_ builder&& builder)
Creates a sprite_
Parameters | |
---|---|
builder | sprite_ |
Returns | The requested sprite_ |
bn:: sprite_ptr:: sprite_ptr(const sprite_ ptr& other)
Copy constructor.
Parameters | |
---|---|
other | sprite_ |
bn:: sprite_ptr:: sprite_ptr(sprite_ ptr&& other) noexcept
Move constructor.
Parameters | |
---|---|
other | sprite_ |
sprite_ ptr& bn:: sprite_ptr:: operator=(const sprite_ ptr& other)
Copy assignment operator.
Parameters | |
---|---|
other | sprite_ |
Returns | Reference to this. |
sprite_ ptr& bn:: sprite_ptr:: operator=(sprite_ ptr&& other) noexcept
Move assignment operator.
Parameters | |
---|---|
other | sprite_ |
Returns | Reference to this. |
void bn:: sprite_ptr:: set_tiles(const sprite_ tiles_ ptr& tiles)
Sets the tiles used by this sprite.
Parameters | |
---|---|
tiles | sprite_ |
It must be compatible with the current color palette, shape and size of the sprite.
void bn:: sprite_ptr:: set_tiles(sprite_ tiles_ ptr&& tiles)
Sets the tiles used by this sprite.
Parameters | |
---|---|
tiles | sprite_ |
It must be compatible with the current color palette, shape and size of the sprite.
void bn:: sprite_ptr:: set_tiles(const sprite_ shape_ size& shape_size,
const sprite_ tiles_ ptr& tiles)
Sets the tiles, the shape and size of the sprite.
Parameters | |
---|---|
shape_size | Shape and size of the sprite. |
tiles | sprite_ |
It must be compatible with the current color palette of the sprite.
void bn:: sprite_ptr:: set_tiles(const sprite_ shape_ size& shape_size,
sprite_ tiles_ ptr&& tiles)
Sets the tiles, the shape and size of the sprite.
Parameters | |
---|---|
shape_size | Shape and size of the sprite. |
tiles | sprite_ |
It must be compatible with the current color palette of the sprite.
void bn:: sprite_ptr:: set_tiles(const sprite_ tiles_ item& tiles_item)
Replaces the tiles used by this sprite with a new tile set created with the given sprite_
Parameters | |
---|---|
tiles_item | It creates the new sprite tiles to use by this sprite. |
Before creating a new sprite tile set, the sprite_
The new sprite tiles must be compatible with the current color palette, shape and size of the sprite.
void bn:: sprite_ptr:: set_tiles(const sprite_ tiles_ item& tiles_item,
int graphics_index)
Replaces the tiles used by this sprite with a new tile set created with the given sprite_
Parameters | |
---|---|
tiles_item | It creates the sprite tiles to use by this sprite. |
graphics_index | Index of the tile set to reference in tiles_item. |
Before creating a new sprite tile set, the sprite_
The new sprite tiles must be compatible with the current color palette, shape and size of the sprite.
void bn:: sprite_ptr:: set_tiles(const sprite_ tiles_ item& tiles_item,
const sprite_ shape_ size& shape_size)
Replaces the tiles used by this sprite with a new tile set created with the given sprite_
Parameters | |
---|---|
tiles_item | It creates the sprite tiles to use by this sprite. |
shape_size | Shape and size of the sprite. |
Before creating a new sprite tile set, the sprite_
The new sprite tiles must be compatible with the current color palette of the sprite.
void bn:: sprite_ptr:: set_tiles(const sprite_ tiles_ item& tiles_item,
const sprite_ shape_ size& shape_size,
int graphics_index)
Replaces the tiles used by this sprite with a new tile set created with the given sprite_
Parameters | |
---|---|
tiles_item | It creates the sprite tiles to use by this sprite. |
shape_size | Shape and size of the sprite. |
graphics_index | Index of the tile set to reference in tiles_item. |
Before creating a new sprite tile set, the sprite_
The new sprite tiles must be compatible with the current color palette of the sprite.
void bn:: sprite_ptr:: set_palette(const sprite_ palette_ ptr& palette)
Sets the color palette to use by this sprite.
Parameters | |
---|---|
palette | sprite_ |
It must be compatible with the current tiles of the sprite.
void bn:: sprite_ptr:: set_palette(sprite_ palette_ ptr&& palette)
Sets the color palette to use by this sprite.
Parameters | |
---|---|
palette | sprite_ |
It must be compatible with the current tiles of the sprite.
void bn:: sprite_ptr:: set_palette(const sprite_ palette_ item& palette_item)
Replaces the color palette used by this sprite with a new one created with the given sprite_
Parameters | |
---|---|
palette_item | It creates the color palette to use by this sprite. |
Before creating a new color palette, the sprite_
The new color palette must be compatible with the current tiles of the sprite.
void bn:: sprite_ptr:: set_tiles_and_palette(sprite_ tiles_ ptr tiles,
sprite_ palette_ ptr palette)
Sets the tiles and the color palette to use by this sprite.
Parameters | |
---|---|
tiles | sprite_ |
palette | sprite_ |
The given parameters must be compatible with the current shape and size of the sprite.
void bn:: sprite_ptr:: set_tiles_and_palette(const sprite_ shape_ size& shape_size,
sprite_ tiles_ ptr tiles,
sprite_ palette_ ptr palette)
Sets the tiles, the color palette, the shape and size to use by this sprite.
Parameters | |
---|---|
shape_size | Shape and size of the sprite. |
tiles | sprite_ |
palette | sprite_ |
void bn:: sprite_ptr:: set_item(const sprite_ item& item)
Replaces the tiles, the color palette, the shape and size used by this sprite with the created with the given sprite_
Parameters | |
---|---|
item | It creates the resources to use by this sprite. |
Before creating new resources, the resources used by this sprite are removed, so VRAM usage is reduced.
void bn:: sprite_ptr:: set_item(const sprite_ item& item,
int graphics_index)
Replaces the tiles, the color palette, the shape and size used by this sprite with the created with the given sprite_
Parameters | |
---|---|
item | It creates the resources to use by this sprite. |
graphics_index | Index of the tile set to reference in item.tiles_item(). |
Before creating new resources, the resources used by this sprite are removed, so VRAM usage is reduced.
void bn:: sprite_ptr:: set_position(fixed x,
fixed y)
Sets the position of the sprite (relative to its camera, if it has one).
Parameters | |
---|---|
x | Horizontal position of the sprite (relative to its camera, if it has one). |
y | Vertical position of the sprite (relative to its camera, if it has one). |
void bn:: sprite_ptr:: set_top_left_position(fixed top_left_x,
fixed top_left_y)
Sets the top-left position of the sprite (relative to its camera, if it has one).
Parameters | |
---|---|
top_left_x | Horizontal top-left position of the sprite (relative to its camera, if it has one). |
top_left_y | Vertical top-left position of the sprite (relative to its camera, if it has one). |
void bn:: sprite_ptr:: set_rotation_angle(fixed rotation_angle)
Sets the rotation angle in degrees of the sprite.
Parameters | |
---|---|
rotation_angle | Rotation angle in degrees, in the range [0..360]. |
If the rotation angle is != 0 and the sprite doesn't have an attached sprite_
void bn:: sprite_ptr:: set_rotation_angle_safe(fixed rotation_angle)
Sets the rotation angle in degrees of the sprite.
Parameters | |
---|---|
rotation_angle | Rotation angle in degrees, in any range. |
If the rotation angle is != 0 and the sprite doesn't have an attached sprite_
void bn:: sprite_ptr:: set_horizontal_scale(fixed horizontal_scale)
Sets the horizontal scale of the sprite.
If the horizontal scale is != 1 and the sprite doesn't have an attached sprite_
void bn:: sprite_ptr:: set_vertical_scale(fixed vertical_scale)
Sets the vertical scale of the sprite.
If the vertical scale is != 1 and the sprite doesn't have an attached sprite_
void bn:: sprite_ptr:: set_scale(fixed scale)
Sets the scale of the sprite.
If the scale is != 1 and the sprite doesn't have an attached sprite_
void bn:: sprite_ptr:: set_scale(fixed horizontal_scale,
fixed vertical_scale)
Sets the scale of the sprite.
Parameters | |
---|---|
horizontal_scale | Horizontal scale. |
vertical_scale | Vertical scale. |
If the scale is != 1 and the sprite doesn't have an attached sprite_
void bn:: sprite_ptr:: set_horizontal_shear(fixed horizontal_shear)
Sets the horizontal shear of the sprite.
If the horizontal shear is != 0 and the sprite doesn't have an attached sprite_
void bn:: sprite_ptr:: set_vertical_shear(fixed vertical_shear)
Sets the vertical shear of the sprite.
If the vertical shear is != 0 and the sprite doesn't have an attached sprite_
void bn:: sprite_ptr:: set_shear(fixed shear)
Sets the shear of the sprite.
If the shear is != 0 and the sprite doesn't have an attached sprite_
void bn:: sprite_ptr:: set_shear(fixed horizontal_shear,
fixed vertical_shear)
Sets the shear of the sprite.
Parameters | |
---|---|
horizontal_shear | Horizontal shear. |
vertical_shear | Vertical shear. |
If the shear is != 0 and the sprite doesn't have an attached sprite_
int bn:: sprite_ptr:: bg_priority() const
Returns the priority relative to backgrounds.
Sprites with higher priority are drawn first (and therefore can be covered by later sprites and backgrounds). Sprites cover backgrounds of the same priority.
void bn:: sprite_ptr:: set_bg_priority(int bg_priority)
Sets the priority relative to backgrounds.
Parameters | |
---|---|
bg_priority | Priority relative to backgrounds in the range [0..3]. |
Sprites with higher priority are drawn first (and therefore can be covered by later sprites and backgrounds). Sprites cover backgrounds of the same priority.
int bn:: sprite_ptr:: z_order() const
Returns the priority relative to other sprites.
Sprites with higher z orders are drawn first (and therefore can be covered by later sprites).
Sprites are grouped in layers depending of their background priority and z order, so to reduce memory usage and improve performance, please use as less unique z orders as possible.
void bn:: sprite_ptr:: set_z_order(int z_order)
Sets the priority relative to other sprites.
Parameters | |
---|---|
z_order | Priority relative to other sprites in the range [-32767..32767]. |
Sprites with higher z orders are drawn first (and therefore can be covered by later sprites).
Sprites are grouped in layers depending of their background priority and z order, so to reduce memory usage and improve performance, please use as less unique z orders as possible.
bool bn:: sprite_ptr:: blending_enabled() const
Indicates if blending must be applied to this sprite or not.
Keep in mind that blending and window attributes can't be enabled at the same time.
void bn:: sprite_ptr:: set_blending_enabled(bool blending_enabled)
Sets if blending must be applied to this sprite or not.
Keep in mind that blending and window attributes can't be enabled at the same time.
bool bn:: sprite_ptr:: window_enabled() const
Indicates if this sprite must be part of the silhouette of the sprite window or not.
Keep in mind that blending and window attributes can't be enabled at the same time.
void bn:: sprite_ptr:: set_window_enabled(bool window_enabled)
Sets if this sprite must be part of the silhouette of the sprite window or not.
Keep in mind that blending and window attributes can't be enabled at the same time.
void bn:: sprite_ptr:: set_camera(const camera_ ptr& camera)
Sets the camera_
Parameters | |
---|---|
camera | camera_ |
void bn:: sprite_ptr:: set_camera(camera_ ptr&& camera)
Sets the camera_
Parameters | |
---|---|
camera | camera_ |
void bn:: sprite_ptr:: set_camera(const optional<camera_ ptr>& camera)
Sets or removes the camera_
Parameters | |
---|---|
camera | Optional camera_ |
void bn:: sprite_ptr:: set_camera(optional<camera_ ptr>&& camera)
Sets or removes the camera_
Parameters | |
---|---|
camera | Optional camera_ |
void bn:: sprite_ptr:: set_affine_mat(const sprite_ affine_ mat_ ptr& affine_mat)
Sets the sprite_
Parameters | |
---|---|
affine_mat | sprite_ |
This method calls set_remove_affine_mat_when_not_needed(false).
void bn:: sprite_ptr:: set_affine_mat(sprite_ affine_ mat_ ptr&& affine_mat)
Sets the sprite_
Parameters | |
---|---|
affine_mat | sprite_ |
This method calls set_remove_affine_mat_when_not_needed(false).
void bn:: sprite_ptr:: set_affine_mat(const optional<sprite_ affine_ mat_ ptr>& affine_mat)
Sets or removes the sprite_
Parameters | |
---|---|
affine_mat | Optional sprite_ |
This method calls set_remove_affine_mat_when_not_needed(false) if the given sprite_
void bn:: sprite_ptr:: set_affine_mat(optional<sprite_ affine_ mat_ ptr>&& affine_mat)
Sets or removes the sprite_
Parameters | |
---|---|
affine_mat | Optional sprite_ |
This method calls set_remove_affine_mat_when_not_needed(false) if the given sprite_
bool bn:: sprite_ptr:: remove_affine_mat_when_not_needed() const
Indicates if the sprite_
A sprite does not need an sprite_true
.
void bn:: sprite_ptr:: set_remove_affine_mat_when_not_needed(bool remove_when_not_needed)
Sets if the sprite_
A sprite does not need an sprite_true
.
void bn:: sprite_ptr:: swap(sprite_ ptr& other)
Exchanges the contents of this sprite_
Parameters | |
---|---|
other | sprite_ |
void swap(sprite_ ptr& a,
sprite_ ptr& b)
Exchanges the contents of a sprite_
Parameters | |
---|---|
a | First sprite_ |
b | Second sprite_ |