palette_bitmap_bg_ptr class
#include <bn_palette_bitmap_bg_ptr.h>
std::shared_ptr like smart pointer that retains shared ownership of a palette bitmap background.
Several palette_
The background is released when the last remaining palette_
Public static functions
- static auto dimensions() -> size
- Returns the size in pixels of the backgrounds.
-
static auto create(const bg_
palette_ item& palette_item) -> palette_ bitmap_ bg_ ptr - Creates a palette_
bitmap_ bg_ ptr from the given bg_ palette_ item. -
static auto create(const bg_
palette_ ptr& palette) -> palette_ bitmap_ bg_ ptr - Creates a palette_
bitmap_ bg_ ptr from the given bg_ palette_ ptr. -
static auto create(bg_
palette_ ptr&& palette) -> palette_ bitmap_ bg_ ptr - Creates a palette_
bitmap_ bg_ ptr from a moved bg_ palette_ ptr. -
static auto create(const palette_
bitmap_ bg_ builder& builder) -> palette_ bitmap_ bg_ ptr - Creates a palette_
bitmap_ bg_ ptr from a palette_ bitmap_ bg_ builder reference. -
static auto create(palette_
bitmap_ bg_ builder&& builder) -> palette_ bitmap_ bg_ ptr - Creates a palette_
bitmap_ bg_ ptr from a moved palette_ bitmap_ bg_ builder. -
static auto create_optional(const bg_
palette_ item& palette_item) -> optional<palette_ bitmap_ bg_ ptr> - Creates a palette_
bitmap_ bg_ ptr from the given bg_ palette_ item. -
static auto create_optional(const bg_
palette_ ptr& palette) -> optional<palette_ bitmap_ bg_ ptr> - Creates a palette_
bitmap_ bg_ ptr from the given bg_ palette_ ptr. -
static auto create_optional(bg_
palette_ ptr&& palette) -> optional<palette_ bitmap_ bg_ ptr> - Creates a palette_
bitmap_ bg_ ptr from a moved bg_ palette_ ptr. -
static auto create_optional(const palette_
bitmap_ bg_ builder& builder) -> optional<palette_ bitmap_ bg_ ptr> - Creates a palette_
bitmap_ bg_ ptr from a palette_ bitmap_ bg_ builder reference. -
static auto create_optional(palette_
bitmap_ bg_ builder&& builder) -> optional<palette_ bitmap_ bg_ ptr> - Creates a palette_
bitmap_ bg_ ptr from a moved palette_ bitmap_ bg_ builder.
Constructors, destructors, conversion operators
-
palette_bitmap_bg_ptr(const palette_
bitmap_ bg_ ptr& other) - Copy constructor.
-
palette_bitmap_bg_ptr(palette_
bitmap_ bg_ ptr&& other) noexcept - Move constructor.
- ~palette_bitmap_bg_ptr()
- Releases the referenced background if no more palette_
bitmap_ bg_ ptr objects reference to it.
Public functions
-
auto operator=(const palette_
bitmap_ bg_ ptr& other) -> palette_ bitmap_ bg_ ptr& - Copy assignment operator.
-
auto operator=(palette_
bitmap_ bg_ ptr&& other) -> palette_ bitmap_ bg_ ptr& noexcept - Move assignment operator.
- auto page() const -> span<const uint16_t>
- Returns a span of the hidden frame buffer.
- auto page() -> span<uint16_t>
- Returns a span of the hidden frame buffer.
- void flip_page_later()
- Swaps the hidden frame buffer in the next core::
update call. - void flip_page_now()
- Swaps the hidden frame buffer without waiting to the next core::
update call. -
auto palette() const -> const bg_
palette_ ptr& - Returns the color palette used by this background.
-
void set_palette(const bg_
palette_ ptr& palette) - Sets the color palette to use by this background.
-
void set_palette(bg_
palette_ ptr&& palette) - Sets the color palette to use by this background.
-
void set_palette(const bg_
palette_ item& palette_item) - Replaces the color palette used by this background with a new one created with the given bg_
palette_ item. - auto x() const -> fixed
- Returns the horizontal position of the background (relative to its camera, if it has one).
- void set_x(fixed x)
- Sets the horizontal position of the background (relative to its camera, if it has one).
- auto y() const -> fixed
- Returns the vertical position of the background (relative to its camera, if it has one).
- void set_y(fixed y)
- Sets the vertical position of the background (relative to its camera, if it has one).
-
auto position() const -> const fixed_
point& - Returns the position of the background (relative to its camera, if it has one).
- void set_position(fixed x, fixed y)
- Sets the position of the background (relative to its camera, if it has one).
-
void set_position(const fixed_
point& position) - Sets the position of the background (relative to its camera, if it has one).
- auto top_left_x() const -> fixed
- Returns the horizontal top-left position of the background (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 background (relative to its camera, if it has one).
- auto top_left_y() const -> fixed
- Returns the vertical top-left position of the background (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 background (relative to its camera, if it has one).
-
auto top_left_position() const -> fixed_
point - Returns the top-left position of the background (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 background (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 background (relative to its camera, if it has one).
- auto rotation_angle() const -> fixed
- Returns the rotation angle in degrees of the background.
- void set_rotation_angle(fixed rotation_angle)
- Sets the rotation angle in degrees of the background.
- void set_rotation_angle_safe(fixed rotation_angle)
- Sets the rotation angle in degrees of the background.
- auto horizontal_scale() const -> fixed
- Returns the horizontal scale of the background.
- void set_horizontal_scale(fixed horizontal_scale)
- Sets the horizontal scale of the background.
- auto vertical_scale() const -> fixed
- Returns the vertical scale of the background.
- void set_vertical_scale(fixed vertical_scale)
- Sets the vertical scale of the background.
- void set_scale(fixed scale)
- Sets the scale of the background.
- void set_scale(fixed horizontal_scale, fixed vertical_scale)
- Sets the scale of the background.
- auto horizontal_shear() const -> fixed
- Returns the horizontal shear of the background.
- void set_horizontal_shear(fixed horizontal_shear)
- Sets the horizontal shear of the background.
- auto vertical_shear() const -> fixed
- Returns the vertical shear of the background.
- void set_vertical_shear(fixed vertical_shear)
- Sets the vertical shear of the background.
- void set_shear(fixed shear)
- Sets the shear of the background.
- void set_shear(fixed horizontal_shear, fixed vertical_shear)
- Sets the shear of the background.
- auto horizontal_flip() const -> bool
- Indicates if this background is flipped in the horizontal axis or not.
- void set_horizontal_flip(bool horizontal_flip)
- Sets if this background must be flipped in the horizontal axis or not.
- auto vertical_flip() const -> bool
- Indicates if this background must be flipped in the vertical axis or not.
- void set_vertical_flip(bool vertical_flip)
- Sets if this background must be flipped in the vertical axis or not.
- auto pivot_x() const -> fixed
- Returns the horizontal position of the affine transformations pivot point of this background.
- void set_pivot_x(fixed pivot_x)
- Sets the horizontal position of the affine transformations pivot point of this background.
- auto pivot_y() const -> fixed
- Returns the vertical position of the affine transformations pivot point of this background.
- void set_pivot_y(fixed pivot_y)
- Sets the vertical position of the affine transformations pivot point of this background.
-
auto pivot_position() const -> const fixed_
point& - Returns the position of the affine transformations pivot point of this background.
- void set_pivot_position(fixed pivot_x, fixed pivot_y)
- Sets the position of the affine transformations pivot point of this background.
-
void set_pivot_position(const fixed_
point& pivot_position) - Sets the position of the affine transformations pivot point of this background.
-
auto mat_attributes() const -> const affine_
bg_ mat_ attributes& - Returns the attributes of the position and the transformation matrix of this background.
-
void set_mat_attributes(const affine_
mat_ attributes& mat_attributes) - Sets the attributes of the affine transformation matrix of this background.
- auto priority() const -> int
- Returns the priority of the background relative to sprites and other backgrounds.
- void set_priority(int priority)
- Sets the priority of the background relative to sprites and other backgrounds.
- auto mosaic_enabled() const -> bool
- Indicates if the mosaic effect must be applied to this background or not.
- void set_mosaic_enabled(bool mosaic_enabled)
- Sets if the mosaic effect must be applied to this background or not.
- auto blending_enabled() const -> bool
- Indicates if blending must be applied to this background or not.
- void set_blending_enabled(bool blending_enabled)
- Sets if blending must be applied to this background or not.
- auto blending_top_enabled() const -> bool
- Indicates if this background is part of the blending top layer or not.
- void set_blending_top_enabled(bool blending_top_enabled)
- Sets if this background is part of the blending top layer or not.
- auto blending_bottom_enabled() const -> bool
- Indicates if this background is part of the blending bottom layer or not.
- void set_blending_bottom_enabled(bool blending_bottom_enabled)
- Sets if this background is part of the blending bottom layer or not.
-
auto green_swap_mode() const -> bn::
green_swap_mode - Indicates how this background must be displayed when green swap is enabled.
-
void set_green_swap_mode(bn::
green_swap_mode green_swap_mode) - Sets how this background must be displayed when green swap is enabled.
- auto visible() const -> bool
- Indicates if this background must be committed to the GBA or not.
- void set_visible(bool visible)
- Sets if this background must be committed to the GBA or not.
- auto visible_in_window(const window& window) const -> bool
- Indicates if this background is visible in the given window or not.
- void set_visible_in_window(bool visible, window& window)
- Sets if this background must be visible in the given window or not.
-
auto camera() const -> const optional<camera_
ptr>& - Returns the camera_
ptr attached to this background (if any). -
void set_camera(const camera_
ptr& camera) - Sets the camera_
ptr attached to this background. -
void set_camera(camera_
ptr&& camera) - Sets the camera_
ptr attached to this background. -
void set_camera(const optional<camera_
ptr>& camera) - Sets or removes the camera_
ptr attached to this background. -
void set_camera(optional<camera_
ptr>&& camera) - Sets or removes the camera_
ptr attached to this background. - void remove_camera()
- Removes the camera_
ptr attached to this background (if any). -
auto attributes() const -> bitmap_
bg_ attributes - Returns the attributes to commit to the GBA for this background.
-
void set_attributes(const bitmap_
bg_ attributes& attributes) - Sets the attributes to commit to the GBA for this background.
- auto hw_id() const -> optional<int>
- Returns the hardware ID assigned to this background or bn::
nullopt if no hardware ID has been assigned. - auto handle() const -> const void*
- Returns the internal handle.
-
void swap(palette_
bitmap_ bg_ ptr& other) - Exchanges the contents of this palette_
bitmap_ bg_ ptr with those of the other one.
Friends
-
void swap(palette_
bitmap_ bg_ ptr& a, palette_ bitmap_ bg_ ptr& b) - Exchanges the contents of an palette_
bitmap_ bg_ ptr with those of another one. -
auto operator==(const palette_
bitmap_ bg_ ptr& a, const palette_ bitmap_ bg_ ptr& b) -> bool defaulted - Default equal operator.
Function documentation
static palette_ bitmap_ bg_ ptr bn:: palette_bitmap_bg_ptr:: create(const bg_ palette_ item& palette_item)
Creates a palette_
| Parameters | |
|---|---|
| palette_item | bg_ |
| Returns | The requested palette_ |
static palette_ bitmap_ bg_ ptr bn:: palette_bitmap_bg_ptr:: create(const bg_ palette_ ptr& palette)
Creates a palette_
| Parameters | |
|---|---|
| palette | bg_ |
| Returns | The requested palette_ |
static palette_ bitmap_ bg_ ptr bn:: palette_bitmap_bg_ptr:: create(bg_ palette_ ptr&& palette)
Creates a palette_
| Parameters | |
|---|---|
| palette | bg_ |
| Returns | The requested palette_ |
static palette_ bitmap_ bg_ ptr bn:: palette_bitmap_bg_ptr:: create(const palette_ bitmap_ bg_ builder& builder)
Creates a palette_
| Parameters | |
|---|---|
| builder | palette_ |
| Returns | The requested palette_ |
static palette_ bitmap_ bg_ ptr bn:: palette_bitmap_bg_ptr:: create(palette_ bitmap_ bg_ builder&& builder)
Creates a palette_
| Parameters | |
|---|---|
| builder | palette_ |
| Returns | The requested palette_ |
static optional<palette_ bitmap_ bg_ ptr> bn:: palette_bitmap_bg_ptr:: create_optional(const bg_ palette_ item& palette_item)
Creates a palette_
| Parameters | |
|---|---|
| palette_item | bg_ |
| Returns | The requested palette_ |
static optional<palette_ bitmap_ bg_ ptr> bn:: palette_bitmap_bg_ptr:: create_optional(const bg_ palette_ ptr& palette)
Creates a palette_
| Parameters | |
|---|---|
| palette | bg_ |
| Returns | The requested palette_ |
static optional<palette_ bitmap_ bg_ ptr> bn:: palette_bitmap_bg_ptr:: create_optional(bg_ palette_ ptr&& palette)
Creates a palette_
| Parameters | |
|---|---|
| palette | bg_ |
| Returns | The requested palette_ |
static optional<palette_ bitmap_ bg_ ptr> bn:: palette_bitmap_bg_ptr:: create_optional(const palette_ bitmap_ bg_ builder& builder)
Creates a palette_
| Parameters | |
|---|---|
| builder | palette_ |
| Returns | The requested palette_ |
static optional<palette_ bitmap_ bg_ ptr> bn:: palette_bitmap_bg_ptr:: create_optional(palette_ bitmap_ bg_ builder&& builder)
Creates a palette_
| Parameters | |
|---|---|
| builder | palette_ |
| Returns | The requested palette_ |
bn:: palette_bitmap_bg_ptr:: palette_bitmap_bg_ptr(const palette_ bitmap_ bg_ ptr& other)
Copy constructor.
| Parameters | |
|---|---|
| other | palette_ |
bn:: palette_bitmap_bg_ptr:: palette_bitmap_bg_ptr(palette_ bitmap_ bg_ ptr&& other) noexcept
Move constructor.
| Parameters | |
|---|---|
| other | palette_ |
palette_ bitmap_ bg_ ptr& bn:: palette_bitmap_bg_ptr:: operator=(const palette_ bitmap_ bg_ ptr& other)
Copy assignment operator.
| Parameters | |
|---|---|
| other | palette_ |
| Returns | Reference to this. |
palette_ bitmap_ bg_ ptr& bn:: palette_bitmap_bg_ptr:: operator=(palette_ bitmap_ bg_ ptr&& other) noexcept
Move assignment operator.
| Parameters | |
|---|---|
| other | palette_ |
| Returns | Reference to this. |
void bn:: palette_bitmap_bg_ptr:: flip_page_now()
Swaps the hidden frame buffer without waiting to the next core::
Expect lack of vsync issues like screen tearing.
void bn:: palette_bitmap_bg_ptr:: set_palette(const bg_ palette_ ptr& palette)
Sets the color palette to use by this background.
| Parameters | |
|---|---|
| palette | bg_ |
void bn:: palette_bitmap_bg_ptr:: set_palette(bg_ palette_ ptr&& palette)
Sets the color palette to use by this background.
| Parameters | |
|---|---|
| palette | bg_ |
void bn:: palette_bitmap_bg_ptr:: set_palette(const bg_ palette_ item& palette_item)
Replaces the color palette used by this background with a new one created with the given bg_
| Parameters | |
|---|---|
| palette_item | It creates the color palette to use by this background. |
Before creating a new color palette, the bg_
void bn:: palette_bitmap_bg_ptr:: set_position(fixed x,
fixed y)
Sets the position of the background (relative to its camera, if it has one).
| Parameters | |
|---|---|
| x | Horizontal position of the background (relative to its camera, if it has one). |
| y | Vertical position of the background (relative to its camera, if it has one). |
void bn:: palette_bitmap_bg_ptr:: set_top_left_position(fixed top_left_x,
fixed top_left_y)
Sets the top-left position of the background (relative to its camera, if it has one).
| Parameters | |
|---|---|
| top_left_x | Horizontal top-left position of the background (relative to its camera, if it has one). |
| top_left_y | Vertical top-left position of the background (relative to its camera, if it has one). |
void bn:: palette_bitmap_bg_ptr:: set_rotation_angle(fixed rotation_angle)
Sets the rotation angle in degrees of the background.
| Parameters | |
|---|---|
| rotation_angle | Rotation angle in degrees, in the range [0..360]. |
void bn:: palette_bitmap_bg_ptr:: set_rotation_angle_safe(fixed rotation_angle)
Sets the rotation angle in degrees of the background.
| Parameters | |
|---|---|
| rotation_angle | Rotation angle in degrees, in any range. |
void bn:: palette_bitmap_bg_ptr:: set_pivot_position(fixed pivot_x,
fixed pivot_y)
Sets the position of the affine transformations pivot point of this background.
| Parameters | |
|---|---|
| pivot_x | Horizontal position of the pivot point. |
| pivot_y | Vertical position of the pivot point. |
void bn:: palette_bitmap_bg_ptr:: set_pivot_position(const fixed_ point& pivot_position)
Sets the position of the affine transformations pivot point of this background.
| Parameters | |
|---|---|
| pivot_position | Position of the pivot point. |
int bn:: palette_bitmap_bg_ptr:: priority() const
Returns the priority of the background relative to sprites and other backgrounds.
Backgrounds with higher priority are drawn first (and therefore can be covered by later sprites and backgrounds).
void bn:: palette_bitmap_bg_ptr:: set_priority(int priority)
Sets the priority of the background relative to sprites and other backgrounds.
| Parameters | |
|---|---|
| priority | Priority in the range [0..3]. |
Backgrounds with higher priority are drawn first (and therefore can be covered by later sprites and backgrounds).
bool bn:: palette_bitmap_bg_ptr:: blending_enabled() const
Indicates if blending must be applied to this background or not.
Blending is applied to this background by making it part of the blending top layer.
void bn:: palette_bitmap_bg_ptr:: set_blending_enabled(bool blending_enabled)
Sets if blending must be applied to this background or not.
Blending is applied to this background by making it part of the blending top layer.
void bn:: palette_bitmap_bg_ptr:: set_camera(const camera_ ptr& camera)
Sets the camera_
| Parameters | |
|---|---|
| camera | camera_ |
void bn:: palette_bitmap_bg_ptr:: set_camera(camera_ ptr&& camera)
Sets the camera_
| Parameters | |
|---|---|
| camera | camera_ |
void bn:: palette_bitmap_bg_ptr:: set_camera(const optional<camera_ ptr>& camera)
Sets or removes the camera_
| Parameters | |
|---|---|
| camera | Optional camera_ |
void bn:: palette_bitmap_bg_ptr:: set_camera(optional<camera_ ptr>&& camera)
Sets or removes the camera_
| Parameters | |
|---|---|
| camera | Optional camera_ |
optional<int> bn:: palette_bitmap_bg_ptr:: hw_id() const
Returns the hardware ID assigned to this background or bn::
Normally you should not need to call this function, but it can be useful for messing with HDMA for example.
A background doesn't have an assigned hardware ID if it is not visible.
Assigned hardware ID can change after calling this method if some properties of this background or others are updated.
Call this method at your own risk.
void bn:: palette_bitmap_bg_ptr:: swap(palette_ bitmap_ bg_ ptr& other)
Exchanges the contents of this palette_
| Parameters | |
|---|---|
| other | palette_ |
void swap(palette_ bitmap_ bg_ ptr& a,
palette_ bitmap_ bg_ ptr& b)
Exchanges the contents of an palette_
| Parameters | |
|---|---|
| a | First palette_ |
| b | Second palette_ |