dp_direct_bitmap_bg_ptr class
#include <bn_dp_direct_bitmap_bg_ptr.h>
std::shared_ptr like smart pointer that retains shared ownership of a dual page direct bitmap background.
Several dp_
The background is released when the last remaining dp_
Public static functions
- static auto dimensions() -> size
- Returns the size in pixels of the backgrounds.
-
static auto create() -> dp_
direct_ bitmap_ bg_ ptr - Creates a dp_
direct_ bitmap_ bg_ ptr. -
static auto create(const dp_
direct_ bitmap_ bg_ builder& builder) -> dp_ direct_ bitmap_ bg_ ptr - Creates a dp_
direct_ bitmap_ bg_ ptr from a dp_ direct_ bitmap_ bg_ builder reference. -
static auto create(dp_
direct_ bitmap_ bg_ builder&& builder) -> dp_ direct_ bitmap_ bg_ ptr - Creates a dp_
direct_ bitmap_ bg_ ptr from a moved dp_ direct_ bitmap_ bg_ builder. -
static auto create_optional() -> optional<dp_
direct_ bitmap_ bg_ ptr> - Creates a dp_
direct_ bitmap_ bg_ ptr from a dp_ direct_ bitmap_ bg_ builder reference. -
static auto create_optional(const dp_
direct_ bitmap_ bg_ builder& builder) -> optional<dp_ direct_ bitmap_ bg_ ptr> - Creates a dp_
direct_ bitmap_ bg_ ptr from a dp_ direct_ bitmap_ bg_ builder reference. -
static auto create_optional(dp_
direct_ bitmap_ bg_ builder&& builder) -> optional<dp_ direct_ bitmap_ bg_ ptr> - Creates a dp_
direct_ bitmap_ bg_ ptr from a moved dp_ direct_ bitmap_ bg_ builder.
Constructors, destructors, conversion operators
-
dp_direct_bitmap_bg_ptr(const dp_
direct_ bitmap_ bg_ ptr& other) - Copy constructor.
-
dp_direct_bitmap_bg_ptr(dp_
direct_ bitmap_ bg_ ptr&& other) noexcept - Move constructor.
- ~dp_direct_bitmap_bg_ptr()
- Releases the referenced background if no more dp_
direct_ bitmap_ bg_ ptr objects reference to it.
Public functions
-
auto operator=(const dp_
direct_ bitmap_ bg_ ptr& other) -> dp_ direct_ bitmap_ bg_ ptr& - Copy assignment operator.
-
auto operator=(dp_
direct_ bitmap_ bg_ ptr&& other) -> dp_ direct_ bitmap_ bg_ ptr& noexcept - Move assignment operator.
- auto page() const -> span<const color>
- Returns a span of the hidden frame buffer.
- auto page() -> span<color>
- 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 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.
- void expand()
- Scales the background to fill the screen.
- 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(dp_
direct_ bitmap_ bg_ ptr& other) - Exchanges the contents of this dp_
direct_ bitmap_ bg_ ptr with those of the other one.
Friends
-
void swap(dp_
direct_ bitmap_ bg_ ptr& a, dp_ direct_ bitmap_ bg_ ptr& b) - Exchanges the contents of an dp_
direct_ bitmap_ bg_ ptr with those of another one. -
auto operator==(const dp_
direct_ bitmap_ bg_ ptr& a, const dp_ direct_ bitmap_ bg_ ptr& b) -> bool defaulted - Default equal operator.
Function documentation
static dp_ direct_ bitmap_ bg_ ptr bn:: dp_direct_bitmap_bg_ptr:: create(const dp_ direct_ bitmap_ bg_ builder& builder)
Creates a dp_
| Parameters | |
|---|---|
| builder | dp_ |
| Returns | The requested dp_ |
static dp_ direct_ bitmap_ bg_ ptr bn:: dp_direct_bitmap_bg_ptr:: create(dp_ direct_ bitmap_ bg_ builder&& builder)
Creates a dp_
| Parameters | |
|---|---|
| builder | dp_ |
| Returns | The requested dp_ |
static optional<dp_ direct_ bitmap_ bg_ ptr> bn:: dp_direct_bitmap_bg_ptr:: create_optional(const dp_ direct_ bitmap_ bg_ builder& builder)
Creates a dp_
| Parameters | |
|---|---|
| builder | dp_ |
| Returns | The requested dp_ |
static optional<dp_ direct_ bitmap_ bg_ ptr> bn:: dp_direct_bitmap_bg_ptr:: create_optional(dp_ direct_ bitmap_ bg_ builder&& builder)
Creates a dp_
| Parameters | |
|---|---|
| builder | dp_ |
| Returns | The requested dp_ |
bn:: dp_direct_bitmap_bg_ptr:: dp_direct_bitmap_bg_ptr(const dp_ direct_ bitmap_ bg_ ptr& other)
Copy constructor.
| Parameters | |
|---|---|
| other | dp_ |
bn:: dp_direct_bitmap_bg_ptr:: dp_direct_bitmap_bg_ptr(dp_ direct_ bitmap_ bg_ ptr&& other) noexcept
Move constructor.
| Parameters | |
|---|---|
| other | dp_ |
dp_ direct_ bitmap_ bg_ ptr& bn:: dp_direct_bitmap_bg_ptr:: operator=(const dp_ direct_ bitmap_ bg_ ptr& other)
Copy assignment operator.
| Parameters | |
|---|---|
| other | dp_ |
| Returns | Reference to this. |
dp_ direct_ bitmap_ bg_ ptr& bn:: dp_direct_bitmap_bg_ptr:: operator=(dp_ direct_ bitmap_ bg_ ptr&& other) noexcept
Move assignment operator.
| Parameters | |
|---|---|
| other | dp_ |
| Returns | Reference to this. |
void bn:: dp_direct_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:: dp_direct_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:: dp_direct_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:: dp_direct_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:: dp_direct_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:: dp_direct_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:: dp_direct_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:: dp_direct_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:: dp_direct_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:: dp_direct_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:: dp_direct_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:: dp_direct_bitmap_bg_ptr:: set_camera(const camera_ ptr& camera)
Sets the camera_
| Parameters | |
|---|---|
| camera | camera_ |
void bn:: dp_direct_bitmap_bg_ptr:: set_camera(camera_ ptr&& camera)
Sets the camera_
| Parameters | |
|---|---|
| camera | camera_ |
void bn:: dp_direct_bitmap_bg_ptr:: set_camera(const optional<camera_ ptr>& camera)
Sets or removes the camera_
| Parameters | |
|---|---|
| camera | Optional camera_ |
void bn:: dp_direct_bitmap_bg_ptr:: set_camera(optional<camera_ ptr>&& camera)
Sets or removes the camera_
| Parameters | |
|---|---|
| camera | Optional camera_ |
optional<int> bn:: dp_direct_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:: dp_direct_bitmap_bg_ptr:: swap(dp_ direct_ bitmap_ bg_ ptr& other)
Exchanges the contents of this dp_
| Parameters | |
|---|---|
| other | dp_ |
void swap(dp_ direct_ bitmap_ bg_ ptr& a,
dp_ direct_ bitmap_ bg_ ptr& b)
Exchanges the contents of an dp_
| Parameters | |
|---|---|
| a | First dp_ |
| b | Second dp_ |