ldtk::layer class

Public functions

auto find_entity(gen::entity_iid iid) const -> const entity& constexpr
Linear searches an entity with its Instance id.
auto def() const -> const layer_definition& constexpr
Reference to the Layer definition.
auto tileset_def() const -> const tileset_definition* constexpr
(Only Tile layers, Auto-layers) Reference to the corresponding Tileset
auto c_size() const -> const bn::size& constexpr
Grid-based size.
auto c_width() const -> int constexpr
Grid-based width.
auto c_height() const -> int constexpr
Grid-based height.
auto grid_size() const -> int constexpr
Grid size.
auto identifier() const -> gen::layer_ident constexpr
Layer definition identifier.
auto opacity() const -> bn::fixed constexpr
Layer opacity as Fixed [0-1].
auto px_total_offset() const -> const bn::point& constexpr
Total layer pixel offset, including both instance and definition offsets.
auto px_total_offset_x() const -> int constexpr
Total layer X pixel offset, including both instance and definition offsets.
auto px_total_offset_y() const -> int constexpr
Total layer Y pixel offset, including both instance and definition offsets.
auto type() const -> layer_type constexpr
Layer type.
auto auto_layer_tiles() const -> const tile_grid_base* constexpr
(Only Auto-layers) An array containing all tiles generated by Auto-layer rules. The array is already sorted in display order (ie. 1st tile is beneath 2nd, which is beneath 3rd etc.).
auto grid_tiles() const -> const tile_grid_base* constexpr
(Only Tile layers)
auto int_grid() const -> const int_grid_base* constexpr
(Only IntGrid layers) A list of all values in the IntGrid layer.
0 means "empty cell" and IntGrid values start at 1.
The size is c_width() x c_height() cells.
auto entity_instances() const -> const bn::span<const entity>& constexpr
(Only Entity layers)
auto iid() const -> gen::layer_iid constexpr
Unique layer instance id.
auto visible() const -> bool constexpr
Layer instance visibility.

Function documentation

const entity& ldtk::layer::find_entity(gen::entity_iid iid) const constexpr

Linear searches an entity with its Instance id.

Parameters
iid Instance id of the entity to search for.
Returns Reference to the found entity.

const tile_grid_base* ldtk::layer::auto_layer_tiles() const constexpr

(Only Auto-layers) An array containing all tiles generated by Auto-layer rules. The array is already sorted in display order (ie. 1st tile is beneath 2nd, which is beneath 3rd etc.).