bn::affine_bg_builder class

Creates affine_bg_map_ptr objects with custom attributes.

If some of the attributes of the affine background to create differs from the default ones, using this class improves performance.

Constructors, destructors, conversion operators

affine_bg_builder(const affine_bg_item& item) explicit
Constructor.
affine_bg_builder(const affine_bg_map_ptr& map) explicit
Constructor.
affine_bg_builder(affine_bg_map_ptr&& map) explicit
Constructor.

Public functions

auto item() const -> const optional<affine_bg_item>&
Returns the affine_bg_item containing the required information to generate affine backgrounds if it has one; bn::nullopt otherwise.
auto x() const -> fixed
Returns the horizontal position of the affine backgrounds to generate (relative to their camera, if they are going to have one).
auto set_x(fixed x) -> affine_bg_builder&
Sets the horizontal position of the affine backgrounds to generate (relative to their camera, if they are going to have one).
auto y() const -> fixed
Returns the vertical position of the affine backgrounds to generate (relative to their camera, if they are going to have one).
auto set_y(fixed y) -> affine_bg_builder&
Sets the vertical position of the affine backgrounds to generate (relative to their camera, if they are going to have one).
auto position() const -> const fixed_point&
Returns the position of the affine backgrounds to generate (relative to their camera, if they are going to have one).
auto set_position(fixed x, fixed y) -> affine_bg_builder&
Sets the position of the affine backgrounds to generate (relative to their camera, if they are going to have one).
auto set_position(const fixed_point& position) -> affine_bg_builder&
Sets the position of the affine backgrounds to generate (relative to their camera, if they are going to have one).
auto rotation_angle() const -> fixed
Returns the rotation angle in degrees of the affine backgrounds to generate.
auto set_rotation_angle(fixed rotation_angle) -> affine_bg_builder&
Sets the rotation angle in degrees of the affine backgrounds to generate.
auto horizontal_scale() const -> fixed
Returns the horizontal scale of the affine backgrounds to generate.
auto set_horizontal_scale(fixed horizontal_scale) -> affine_bg_builder&
Sets the horizontal scale of the affine backgrounds to generate.
auto vertical_scale() const -> fixed
Returns the vertical scale of the affine backgrounds to generate.
auto set_vertical_scale(fixed vertical_scale) -> affine_bg_builder&
Sets the vertical scale of the affine backgrounds to generate.
auto set_scale(fixed scale) -> affine_bg_builder&
Sets the scale of the affine backgrounds to generate.
auto set_scale(fixed horizontal_scale, fixed vertical_scale) -> affine_bg_builder&
Sets the scale of the affine backgrounds to generate.
auto horizontal_shear() const -> fixed
Returns the horizontal shear of the affine backgrounds to generate.
auto set_horizontal_shear(fixed horizontal_shear) -> affine_bg_builder&
Sets the horizontal shear of the affine backgrounds to generate.
auto vertical_shear() const -> fixed
Returns the vertical shear of the affine backgrounds to generate.
auto set_vertical_shear(fixed vertical_shear) -> affine_bg_builder&
Sets the vertical shear of the affine backgrounds to generate.
auto set_shear(fixed shear) -> affine_bg_builder&
Sets the shear of the affine backgrounds to generate.
auto set_shear(fixed horizontal_shear, fixed vertical_shear) -> affine_bg_builder&
Sets the shear of the affine backgrounds to generate.
auto horizontal_flip() const -> bool
Indicates if the affine backgrounds to generate are flipped in the horizontal axis or not.
auto set_horizontal_flip(bool horizontal_flip) -> affine_bg_builder&
Sets if the affine backgrounds to generate must be flipped in the horizontal axis or not.
auto vertical_flip() const -> bool
Indicates if the affine backgrounds to generate are flipped in the vertical axis or not.
auto set_vertical_flip(bool vertical_flip) -> affine_bg_builder&
Sets if the affine backgrounds to generate 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 the affine backgrounds to generate.
void set_pivot_x(fixed pivot_x)
Sets the horizontal position of the affine transformations pivot point of the affine backgrounds to generate.
auto pivot_y() const -> fixed
Returns the vertical position of the affine transformations pivot point of the affine backgrounds to generate.
void set_pivot_y(fixed pivot_y)
Sets the vertical position of the affine transformations pivot point of the affine backgrounds to generate.
auto pivot_position() const -> const fixed_point&
Returns the position of the affine transformations pivot point of the affine backgrounds to generate.
void set_pivot_position(fixed pivot_x, fixed pivot_y)
Sets the position of the affine transformations pivot point of the affine backgrounds to generate.
void set_pivot_position(const fixed_point& pivot_position)
Sets the position of the affine transformations pivot point of the affine backgrounds to generate.
auto mat_attributes() const -> const affine_mat_attributes&
Returns the attributes of the affine transformation matrix of the affine backgrounds to generate.
auto set_affine_mat(const affine_mat_attributes& mat_attributes) -> affine_bg_builder&
Sets the attributes of the affine transformation matrix of the affine backgrounds to generate.
auto priority() const -> int
Returns the priority of the affine backgrounds to generate relative to sprites and other backgrounds.
auto set_priority(int priority) -> affine_bg_builder&
Sets the priority of the affine backgrounds to generate relative to sprites and other backgrounds.
auto z_order() const -> int
Returns the priority of the affine backgrounds to generate relative to other backgrounds, excluding sprites.
auto set_z_order(int z_order) -> affine_bg_builder&
Sets the priority of the affine backgrounds to generate relative to other backgrounds, excluding sprites.
auto wrapping_enabled() const -> bool
Indicates if the affine backgrounds to generate wrap around at the edges or not.
auto set_wrapping_enabled(bool wrapping_enabled) -> affine_bg_builder&
Sets if the affine backgrounds to generate must wrap around at the edges or not.
auto mosaic_enabled() const -> bool
Indicates if the mosaic effect must be applied to the affine backgrounds to generate or not.
auto set_mosaic_enabled(bool mosaic_enabled) -> affine_bg_builder&
Sets if the mosaic effect must be applied to the affine backgrounds to generate or not.
auto blending_enabled() const -> bool
Indicates if blending must be applied to the affine backgrounds to generate or not.
auto set_blending_enabled(bool blending_enabled) -> affine_bg_builder&
Sets if blending must be applied to the affine backgrounds to generate or not.
auto visible() const -> bool
Indicates if the affine backgrounds to generate must be committed to the GBA or not.
auto set_visible(bool visible) -> affine_bg_builder&
Sets if the affine backgrounds to generate must be committed to the GBA or not.
auto camera() const -> const optional<camera_ptr>&
Returns the camera_ptr to attach to the affine backgrounds to generate (if any).
auto set_camera(const camera_ptr& camera) -> affine_bg_builder&
Sets the camera_ptr to attach to the affine backgrounds to generate.
auto set_camera(camera_ptr&& camera) -> affine_bg_builder&
Sets the camera_ptr to attach to the affine backgrounds to generate.
auto set_camera(const optional<camera_ptr>& camera) -> affine_bg_builder&
Sets or removes the camera_ptr to attach to the affine backgrounds to generate.
auto set_camera(optional<camera_ptr>&& camera) -> affine_bg_builder&
Sets or removes the camera_ptr to attach to the affine backgrounds to generate.
auto remove_camera() -> affine_bg_builder&
Removes the camera_ptr to attach to the affine backgrounds to generate.
auto release_camera() -> optional<camera_ptr>
Releases and returns the camera_ptr to attach to the affine backgrounds to generate (if any).
auto build() const -> affine_bg_ptr
Generates and returns an affine_bg_ptr without releasing the acquired resources.
auto release_build() -> affine_bg_ptr
Generates and returns an affine_bg_ptr releasing the acquired resources.
auto build_optional() const -> optional<affine_bg_ptr>
Generates and returns an affine_bg_ptr without releasing the acquired resources if it could be allocated; bn::nullopt otherwise.
auto release_build_optional() -> optional<affine_bg_ptr>
Generates and returns an affine_bg_ptr releasing the acquired resources if it could be allocated; bn::nullopt otherwise.
auto map() const -> affine_bg_map_ptr
Generates and returns an affine_bg_map_ptr without releasing the acquired resources.
auto map_optional() const -> optional<affine_bg_map_ptr>
Generates and returns an affine_bg_map_ptr without releasing the acquired resources if it could be allocated; bn::nullopt otherwise.
auto release_map() -> affine_bg_map_ptr
Generates and returns an affine_bg_map_ptr releasing the acquired resources.
auto release_map_optional() -> optional<affine_bg_map_ptr>
Generates and returns an affine_bg_map_ptr releasing the acquired resources if it could be allocated; bn::nullopt otherwise.

Function documentation

bn::affine_bg_builder::affine_bg_builder(const affine_bg_item& item) explicit

Constructor.

Parameters
item affine_bg_item containing the required information to generate affine backgrounds.

bn::affine_bg_builder::affine_bg_builder(const affine_bg_map_ptr& map) explicit

Constructor.

Parameters
map affine_bg_map_ptr to copy for generating affine backgrounds.

bn::affine_bg_builder::affine_bg_builder(affine_bg_map_ptr&& map) explicit

Constructor.

Parameters
map affine_bg_map_ptr to move for generating affine backgrounds.

affine_bg_builder& bn::affine_bg_builder::set_x(fixed x)

Sets the horizontal position of the affine backgrounds to generate (relative to their camera, if they are going to have one).

Parameters
x Horizontal position of the affine backgrounds to generate.
Returns Reference to this.

affine_bg_builder& bn::affine_bg_builder::set_y(fixed y)

Sets the vertical position of the affine backgrounds to generate (relative to their camera, if they are going to have one).

Parameters
y vertical position of the affine backgrounds to generate.
Returns Reference to this.

affine_bg_builder& bn::affine_bg_builder::set_position(fixed x, fixed y)

Sets the position of the affine backgrounds to generate (relative to their camera, if they are going to have one).

Parameters
x Horizontal position of the affine backgrounds to generate.
y Vertical position of the affine backgrounds to generate.
Returns Reference to this.

affine_bg_builder& bn::affine_bg_builder::set_position(const fixed_point& position)

Sets the position of the affine backgrounds to generate (relative to their camera, if they are going to have one).

Parameters
position Position of the affine backgrounds to generate.
Returns Reference to this.

affine_bg_builder& bn::affine_bg_builder::set_rotation_angle(fixed rotation_angle)

Sets the rotation angle in degrees of the affine backgrounds to generate.

Parameters
rotation_angle Rotation angle in degrees, in the range [0..360].
Returns Reference to this.

affine_bg_builder& bn::affine_bg_builder::set_horizontal_scale(fixed horizontal_scale)

Sets the horizontal scale of the affine backgrounds to generate.

Parameters
horizontal_scale Horizontal scale of the affine backgrounds to generate.
Returns Reference to this.

affine_bg_builder& bn::affine_bg_builder::set_vertical_scale(fixed vertical_scale)

Sets the vertical scale of the affine backgrounds to generate.

Parameters
vertical_scale Vertical scale of the affine backgrounds to generate.
Returns Reference to this.

affine_bg_builder& bn::affine_bg_builder::set_scale(fixed scale)

Sets the scale of the affine backgrounds to generate.

Parameters
scale Scale of the affine backgrounds to generate.
Returns Reference to this.

affine_bg_builder& bn::affine_bg_builder::set_scale(fixed horizontal_scale, fixed vertical_scale)

Sets the scale of the affine backgrounds to generate.

Parameters
horizontal_scale Horizontal scale of the affine backgrounds to generate.
vertical_scale Vertical scale of the affine backgrounds to generate.
Returns Reference to this.

affine_bg_builder& bn::affine_bg_builder::set_horizontal_shear(fixed horizontal_shear)

Sets the horizontal shear of the affine backgrounds to generate.

Parameters
horizontal_shear Horizontal shear of the affine backgrounds to generate.
Returns Reference to this.

affine_bg_builder& bn::affine_bg_builder::set_vertical_shear(fixed vertical_shear)

Sets the vertical shear of the affine backgrounds to generate.

Parameters
vertical_shear Vertical shear of the affine backgrounds to generate.
Returns Reference to this.

affine_bg_builder& bn::affine_bg_builder::set_shear(fixed shear)

Sets the shear of the affine backgrounds to generate.

Parameters
shear Shear of the affine backgrounds to generate.
Returns Reference to this.

affine_bg_builder& bn::affine_bg_builder::set_shear(fixed horizontal_shear, fixed vertical_shear)

Sets the shear of the affine backgrounds to generate.

Parameters
horizontal_shear Horizontal shear of the affine backgrounds to generate.
vertical_shear Vertical shear of the affine backgrounds to generate.
Returns Reference to this.

affine_bg_builder& bn::affine_bg_builder::set_horizontal_flip(bool horizontal_flip)

Sets if the affine backgrounds to generate must be flipped in the horizontal axis or not.

Parameters
horizontal_flip true if the affine backgrounds must be flipped in the horizontal axis; false otherwise.
Returns Reference to this.

affine_bg_builder& bn::affine_bg_builder::set_vertical_flip(bool vertical_flip)

Sets if the affine backgrounds to generate must be flipped in the vertical axis or not.

Parameters
vertical_flip true if the affine backgrounds must be flipped in the vertical axis; false otherwise.
Returns Reference to this.

void bn::affine_bg_builder::set_pivot_position(fixed pivot_x, fixed pivot_y)

Sets the position of the affine transformations pivot point of the affine backgrounds to generate.

Parameters
pivot_x Horizontal position of the pivot point.
pivot_y Vertical position of the pivot point.

void bn::affine_bg_builder::set_pivot_position(const fixed_point& pivot_position)

Sets the position of the affine transformations pivot point of the affine backgrounds to generate.

Parameters
pivot_position Position of the pivot point.

affine_bg_builder& bn::affine_bg_builder::set_affine_mat(const affine_mat_attributes& mat_attributes)

Sets the attributes of the affine transformation matrix of the affine backgrounds to generate.

Parameters
mat_attributes affine_mat_attributes of the affine backgrounds to generate.
Returns Reference to this.

int bn::affine_bg_builder::priority() const

Returns the priority of the affine backgrounds to generate relative to sprites and other backgrounds.

Backgrounds with higher priorities are drawn first (and therefore can be covered by later sprites and backgrounds).

affine_bg_builder& bn::affine_bg_builder::set_priority(int priority)

Sets the priority of the affine backgrounds to generate relative to sprites and other backgrounds.

Parameters
priority Priority in the range [0..3].
Returns Reference to this.

Backgrounds with higher priorities are drawn first (and therefore can be covered by later sprites and backgrounds).

int bn::affine_bg_builder::z_order() const

Returns the priority of the affine backgrounds to generate relative to other backgrounds, excluding sprites.

Backgrounds with higher z orders are drawn first (and therefore can be covered by later backgrounds).

affine_bg_builder& bn::affine_bg_builder::set_z_order(int z_order)

Sets the priority of the affine backgrounds to generate relative to other backgrounds, excluding sprites.

Parameters
z_order Priority relative to other backgrounds, excluding sprites, in the range [-32767..32767].
Returns Reference to this.

Backgrounds with higher z orders are drawn first (and therefore can be covered by later backgrounds).

affine_bg_builder& bn::affine_bg_builder::set_wrapping_enabled(bool wrapping_enabled)

Sets if the affine backgrounds to generate must wrap around at the edges or not.

Parameters
wrapping_enabled true if they must wrap around at the edges; false otherwise.
Returns Reference to this.

affine_bg_builder& bn::affine_bg_builder::set_mosaic_enabled(bool mosaic_enabled)

Sets if the mosaic effect must be applied to the affine backgrounds to generate or not.

Parameters
mosaic_enabled true if the mosaic effect must be applied; false otherwise.
Returns Reference to this.

affine_bg_builder& bn::affine_bg_builder::set_blending_enabled(bool blending_enabled)

Sets if blending must be applied to the affine backgrounds to generate or not.

Parameters
blending_enabled true if blending must be applied; false otherwise.
Returns Reference to this.

affine_bg_builder& bn::affine_bg_builder::set_visible(bool visible)

Sets if the affine backgrounds to generate must be committed to the GBA or not.

Parameters
visible true if the affine backgrounds must be committed to the GBA; false otherwise.
Returns Reference to this.

affine_bg_builder& bn::affine_bg_builder::set_camera(const camera_ptr& camera)

Sets the camera_ptr to attach to the affine backgrounds to generate.

Parameters
camera camera_ptr to copy to the builder.
Returns Reference to this.

affine_bg_builder& bn::affine_bg_builder::set_camera(camera_ptr&& camera)

Sets the camera_ptr to attach to the affine backgrounds to generate.

Parameters
camera camera_ptr to move to the builder.
Returns Reference to this.

affine_bg_builder& bn::affine_bg_builder::set_camera(const optional<camera_ptr>& camera)

Sets or removes the camera_ptr to attach to the affine backgrounds to generate.

Parameters
camera Optional camera_ptr to copy to the builder.
Returns Reference to this.

affine_bg_builder& bn::affine_bg_builder::set_camera(optional<camera_ptr>&& camera)

Sets or removes the camera_ptr to attach to the affine backgrounds to generate.

Parameters
camera Optional camera_ptr to move to the builder.
Returns Reference to this.

affine_bg_builder& bn::affine_bg_builder::remove_camera()

Removes the camera_ptr to attach to the affine backgrounds to generate.

Returns Reference to this.

affine_bg_ptr bn::affine_bg_builder::release_build()

Generates and returns an affine_bg_ptr releasing the acquired resources.

This method must be called once at most.

optional<affine_bg_ptr> bn::affine_bg_builder::release_build_optional()

Generates and returns an affine_bg_ptr releasing the acquired resources if it could be allocated; bn::nullopt otherwise.

This method must be called once at most.

affine_bg_map_ptr bn::affine_bg_builder::release_map()

Generates and returns an affine_bg_map_ptr releasing the acquired resources.

This method must be called once at most.

optional<affine_bg_map_ptr> bn::affine_bg_builder::release_map_optional()

Generates and returns an affine_bg_map_ptr releasing the acquired resources if it could be allocated; bn::nullopt otherwise.

This method must be called once at most.