ldtk::level_bgs_builder class

Constructors, destructors, conversion operators

level_bgs_builder(const level& level) explicit
Constructor.

Public functions

auto level() const -> const level&
Returns the level containing the required information to generate the level backgrounds.
auto has_background(gen::layer_ident layer_identifier) const -> bool
Checks if the given layer will generate a background or not.
auto x() const -> bn::fixed
Returns the horizontal position of the level backgrounds to generate (relative to their camera, if they are going to have one).
auto set_x(bn::fixed x) -> level_bgs_builder&
Sets the horizontal position of the level backgrounds to generate (relative to their camera, if they are going to have one).
auto y() const -> bn::fixed
Returns the vertical position of the level backgrounds to generate (relative to their camera, if they are going to have one).
auto set_y(bn::fixed y) -> level_bgs_builder&
Sets the vertical position of the level backgrounds to generate (relative to their camera, if they are going to have one).
auto position() const -> const bn::fixed_point&
Returns the position of the level backgrounds to generate (relative to their camera, if they are going to have one).
auto set_position(bn::fixed x, bn::fixed y) -> level_bgs_builder&
Sets the position of the level backgrounds to generate (relative to their camera, if they are going to have one).
auto set_position(const bn::fixed_point& position) -> level_bgs_builder&
Sets the position of the level backgrounds to generate (relative to their camera, if they are going to have one).
auto top_left_x() const -> bn::fixed
Returns the horizontal top-left position of the level backgrounds to generate (relative to their camera, if they are going to have one).
auto set_top_left_x(bn::fixed top_left_x) -> level_bgs_builder&
Sets the horizontal top-left position of the level backgrounds to generate (relative to their camera, if they are going to have one).
auto top_left_y() const -> bn::fixed
Returns the vertical top-left position of the level backgrounds to generate (relative to their camera, if they are going to have one).
auto set_top_left_y(bn::fixed top_left_y) -> level_bgs_builder&
Sets the vertical top-left position of the level backgrounds to generate (relative to their camera, if they are going to have one).
auto top_left_position() const -> bn::fixed_point
Returns the top-left position of the level backgrounds to generate (relative to their camera, if they are going to have one).
auto set_top_left_position(bn::fixed top_left_x, bn::fixed top_left_y) -> level_bgs_builder&
Sets the top-left position of the level backgrounds to generate (relative to their camera, if they are going to have one).
auto set_top_left_position(const bn::fixed_point& top_left_position) -> level_bgs_builder&
Sets the top-left position of the level backgrounds to generate (relative to their camera, if they are going to have one).
auto priority(gen::layer_ident layer_identifier) const -> int
Returns the priority of a background of the given layer to generate relative to sprites and other backgrounds.
auto set_priority(int priority) -> level_bgs_builder&
Sets the priority of the level backgrounds to generate relative to sprites and other backgrounds.
auto set_priority(int priority, gen::layer_ident layer_identifier) -> level_bgs_builder&
Sets the priority of a level background of the given layer to generate relative to sprites and other backgrounds.
auto z_order(gen::layer_ident layer_identifier) const -> int
Returns the priority of a background of the given layer to generate relative to other backgrounds, excluding sprites.
auto set_z_order(int z_order) -> level_bgs_builder&
Sets the priority of the level backgrounds to generate relative to other backgrounds, excluding sprites.
auto set_z_order(int z_order, gen::layer_ident layer_identifier) -> level_bgs_builder&
Sets the priority of a level background of the given layer to generate relative to other backgrounds, excluding sprites.
auto mosaic_enabled(gen::layer_ident layer_identifier) const -> bool
Indicates if the mosaic effect must be applied to a level background with the given layer to generate or not.
auto set_mosaic_enabled(bool mosaic_enabled) -> level_bgs_builder&
Sets if the mosaic effect must be applied to the level backgrounds to generate or not.
auto set_mosaic_enabled(bool mosaic_enabled, gen::layer_ident layer_identifier) -> level_bgs_builder&
Sets if the mosaic effect must be applied to a level background of the given layer to generate or not.
auto blending_enabled(gen::layer_ident layer_identifier) const -> bool
Indicates if blending must be applied to a level background with the given layer to generate or not.
auto set_blending_enabled(bool blending_enabled) -> level_bgs_builder&
Sets if blending must be applied to the level backgrounds to generate or not.
auto set_blending_enabled(bool blending_enabled, gen::layer_ident layer_identifier) -> level_bgs_builder&
Sets if blending must be applied to a level background of the given layer to generate or not.
auto blending_top_enabled(gen::layer_ident layer_identifier) const -> bool
Indicates if a level background with the given layer to generate must be part of the blending top layer or not.
auto set_blending_top_enabled(bool blending_top_enabled) -> level_bgs_builder&
Sets if the level backgrounds to generate must be part of the blending top layer or not.
auto set_blending_top_enabled(bool blending_top_enabled, gen::layer_ident layer_identifier) -> level_bgs_builder&
Sets if a level background of the given layer to generate must be part of the blending top layer or not.
auto blending_bottom_enabled(gen::layer_ident layer_identifier) const -> bool
Indicates if a level background with the given layer to generate must be part of the blending bottom layer or not.
auto set_blending_bottom_enabled(bool blending_bottom_enabled) -> level_bgs_builder&
Sets if the level backgrounds to generate must be part of the blending bottom layer or not.
auto set_blending_bottom_enabled(bool blending_bottom_enabled, gen::layer_ident layer_identifier) -> level_bgs_builder&
Sets if a level background of the given layer to generate must be part of the blending bottom layer or not.
auto green_swap_mode(gen::layer_ident layer_identifier) const -> bn::green_swap_mode
Indicates how a level background with the given layer to generate must be displayed when green swap is enabled.
auto set_green_swap_mode(bn::green_swap_mode green_swap_mode) -> level_bgs_builder&
Sets how the level backgrounds to generate must be displayed when green swap is enabled.
auto set_green_swap_mode(bn::green_swap_mode green_swap_mode, gen::layer_ident layer_identifier) -> level_bgs_builder&
Sets how a level background of the given layer to generate must be displayed when green swap is enabled.
auto visible(gen::layer_ident layer_identifier) const -> bool
Indicates if a level background with the given layer to generate must be committed to the GBA or not.
auto set_visible(bool visible) -> level_bgs_builder&
Sets if the level backgrounds to generate must be committed to the GBA or not.
auto set_visible(bool visible, gen::layer_ident layer_identifier) -> level_bgs_builder&
Sets if a level background of the given layer to generate must be committed to the GBA or not.
auto camera() const -> const bn::optional<bn::camera_ptr>&
Returns the camera_ptr to attach to the level backgrounds to generate (if any).
auto set_camera(const bn::camera_ptr& camera) -> level_bgs_builder&
Sets the camera_ptr to attach to the level backgrounds to generate.
auto set_camera(bn::camera_ptr&& camera) -> level_bgs_builder&
Sets the camera_ptr to attach to the level backgrounds to generate.
auto set_camera(const bn::optional<bn::camera_ptr>& camera) -> level_bgs_builder&
Sets or removes the camera_ptr to attach to the level backgrounds to generate.
auto set_camera(bn::optional<bn::camera_ptr>&& camera) -> level_bgs_builder&
Sets or removes the camera_ptr to attach to the level backgrounds to generate.
auto remove_camera() -> level_bgs_builder&
Removes the camera_ptr to attach to the level backgrounds to generate.
auto release_camera() -> bn::optional<bn::camera_ptr>
Releases and returns the camera_ptr to attach to the level backgrounds to generate (if any).
auto out_of_bound_tile_info(gen::layer_ident layer_identifier) const -> tile_grid_base::tile_info
Returns the tile info that fills the out-of-bound region of a level background.
auto set_out_of_bound_tile_info(tile_grid_base::tile_info oob_tile_info, gen::layer_ident layer_identifier) -> level_bgs_builder&
Sets the tile info that fills the out-of-bound region of a level background.
auto build() const -> level_bgs_ptr
Generates and returns a level_bgs_ptr without releasing the acquired resources.
auto release_build() -> level_bgs_ptr
Generates and returns a level_bgs_ptr releasing the acquired resources.
auto build_optional() const -> bn::optional<level_bgs_ptr>
Generates and returns a level_bgs_ptr without releasing the acquired resources if it could be allocated; bn::nullopt otherwise.
auto release_build_optional() -> bn::optional<level_bgs_ptr>
Generates and returns a level_bgs_ptr releasing the acquired resources if it could be allocated; bn::nullopt otherwise.

Function documentation

bool ldtk::level_bgs_builder::has_background(gen::layer_ident layer_identifier) const

Checks if the given layer will generate a background or not.

Parameters
layer_identifier identifier of the layer to check if it will generate a background.

level_bgs_builder& ldtk::level_bgs_builder::set_x(bn::fixed x)

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

Returns Reference to this.

level_bgs_builder& ldtk::level_bgs_builder::set_y(bn::fixed y)

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

Returns Reference to this.

level_bgs_builder& ldtk::level_bgs_builder::set_position(bn::fixed x, bn::fixed y)

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

Returns Reference to this.

level_bgs_builder& ldtk::level_bgs_builder::set_position(const bn::fixed_point& position)

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

Returns Reference to this.

level_bgs_builder& ldtk::level_bgs_builder::set_top_left_x(bn::fixed top_left_x)

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

Returns Reference to this.

level_bgs_builder& ldtk::level_bgs_builder::set_top_left_y(bn::fixed top_left_y)

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

Returns Reference to this.

level_bgs_builder& ldtk::level_bgs_builder::set_top_left_position(bn::fixed top_left_x, bn::fixed top_left_y)

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

Returns Reference to this.

level_bgs_builder& ldtk::level_bgs_builder::set_top_left_position(const bn::fixed_point& top_left_position)

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

Returns Reference to this.

int ldtk::level_bgs_builder::priority(gen::layer_ident layer_identifier) const

Returns the priority of a background of the given layer to generate relative to sprites and other backgrounds.

Parameters
layer_identifier identifier of the layer to get the background priority from.

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

level_bgs_builder& ldtk::level_bgs_builder::set_priority(int priority)

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

Returns Reference to this.

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

level_bgs_builder& ldtk::level_bgs_builder::set_priority(int priority, gen::layer_ident layer_identifier)

Sets the priority of a level background of the given layer to generate relative to sprites and other backgrounds.

Parameters
priority
layer_identifier identifier of the layer to set the background priority to.
Returns Reference to this.

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

int ldtk::level_bgs_builder::z_order(gen::layer_ident layer_identifier) const

Returns the priority of a background of the given layer to generate relative to other backgrounds, excluding sprites.

Parameters
layer_identifier identifier of the layer to get the background priority from.

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.

level_bgs_builder& ldtk::level_bgs_builder::set_z_order(int z_order)

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

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.

level_bgs_builder& ldtk::level_bgs_builder::set_z_order(int z_order, gen::layer_ident layer_identifier)

Sets the priority of a level background of the given layer to generate relative to other backgrounds, excluding sprites.

Parameters
z_order
layer_identifier identifier of the layer to set the background priority to.
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.

bool ldtk::level_bgs_builder::mosaic_enabled(gen::layer_ident layer_identifier) const

Indicates if the mosaic effect must be applied to a level background with the given layer to generate or not.

Parameters
layer_identifier identifier of the layer to get the flag from.

level_bgs_builder& ldtk::level_bgs_builder::set_mosaic_enabled(bool mosaic_enabled)

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

Returns Reference to this.

level_bgs_builder& ldtk::level_bgs_builder::set_mosaic_enabled(bool mosaic_enabled, gen::layer_ident layer_identifier)

Sets if the mosaic effect must be applied to a level background of the given layer to generate or not.

Parameters
mosaic_enabled
layer_identifier identifier of the layer to set the flag to.
Returns Reference to this.

bool ldtk::level_bgs_builder::blending_enabled(gen::layer_ident layer_identifier) const

Indicates if blending must be applied to a level background with the given layer to generate or not.

Parameters
layer_identifier identifier of the layer to get the flag from.

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

level_bgs_builder& ldtk::level_bgs_builder::set_blending_enabled(bool blending_enabled)

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

Returns Reference to this.

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

level_bgs_builder& ldtk::level_bgs_builder::set_blending_enabled(bool blending_enabled, gen::layer_ident layer_identifier)

Sets if blending must be applied to a level background of the given layer to generate or not.

Parameters
blending_enabled
layer_identifier identifier of the layer to set the flag to.
Returns Reference to this.

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

bool ldtk::level_bgs_builder::blending_top_enabled(gen::layer_ident layer_identifier) const

Indicates if a level background with the given layer to generate must be part of the blending top layer or not.

Parameters
layer_identifier identifier of the layer to get the flag from.

level_bgs_builder& ldtk::level_bgs_builder::set_blending_top_enabled(bool blending_top_enabled)

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

Returns Reference to this.

level_bgs_builder& ldtk::level_bgs_builder::set_blending_top_enabled(bool blending_top_enabled, gen::layer_ident layer_identifier)

Sets if a level background of the given layer to generate must be part of the blending top layer or not.

Parameters
blending_top_enabled
layer_identifier identifier of the layer to set the flag to.
Returns Reference to this.

bool ldtk::level_bgs_builder::blending_bottom_enabled(gen::layer_ident layer_identifier) const

Indicates if a level background with the given layer to generate must be part of the blending bottom layer or not.

Parameters
layer_identifier identifier of the layer to get the flag from.

level_bgs_builder& ldtk::level_bgs_builder::set_blending_bottom_enabled(bool blending_bottom_enabled)

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

Returns Reference to this.

level_bgs_builder& ldtk::level_bgs_builder::set_blending_bottom_enabled(bool blending_bottom_enabled, gen::layer_ident layer_identifier)

Sets if a level background of the given layer to generate must be part of the blending bottom layer or not.

Parameters
blending_bottom_enabled
layer_identifier identifier of the layer to set the flag to.
Returns Reference to this.

bn::green_swap_mode ldtk::level_bgs_builder::green_swap_mode(gen::layer_ident layer_identifier) const

Indicates how a level background with the given layer to generate must be displayed when green swap is enabled.

Parameters
layer_identifier identifier of the layer to get the mode from.

level_bgs_builder& ldtk::level_bgs_builder::set_green_swap_mode(bn::green_swap_mode green_swap_mode)

Sets how the level backgrounds to generate must be displayed when green swap is enabled.

Returns Reference to this.

level_bgs_builder& ldtk::level_bgs_builder::set_green_swap_mode(bn::green_swap_mode green_swap_mode, gen::layer_ident layer_identifier)

Sets how a level background of the given layer to generate must be displayed when green swap is enabled.

Parameters
green_swap_mode
layer_identifier identifier of the layer to set the mode to.
Returns Reference to this.

bool ldtk::level_bgs_builder::visible(gen::layer_ident layer_identifier) const

Indicates if a level background with the given layer to generate must be committed to the GBA or not.

Parameters
layer_identifier identifier of the layer to get the flag from.

level_bgs_builder& ldtk::level_bgs_builder::set_visible(bool visible)

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

Returns Reference to this.

level_bgs_builder& ldtk::level_bgs_builder::set_visible(bool visible, gen::layer_ident layer_identifier)

Sets if a level background of the given layer to generate must be committed to the GBA or not.

Parameters
visible
layer_identifier identifier of the layer to set the flag to.
Returns Reference to this.

level_bgs_builder& ldtk::level_bgs_builder::set_camera(const bn::camera_ptr& camera)

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

Returns Reference to this.

level_bgs_builder& ldtk::level_bgs_builder::set_camera(bn::camera_ptr&& camera)

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

Returns Reference to this.

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

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

Returns Reference to this.

level_bgs_builder& ldtk::level_bgs_builder::set_camera(bn::optional<bn::camera_ptr>&& camera)

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

Returns Reference to this.

level_bgs_builder& ldtk::level_bgs_builder::remove_camera()

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

Returns Reference to this.

tile_grid_base::tile_info ldtk::level_bgs_builder::out_of_bound_tile_info(gen::layer_ident layer_identifier) const

Returns the tile info that fills the out-of-bound region of a level background.

Parameters
layer_identifier identifier of the layer to get the tile info from.

level_bgs_builder& ldtk::level_bgs_builder::set_out_of_bound_tile_info(tile_grid_base::tile_info oob_tile_info, gen::layer_ident layer_identifier)

Sets the tile info that fills the out-of-bound region of a level background.

Parameters
oob_tile_info tile info to fill the out-of-bound region of a level background.
layer_identifier identifier of the layer to set the tile info to.
Returns Reference to this.

level_bgs_ptr ldtk::level_bgs_builder::release_build()

Generates and returns a level_bgs_ptr releasing the acquired resources.

level_bgs_ptr generation after calling this method may stop working.

bn::optional<level_bgs_ptr> ldtk::level_bgs_builder::release_build_optional()

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

level_bgs_ptr generation after calling this method may stop working.