ldtk::entity class

Public functions

auto get_field(gen::entity_field_ident identifier) const -> const field& constexpr
Looks up a field with its identifier.
auto def() const -> const entity_definition& constexpr
Reference to the Entity definition.
auto grid() const -> const bn::point& constexpr
Grid-based coordinates ([x,y] format)
auto identifier() const -> gen::entity_ident constexpr
Entity definition identifier.
auto pivot() const -> const bn::fixed_point& constexpr
Pivot coordinates ([x,y] format, values are from 0 to 1) of the Entity.
auto tags() const -> const bn::span<const gen::entity_tag>& constexpr
Array of tags defined in this Entity definition.
auto field_instances() const -> const bn::span<const field>& constexpr
An array of all custom fields and their values.
auto size() const -> const bn::size& constexpr
Entity size in pixels. For non-resizable entities, it will be the same as Entity definition.
auto width() const -> int constexpr
Entity width in pixels. For non-resizable entities, it will be the same as Entity definition.
auto height() const -> int constexpr
Entity height in pixels. For non-resizable entities, it will be the same as Entity definition.
auto iid() const -> gen::entity_iid constexpr
Unique instance identifier.
auto px() const -> const bn::point& constexpr
Pixel coordinates ([x,y] format) in current level coordinate space. Don't forget optional layer offsets, if they exist!

Function documentation

const field& ldtk::entity::get_field(gen::entity_field_ident identifier) const constexpr

Looks up a field with its identifier.

Parameters
identifier Unique identifier of the field to look up.
Returns Reference to the field.