bn::regular_bg_builder class

Creates regular_bg_map_ptr objects with custom attributes.

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

Constructors, destructors, conversion operators

regular_bg_builder(const regular_bg_item& item) explicit
Constructor.
regular_bg_builder(const regular_bg_item& item, int map_index)
Constructor.
regular_bg_builder(const regular_bg_map_ptr& map) explicit
Constructor.
regular_bg_builder(regular_bg_map_ptr&& map) explicit
Constructor.

Public functions

auto item() const -> const optional<regular_bg_item>&
Returns the regular_bg_item containing the required information to generate regular backgrounds if it has one; bn::nullopt otherwise.
auto map_index() const -> int
Index of the map to reference in item.map_item() to generate regular backgrounds.
auto x() const -> fixed
Returns the horizontal position of the regular backgrounds to generate (relative to their camera, if they are going to have one).
auto set_x(fixed x) -> regular_bg_builder&
Sets the horizontal position of the regular backgrounds to generate (relative to their camera, if they are going to have one).
auto y() const -> fixed
Returns the vertical position of the regular backgrounds to generate (relative to their camera, if they are going to have one).
auto set_y(fixed y) -> regular_bg_builder&
Sets the vertical position of the regular 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 regular backgrounds to generate (relative to their camera, if they are going to have one).
auto set_position(fixed x, fixed y) -> regular_bg_builder&
Sets the position of the regular backgrounds to generate (relative to their camera, if they are going to have one).
auto set_position(const fixed_point& position) -> regular_bg_builder&
Sets the position of the regular backgrounds to generate (relative to their camera, if they are going to have one).
auto top_left_x() const -> fixed
Returns the horizontal top-left position of the regular backgrounds to generate (relative to their camera, if they are going to have one).
auto set_top_left_x(fixed top_left_x) -> regular_bg_builder&
Sets the horizontal top-left position of the regular backgrounds to generate (relative to their camera, if they are going to have one).
auto top_left_y() const -> fixed
Returns the vertical top-left position of the regular backgrounds to generate (relative to their camera, if they are going to have one).
auto set_top_left_y(fixed top_left_y) -> regular_bg_builder&
Sets the vertical top-left position of the regular backgrounds to generate (relative to their camera, if they are going to have one).
auto top_left_position() const -> fixed_point
Returns the top-left position of the regular backgrounds to generate (relative to their camera, if they are going to have one).
auto set_top_left_position(fixed top_left_x, fixed top_left_y) -> regular_bg_builder&
Sets the top-left position of the regular backgrounds to generate (relative to their camera, if they are going to have one).
auto set_top_left_position(const fixed_point& top_left_position) -> regular_bg_builder&
Sets the top-left position of the regular backgrounds to generate (relative to their camera, if they are going to have one).
auto priority() const -> int
Returns the priority of the regular backgrounds to generate relative to sprites and other backgrounds.
auto set_priority(int priority) -> regular_bg_builder&
Sets the priority of the regular backgrounds to generate relative to sprites and other backgrounds.
auto z_order() const -> int
Returns the priority of the regular backgrounds to generate relative to other backgrounds, excluding sprites.
auto set_z_order(int z_order) -> regular_bg_builder&
Sets the priority of the regular backgrounds to generate relative to other backgrounds, excluding sprites.
auto mosaic_enabled() const -> bool
Indicates if the mosaic effect must be applied to the regular backgrounds to generate or not.
auto set_mosaic_enabled(bool mosaic_enabled) -> regular_bg_builder&
Sets if the mosaic effect must be applied to the regular backgrounds to generate or not.
auto blending_enabled() const -> bool
Indicates if blending must be applied to the regular backgrounds to generate or not.
auto set_blending_enabled(bool blending_enabled) -> regular_bg_builder&
Sets if blending must be applied to the regular backgrounds to generate or not.
auto blending_top_enabled() const -> bool
Indicates if the regular backgrounds to generate must be part of the blending top layer or not.
auto set_blending_top_enabled(bool blending_top_enabled) -> regular_bg_builder&
Sets if the regular backgrounds to generate must be part of the blending top layer or not.
auto blending_bottom_enabled() const -> bool
Indicates if the regular backgrounds to generate must be part of the blending bottom layer or not.
auto set_blending_bottom_enabled(bool blending_bottom_enabled) -> regular_bg_builder&
Sets if the regular backgrounds to generate must be part of the blending bottom layer or not.
auto visible() const -> bool
Indicates if the regular backgrounds to generate must be committed to the GBA or not.
auto set_visible(bool visible) -> regular_bg_builder&
Sets if the regular 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 regular backgrounds to generate (if any).
auto set_camera(const camera_ptr& camera) -> regular_bg_builder&
Sets the camera_ptr to attach to the regular backgrounds to generate.
auto set_camera(camera_ptr&& camera) -> regular_bg_builder&
Sets the camera_ptr to attach to the regular backgrounds to generate.
auto set_camera(const optional<camera_ptr>& camera) -> regular_bg_builder&
Sets or removes the camera_ptr to attach to the regular backgrounds to generate.
auto set_camera(optional<camera_ptr>&& camera) -> regular_bg_builder&
Sets or removes the camera_ptr to attach to the regular backgrounds to generate.
auto remove_camera() -> regular_bg_builder&
Removes the camera_ptr to attach to the regular backgrounds to generate.
auto release_camera() -> optional<camera_ptr>
Releases and returns the camera_ptr to attach to the regular backgrounds to generate (if any).
auto build() const -> regular_bg_ptr
Generates and returns a regular_bg_ptr without releasing the acquired resources.
auto release_build() -> regular_bg_ptr
Generates and returns a regular_bg_ptr releasing the acquired resources.
auto build_optional() const -> optional<regular_bg_ptr>
Generates and returns a regular_bg_ptr without releasing the acquired resources if it could be allocated; bn::nullopt otherwise.
auto release_build_optional() -> optional<regular_bg_ptr>
Generates and returns a regular_bg_ptr releasing the acquired resources if it could be allocated; bn::nullopt otherwise.
auto map() const -> regular_bg_map_ptr
Generates and returns a regular_bg_map_ptr without releasing the acquired resources.
auto map_optional() const -> optional<regular_bg_map_ptr>
Generates and returns a regular_bg_map_ptr without releasing the acquired resources if it could be allocated; bn::nullopt otherwise.
auto release_map() -> regular_bg_map_ptr
Generates and returns a regular_bg_map_ptr releasing the acquired resources.
auto release_map_optional() -> optional<regular_bg_map_ptr>
Generates and returns a regular_bg_map_ptr releasing the acquired resources if it could be allocated; bn::nullopt otherwise.

Function documentation

bn::regular_bg_builder::regular_bg_builder(const regular_bg_item& item) explicit

Constructor.

Parameters
item regular_bg_item containing the required information to generate regular backgrounds.

bn::regular_bg_builder::regular_bg_builder(const regular_bg_item& item, int map_index)

Constructor.

Parameters
item regular_bg_item containing the required information to generate regular backgrounds.
map_index Index of the map to reference in item.map_item() to generate regular backgrounds.

bn::regular_bg_builder::regular_bg_builder(const regular_bg_map_ptr& map) explicit

Constructor.

Parameters
map regular_bg_map_ptr to copy for generating regular backgrounds.

bn::regular_bg_builder::regular_bg_builder(regular_bg_map_ptr&& map) explicit

Constructor.

Parameters
map regular_bg_map_ptr to move for generating regular backgrounds.

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

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

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

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

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

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

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

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

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

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

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

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

regular_bg_builder& bn::regular_bg_builder::set_top_left_x(fixed top_left_x)

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

Parameters
top_left_x Horizontal top-left position of the regular backgrounds to generate.
Returns Reference to this.

regular_bg_builder& bn::regular_bg_builder::set_top_left_y(fixed top_left_y)

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

Parameters
top_left_y Vertical top-left position of the regular backgrounds to generate.
Returns Reference to this.

regular_bg_builder& bn::regular_bg_builder::set_top_left_position(fixed top_left_x, fixed top_left_y)

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

Parameters
top_left_x Horizontal top-left position of the regular backgrounds to generate.
top_left_y Vertical top-left position of the regular backgrounds to generate.
Returns Reference to this.

regular_bg_builder& bn::regular_bg_builder::set_top_left_position(const fixed_point& top_left_position)

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

Parameters
top_left_position Top-left position of the regular backgrounds to generate.
Returns Reference to this.

int bn::regular_bg_builder::priority() const

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

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

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

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

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

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

int bn::regular_bg_builder::z_order() const

Returns the priority of the regular 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).

Due to hardware limitations, affine backgrounds can be drawn before regular backgrounds with higher z order.

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

Sets the priority of the regular 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).

Due to hardware limitations, affine backgrounds can be drawn before regular backgrounds with higher z order.

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

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

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

bool bn::regular_bg_builder::blending_enabled() const

Indicates if blending must be applied to the regular backgrounds to generate or not.

Blending is applied to regular backgrounds by making them part of the blending top layer.

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

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

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

Blending is applied to regular backgrounds by making them part of the blending top layer.

regular_bg_builder& bn::regular_bg_builder::set_blending_top_enabled(bool blending_top_enabled)

Sets if the regular backgrounds to generate must be part of the blending top layer or not.

Parameters
blending_top_enabled true if generated backgrounds must be part of the blending top layer; false otherwise.
Returns Reference to this.

regular_bg_builder& bn::regular_bg_builder::set_blending_bottom_enabled(bool blending_bottom_enabled)

Sets if the regular backgrounds to generate must be part of the blending bottom layer or not.

Parameters
blending_bottom_enabled true if generated backgrounds must be part of the blending bottom layer; false otherwise.
Returns Reference to this.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

regular_bg_builder& bn::regular_bg_builder::remove_camera()

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

Returns Reference to this.

regular_bg_ptr bn::regular_bg_builder::release_build()

Generates and returns a regular_bg_ptr releasing the acquired resources.

This method must be called once at most.

optional<regular_bg_ptr> bn::regular_bg_builder::release_build_optional()

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

This method must be called once at most.

regular_bg_map_ptr bn::regular_bg_builder::release_map()

Generates and returns a regular_bg_map_ptr releasing the acquired resources.

This method must be called once at most.

optional<regular_bg_map_ptr> bn::regular_bg_builder::release_map_optional()

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

This method must be called once at most.