class
#include <ldtk_level_bgs_ptr.h>
level_bgs_ptr
Public static functions
-
static auto create(const level& level) -> level_
bgs_ ptr - Creates a
level_
from the givenbgs_ ptr level
. -
static auto create(const bn::fixed_point& position,
const level& level) -> level_
bgs_ ptr - Creates a
level_
from the givenbgs_ ptr level
. -
static auto create(bn::fixed x,
bn::fixed y,
const level& level) -> level_
bgs_ ptr - Creates a
level_
from the givenbgs_ ptr level
. -
static auto create(const level_
bgs_ builder& builder) -> level_ bgs_ ptr - Creates a
level_
from abgs_ ptr level_
reference.bgs_ builder -
static auto create(level_
bgs_ builder&& builder) -> level_ bgs_ ptr - Creates a
level_
from a movedbgs_ ptr level_
.bgs_ builder -
static auto create_optional(const level& level) -> bn::optional<level_
bgs_ ptr> - Creates a
level_
from the givenbgs_ ptr level
. -
static auto create_optional(const bn::fixed_point& position,
const level& level) -> bn::optional<level_
bgs_ ptr> - Creates a
level_
from the givenbgs_ ptr level
. -
static auto create_optional(bn::fixed x,
bn::fixed y,
const level& level) -> bn::optional<level_
bgs_ ptr> - Creates a
level_
from the givenbgs_ ptr level
. -
static auto create_optional(const level_
bgs_ builder& builder) -> bn::optional<level_ bgs_ ptr> - Creates a
level_
from abgs_ ptr level_
reference.bgs_ builder -
static auto create_optional(level_
bgs_ builder&& builder) -> bn::optional<level_ bgs_ ptr> - Creates a
level_
from a movedbgs_ ptr level_
.bgs_ builder
Constructors, destructors, conversion operators
-
level_bgs_ptr(const level_
bgs_ ptr& other) - Copy constructor.
-
level_bgs_ptr(level_
bgs_ ptr&& other) noexcept - Move constructor.
- ~level_bgs_ptr()
- Releases the referenced level backgrounds if no more
level_
objects reference to them.bgs_ ptr
Public functions
-
auto operator=(const level_
bgs_ ptr& other) -> level_ bgs_ ptr& - Copy assignment operator.
-
auto operator=(level_
bgs_ ptr&& other) -> level_ bgs_ ptr& noexcept - Move assignment operator.
- auto has_background(gen::layer_ident layer_identifier) const -> bool
- Checks if the given layer has a background generated or not.
- void set_level(const level& level)
- Replace the level used by these level backgrounds.
-
void set_level(const level_
bgs_ builder& builder) - Replace the level used by these level backgrounds.
-
void set_level(level_
bgs_ builder&& builder) - Replace the level used by these level backgrounds.
- auto dimensions() const -> bn::size
- Returns the size in pixels of the level backgrounds.
- auto x() const -> bn::fixed
- Returns the horizontal position of the level backgrounds (relative to its camera, if they have one).
- void set_x(bn::fixed x)
- Sets the horizontal position of the level backgrounds (relative to its camera, if they have one).
- auto y() const -> bn::fixed
- Returns the vertical position of the level backgrounds (relative to its camera, if they have one).
- void set_y(bn::fixed y)
- Sets the vertical position of the level backgrounds (relative to its camera, if they have one).
- auto position() const -> const bn::fixed_point&
- Returns the position of the level backgrounds (relative to its camera, if they have one).
- void set_position(bn::fixed x, bn::fixed y)
- Sets the position of the level backgrounds (relative to its camera, if they have one).
- void set_position(const bn::fixed_point& position)
- Sets the position of the level backgrounds (relative to its camera, if they have one).
- auto top_left_x() const -> bn::fixed
- Returns the horizontal top-left position of the level backgrounds (relative to its camera, if they have one).
- void set_top_left_x(bn::fixed top_left_x)
- Sets the horizontal top-left position of the level backgrounds (relative to its camera, if they have one).
- auto top_left_y() const -> bn::fixed
- Returns the vertical top-left position of the level backgrounds (relative to its camera, if they have one).
- void set_top_left_y(bn::fixed top_left_y)
- Sets the vertical top-left position of the level backgrounds (relative to its camera, if they have one).
- auto top_left_position() const -> bn::fixed_point
- Returns the top-left position of the level backgrounds (relative to its camera, if they have one).
- void set_top_left_position(bn::fixed top_left_x, bn::fixed top_left_y)
- Sets the top-left position of the level backgrounds (relative to its camera, if they have one).
- void set_top_left_position(const bn::fixed_point& top_left_position)
- Sets the top-left position of the level backgrounds (relative to its camera, if they have one).
- auto priority(gen::layer_ident layer_identifier) const -> int
- Returns the priority of a level background of the given layer relative to sprites and other backgrounds.
- void set_priority(int priority)
- Sets the priority of the level backgrounds relative to sprites and other backgrounds.
- void set_priority(int priority, gen::layer_ident layer_identifier)
- Sets the priority of a level background of the given layer relative to sprites and other backgrounds.
- auto z_order(gen::layer_ident layer_identifier) const -> int
- Returns the priority of a level background of the given layer relative to other backgrounds, excluding sprites.
- void set_z_order(int z_order)
- Sets the priority of the level backgrounds relative to other backgrounds, excluding sprites.
- void set_z_order(int z_order, gen::layer_ident layer_identifier)
- Sets the priority of a level background of the given layer relative to other backgrounds, excluding sprites.
- void put_above()
- Modify these level backgrounds to be drawn above all of the other backgrounds with the same priority.
- void put_above(gen::layer_ident layer_identifier)
- Modify a level background of the given layer to be drawn above all of the other backgrounds with the same priority.
- void put_below()
- Modify these level backgrounds to be drawn below all of the other backgrounds with the same priority.
- void put_below(gen::layer_ident layer_identifier)
- Modify a level background of the given layer to be drawn below all of the other backgrounds with the same priority.
- 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 or not.
- void set_mosaic_enabled(bool mosaic_enabled)
- Sets if the mosaic effect must be applied to these level backgrounds or not.
- void 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 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 or not.
- void set_blending_enabled(bool blending_enabled)
- Sets if blending must be applied to these level backgrounds or not.
- void set_blending_enabled(bool blending_enabled, gen::layer_ident layer_identifier)
- Sets if blending must be applied to these level backgrounds or not.
- auto blending_top_enabled(gen::layer_ident layer_identifier) const -> bool
- Indicates if a level background with the given layer is part of the blending top layer or not.
- void set_blending_top_enabled(bool blending_top_enabled)
- Sets if these level backgrounds is part of the blending top layer or not.
- void set_blending_top_enabled(bool blending_top_enabled, gen::layer_ident layer_identifier)
- Sets if a level background of the given layer is 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 is part of the blending bottom layer or not.
- void set_blending_bottom_enabled(bool blending_bottom_enabled)
- Sets if these level backgrounds is part of the blending bottom layer or not.
- void set_blending_bottom_enabled(bool blending_bottom_enabled, gen::layer_ident layer_identifier)
- Sets if a level background of the given layer is 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 must be displayed when green swap is enabled.
- void set_green_swap_mode(bn::green_swap_mode green_swap_mode)
- Sets how these level backgrounds must be displayed when green swap is enabled.
- void 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 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 must be committed to the GBA or not.
- void set_visible(bool visible)
- Sets if these level backgrounds must be committed to the GBA or not.
- void set_visible(bool visible, gen::layer_ident layer_identifier)
- Sets if a level background of the given layer must be committed to the GBA or not.
- auto visible_in_window(const bn::window& window, gen::layer_ident layer_identifier) const -> bool
- Indicates if a level background with the given layer is visible in the given window or not.
- void set_visible_in_window(bool visible, bn::window& window)
- Sets if these level backgrounds must be visible in the given window or not.
- void set_visible_in_window(bool visible, bn::window& window, gen::layer_ident layer_identifier)
- Sets if a level background of the given layer must be visible in the given window or not.
- auto camera() const -> const bn::optional<bn::camera_ptr>&
- Returns the
bn::camera_ptr
attached to these level backgrounds (if any). - void set_camera(const bn::camera_ptr& camera)
- Sets the
bn::camera_ptr
attached to these level backgrounds. - void set_camera(bn::camera_ptr&& camera)
- Sets the
bn::camera_ptr
attached to these level backgrounds. - void set_camera(const bn::optional<bn::camera_ptr>& camera)
- Sets or removes the
bn::camera_ptr
attached to these level backgrounds. - void set_camera(bn::optional<bn::camera_ptr>&& camera)
- Sets or removes the
bn::camera_ptr
attached to these level backgrounds. - void remove_camera()
- Removes the
bn::camera_ptr
attached to these level backgrounds (if any). - auto handle() const -> void * -> const auto
- Returns the internal handle.
-
void swap(level_
bgs_ ptr& other) noexcept - Exchanges the contents of this
level_
with those of the other one.bgs_ ptr
Friends
-
void swap(level_
bgs_ ptr& a, level_ bgs_ ptr& b) noexcept - Exchanges the contents of a
level_bg_ptr
with those of another one. -
auto operator==(const level_
bgs_ ptr& a, const level_ bgs_ ptr& b) -> bool=default - Default equal operator.
Function documentation
static level_ bgs_ ptr ldtk:: level_bgs_ptr:: create(const level& level)
Creates a level_
from the given level
.
Parameters | |
---|---|
level | level containing the required information to generate the level backgrounds. |
Returns | The requested level_ . |
static level_ bgs_ ptr ldtk:: level_bgs_ptr:: create(const bn::fixed_point& position,
const level& level)
Creates a level_
from the given level
.
Parameters | |
---|---|
position | Position of the level backgrounds. |
level | level containing the required information to generate the level backgrounds. |
Returns | The requested level_ . |
static level_ bgs_ ptr ldtk:: level_bgs_ptr:: create(bn::fixed x,
bn::fixed y,
const level& level)
Creates a level_
from the given level
.
Parameters | |
---|---|
x | Horizontal position of the level backgrounds. |
y | Vertical position of the level backgrounds. |
level | level containing the required information to generate the level backgrounds. |
Returns | The requested level_ . |
static level_ bgs_ ptr ldtk:: level_bgs_ptr:: create(const level_ bgs_ builder& builder)
Creates a level_
from a level_
reference.
Parameters | |
---|---|
builder | level_ reference. |
Returns | The requested level_ . |
static level_ bgs_ ptr ldtk:: level_bgs_ptr:: create(level_ bgs_ builder&& builder)
Creates a level_
from a moved level_
.
Parameters | |
---|---|
builder | level_ to move. |
Returns | The requested level_ . |
static bn::optional<level_ bgs_ ptr> ldtk:: level_bgs_ptr:: create_optional(const level& level)
Creates a level_
from the given level
.
Parameters | |
---|---|
level | level containing the required information to generate the level backgrounds. |
Returns | The requested level_ if it could be allocated; bn::nullopt otherwise. |
static bn::optional<level_ bgs_ ptr> ldtk:: level_bgs_ptr:: create_optional(const bn::fixed_point& position,
const level& level)
Creates a level_
from the given level
.
Parameters | |
---|---|
position | Position of the level backgrounds. |
level | level containing the required information to generate the level backgrounds. |
Returns | The requested level_ if it could be allocated; bn::nullopt otherwise. |
static bn::optional<level_ bgs_ ptr> ldtk:: level_bgs_ptr:: create_optional(bn::fixed x,
bn::fixed y,
const level& level)
Creates a level_
from the given level
.
Parameters | |
---|---|
x | Horizontal position of the level backgrounds. |
y | Vertical position of the level backgrounds. |
level | level containing the required information to generate the level backgrounds. |
Returns | The requested level_ if it could be allocated; bn::nullopt otherwise. |
static bn::optional<level_ bgs_ ptr> ldtk:: level_bgs_ptr:: create_optional(const level_ bgs_ builder& builder)
Creates a level_
from a level_
reference.
Parameters | |
---|---|
builder | level_ reference. |
Returns | The requested level_ if it could be allocated; bn::nullopt otherwise. |
static bn::optional<level_ bgs_ ptr> ldtk:: level_bgs_ptr:: create_optional(level_ bgs_ builder&& builder)
Creates a level_
from a moved level_
.
Parameters | |
---|---|
builder | level_ to move. |
Returns | The requested level_ if it could be allocated; bn::nullopt otherwise. |
ldtk:: level_bgs_ptr:: level_bgs_ptr(const level_ bgs_ ptr& other)
Copy constructor.
Parameters | |
---|---|
other | level_ to copy. |
ldtk:: level_bgs_ptr:: level_bgs_ptr(level_ bgs_ ptr&& other) noexcept
Move constructor.
Parameters | |
---|---|
other | level_ to move. |
level_ bgs_ ptr& ldtk:: level_bgs_ptr:: operator=(const level_ bgs_ ptr& other)
Copy assignment operator.
Parameters | |
---|---|
other | level_ to copy. |
Returns | Reference to this . |
level_ bgs_ ptr& ldtk:: level_bgs_ptr:: operator=(level_ bgs_ ptr&& other) noexcept
Move assignment operator.
Parameters | |
---|---|
other | level_ to move. |
Returns | Reference to this . |
bool ldtk:: level_bgs_ptr:: has_background(gen::layer_ident layer_identifier) const
Checks if the given layer has a background generated or not.
Parameters | |
---|---|
layer_identifier | identifier of the layer to check if it has a generated background. |
void ldtk:: level_bgs_ptr:: set_level(const level_ bgs_ builder& builder)
Replace the level used by these level backgrounds.
Parameters | |
---|---|
builder | It creates the resources to use by this level builder. |
void ldtk:: level_bgs_ptr:: set_level(level_ bgs_ builder&& builder)
Replace the level used by these level backgrounds.
Parameters | |
---|---|
builder | It creates the resources to use by this level builder. |
void ldtk:: level_bgs_ptr:: set_position(bn::fixed x,
bn::fixed y)
Sets the position of the level backgrounds (relative to its camera, if they have one).
Parameters | |
---|---|
x | Horizontal position of the level backgrounds (relative to its camera, if they have one). |
y | Vertical position of the level backgrounds (relative to its camera, if they have one). |
void ldtk:: level_bgs_ptr:: set_top_left_position(bn::fixed top_left_x,
bn::fixed top_left_y)
Sets the top-left position of the level backgrounds (relative to its camera, if they have one).
Parameters | |
---|---|
top_left_x | Horizontal top-left position of the level backgrounds (relative to its camera, if they have one). |
top_left_y | Vertical top-left position of the level backgrounds (relative to its camera, if they have one). |
int ldtk:: level_bgs_ptr:: priority(gen::layer_ident layer_identifier) const
Returns the priority of a level background of the given layer 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).
void ldtk:: level_bgs_ptr:: set_priority(int priority)
Sets the priority of the level backgrounds 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).
void ldtk:: level_bgs_ptr:: set_priority(int priority,
gen::layer_ident layer_identifier)
Sets the priority of a level background of the given layer relative to sprites and other backgrounds.
Parameters | |
---|---|
priority | Priority in the range [0..3]. |
layer_identifier | identifier of the layer to set the background priority to. |
Backgrounds with higher priority are drawn first (and therefore can be covered by later sprites and backgrounds).
int ldtk:: level_bgs_ptr:: z_order(gen::layer_ident layer_identifier) const
Returns the priority of a level background of the given layer 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.
void ldtk:: level_bgs_ptr:: set_z_order(int z_order)
Sets the priority of the level backgrounds relative to other backgrounds, excluding sprites.
Parameters | |
---|---|
z_order | Priority relative to other backgrounds, excluding sprites, in the range [-32767..32767]. |
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.
void ldtk:: level_bgs_ptr:: set_z_order(int z_order,
gen::layer_ident layer_identifier)
Sets the priority of a level background of the given layer relative to other backgrounds, excluding sprites.
Parameters | |
---|---|
z_order | Priority relative to other backgrounds, excluding sprites, in the range [-32767..32767]. |
layer_identifier | identifier of the layer to set the background priority to. |
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.
void ldtk:: level_bgs_ptr:: put_above(gen::layer_ident layer_identifier)
Modify a level background of the given layer to be drawn above all of the other backgrounds with the same priority.
Parameters | |
---|---|
layer_identifier | identifier of the layer to put above. |
void ldtk:: level_bgs_ptr:: put_below(gen::layer_ident layer_identifier)
Modify a level background of the given layer to be drawn below all of the other backgrounds with the same priority.
Parameters | |
---|---|
layer_identifier | identifier of the layer to put below. |
bool ldtk:: level_bgs_ptr:: mosaic_enabled(gen::layer_ident layer_identifier) const
Indicates if the mosaic effect must be applied to a level background with the given layer or not.
Parameters | |
---|---|
layer_identifier | identifier of the layer to get the flag from. |
void ldtk:: level_bgs_ptr:: 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 or not.
Parameters | |
---|---|
mosaic_enabled | |
layer_identifier | identifier of the layer to set the flag to. |
bool ldtk:: level_bgs_ptr:: blending_enabled(gen::layer_ident layer_identifier) const
Indicates if blending must be applied to a level background with the given layer or not.
Parameters | |
---|---|
layer_identifier | identifier of the layer to get the flag from. |
Blending is applied to these level backgrounds by making it part of the blending top layer.
void ldtk:: level_bgs_ptr:: set_blending_enabled(bool blending_enabled)
Sets if blending must be applied to these level backgrounds or not.
Blending is applied to these level backgrounds by making it part of the blending top layer.
void ldtk:: level_bgs_ptr:: set_blending_enabled(bool blending_enabled,
gen::layer_ident layer_identifier)
Sets if blending must be applied to these level backgrounds or not.
Parameters | |
---|---|
blending_enabled | |
layer_identifier | identifier of the layer to set the flag to. |
Blending is applied to these level backgrounds by making it part of the blending top layer.
bool ldtk:: level_bgs_ptr:: blending_top_enabled(gen::layer_ident layer_identifier) const
Indicates if a level background with the given layer is part of the blending top layer or not.
Parameters | |
---|---|
layer_identifier | identifier of the layer to get the flag from. |
void ldtk:: level_bgs_ptr:: set_blending_top_enabled(bool blending_top_enabled,
gen::layer_ident layer_identifier)
Sets if a level background of the given layer is part of the blending top layer or not.
Parameters | |
---|---|
blending_top_enabled | |
layer_identifier | identifier of the layer to set the flag to. |
bool ldtk:: level_bgs_ptr:: blending_bottom_enabled(gen::layer_ident layer_identifier) const
Indicates if a level background with the given layer is part of the blending bottom layer or not.
Parameters | |
---|---|
layer_identifier | identifier of the layer to get the flag from. |
void ldtk:: level_bgs_ptr:: set_blending_bottom_enabled(bool blending_bottom_enabled,
gen::layer_ident layer_identifier)
Sets if a level background of the given layer is part of the blending bottom layer or not.
Parameters | |
---|---|
blending_bottom_enabled | |
layer_identifier | identifier of the layer to set the flag to. |
bn::green_swap_mode ldtk:: level_bgs_ptr:: green_swap_mode(gen::layer_ident layer_identifier) const
Indicates how a level background with the given layer must be displayed when green swap is enabled.
Parameters | |
---|---|
layer_identifier | identifier of the layer to get the mode from. |
void ldtk:: level_bgs_ptr:: 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 must be displayed when green swap is enabled.
Parameters | |
---|---|
green_swap_mode | |
layer_identifier | identifier of the layer to set the mode to. |
bool ldtk:: level_bgs_ptr:: visible(gen::layer_ident layer_identifier) const
Indicates if a level background with the given layer must be committed to the GBA or not.
Parameters | |
---|---|
layer_identifier | identifier of the layer to get the flag from. |
void ldtk:: level_bgs_ptr:: set_visible(bool visible,
gen::layer_ident layer_identifier)
Sets if a level background of the given layer must be committed to the GBA or not.
Parameters | |
---|---|
visible | |
layer_identifier | identifier of the layer to set the flag to. |
bool ldtk:: level_bgs_ptr:: visible_in_window(const bn::window& window,
gen::layer_ident layer_identifier) const
Indicates if a level background with the given layer is visible in the given window or not.
Parameters | |
---|---|
window | |
layer_identifier | identifier of the layer to get the flag from. |
void ldtk:: level_bgs_ptr:: set_visible_in_window(bool visible,
bn::window& window,
gen::layer_ident layer_identifier)
Sets if a level background of the given layer must be visible in the given window or not.
Parameters | |
---|---|
visible | |
window | |
layer_identifier | identifier of the layer to set the flag to. |
void ldtk:: level_bgs_ptr:: set_camera(const bn::camera_ptr& camera)
Sets the bn::camera_ptr
attached to these level backgrounds.
Parameters | |
---|---|
camera | bn::camera_ptr to copy to these level backgrounds. |
void ldtk:: level_bgs_ptr:: set_camera(bn::camera_ptr&& camera)
Sets the bn::camera_ptr
attached to these level backgrounds.
Parameters | |
---|---|
camera | bn::camera_ptr to move to these level backgrounds. |
void ldtk:: level_bgs_ptr:: set_camera(const bn::optional<bn::camera_ptr>& camera)
Sets or removes the bn::camera_ptr
attached to these level backgrounds.
Parameters | |
---|---|
camera | Optional bn::camera_ptr to copy to these level backgrounds. |
void ldtk:: level_bgs_ptr:: set_camera(bn::optional<bn::camera_ptr>&& camera)
Sets or removes the bn::camera_ptr
attached to these level backgrounds.
Parameters | |
---|---|
camera | Optional bn::camera_ptr to move to these level backgrounds. |
void ldtk:: level_bgs_ptr:: swap(level_ bgs_ ptr& other) noexcept
Exchanges the contents of this level_
with those of the other one.
Parameters | |
---|---|
other | level_ to exchange the contents with. |
void swap(level_ bgs_ ptr& a,
level_ bgs_ ptr& b) noexcept
Exchanges the contents of a level_bg_ptr
with those of another one.
Parameters | |
---|---|
a | First level_bg_ptr to exchange the contents with. |
b | Second level_bg_ptr to exchange the contents with. |