Skip to content
Modar Nasser edited this page Feb 26, 2024 · 3 revisions

In file LDtkLoader/defs/FieldDef.hpp

Enum class : ldtk::FieldType

Contains enum values representing all the possible types of a Field.

  1. Int
  2. Float
  3. Bool
  4. String
  5. Color
  6. Point
  7. Enum
  8. FilePath
  9. EntityRef
  10. ArrayInt
  11. ArrayFloat
  12. ArrayBool
  13. ArrayString
  14. ArrayColor
  15. ArrayPoint
  16. ArrayEnum
  17. ArrayFilePath
  18. ArrayEntityRef

These enum values can be used to get a field from an Entity:

const auto& field_value = entity.getField<ldtk::FieldType::ArrayEntityRef>();
// The field_value variable will be a ldtk::ArrayField<ldtk::EntityRef>

Class : ldtk::FieldDef

Fields

type

ldtk::FieldType ldtk::FieldDef::type;

Type of the Field defined by the FieldDef.

name

std::string ldtk::FieldDef::name;

Name of the Field defined by the FieldDef.

Type : ldtk::getFieldType<T>

Mainly for internal use

template<FieldType T>
using getFieldType = typename field_type_from_enum_<T>::type;

Utility used to get the underlying type from a FieldType enum value.

For example, to get the underlying type of a ldtk::FieldType::ArrayColor field, you can use ldtk::getFieldType<ldtk::FieldType::ArrayColor>.

Clone this wiki locally