Flecs v4.0
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
decl.hpp
Go to the documentation of this file.
1
6#pragma once
7
8namespace flecs {
9
18/* Primitive type aliases */
19using bool_t = ecs_bool_t;
20using char_t = ecs_char_t;
21using u8_t = ecs_u8_t;
22using u16_t = ecs_u16_t;
23using u32_t = ecs_u32_t;
24using u64_t = ecs_u64_t;
25using uptr_t = ecs_uptr_t;
26using i8_t = ecs_i8_t;
27using i16_t = ecs_i16_t;
28using i32_t = ecs_i32_t;
29using i64_t = ecs_i64_t;
30using iptr_t = ecs_iptr_t;
31using f32_t = ecs_f32_t;
32using f64_t = ecs_f64_t;
33
34/* Embedded type aliases */
35using member_t = ecs_member_t;
36using enum_constant_t = ecs_enum_constant_t;
37using bitmask_constant_t = ecs_bitmask_constant_t;
38
39/* Components */
40using Type = EcsType;
41using TypeSerializer = EcsTypeSerializer;
42using Primitive = EcsPrimitive;
43using Enum = EcsEnum;
44using Bitmask = EcsBitmask;
45using Member = EcsMember;
46using MemberRanges = EcsMemberRanges;
47using Struct = EcsStruct;
48using Array = EcsArray;
49using Vector = EcsVector;
50using Unit = EcsUnit;
51
53struct bitmask {
54 uint32_t value;
55};
56
57/* Handles to builtin reflection types */
58static const flecs::entity_t Bool = ecs_id(ecs_bool_t);
59static const flecs::entity_t Char = ecs_id(ecs_char_t);
60static const flecs::entity_t Byte = ecs_id(ecs_byte_t);
61static const flecs::entity_t U8 = ecs_id(ecs_u8_t);
62static const flecs::entity_t U16 = ecs_id(ecs_u16_t);
63static const flecs::entity_t U32 = ecs_id(ecs_u32_t);
64static const flecs::entity_t U64 = ecs_id(ecs_u64_t);
65static const flecs::entity_t Uptr = ecs_id(ecs_uptr_t);
66static const flecs::entity_t I8 = ecs_id(ecs_i8_t);
67static const flecs::entity_t I16 = ecs_id(ecs_i16_t);
68static const flecs::entity_t I32 = ecs_id(ecs_i32_t);
69static const flecs::entity_t I64 = ecs_id(ecs_i64_t);
70static const flecs::entity_t Iptr = ecs_id(ecs_iptr_t);
71static const flecs::entity_t F32 = ecs_id(ecs_f32_t);
72static const flecs::entity_t F64 = ecs_id(ecs_f64_t);
73static const flecs::entity_t String = ecs_id(ecs_string_t);
74static const flecs::entity_t Entity = ecs_id(ecs_entity_t);
75static const flecs::entity_t Constant = EcsConstant;
76static const flecs::entity_t Quantity = EcsQuantity;
77
78namespace meta {
79
80/* Type kinds supported by reflection system */
81using type_kind_t = ecs_type_kind_t;
82static const type_kind_t PrimitiveType = EcsPrimitiveType;
83static const type_kind_t BitmaskType = EcsBitmaskType;
84static const type_kind_t EnumType = EcsEnumType;
85static const type_kind_t StructType = EcsStructType;
86static const type_kind_t ArrayType = EcsArrayType;
87static const type_kind_t VectorType = EcsVectorType;
88static const type_kind_t CustomType = EcsOpaqueType;
89static const type_kind_t TypeKindLast = EcsTypeKindLast;
90
91/* Primitive type kinds supported by reflection system */
92using primitive_kind_t = ecs_primitive_kind_t;
93static const primitive_kind_t Bool = EcsBool;
94static const primitive_kind_t Char = EcsChar;
95static const primitive_kind_t Byte = EcsByte;
96static const primitive_kind_t U8 = EcsU8;
97static const primitive_kind_t U16 = EcsU16;
98static const primitive_kind_t U32 = EcsU32;
99static const primitive_kind_t U64 = EcsU64;
100static const primitive_kind_t I8 = EcsI8;
101static const primitive_kind_t I16 = EcsI16;
102static const primitive_kind_t I32 = EcsI32;
103static const primitive_kind_t I64 = EcsI64;
104static const primitive_kind_t F32 = EcsF32;
105static const primitive_kind_t F64 = EcsF64;
106static const primitive_kind_t UPtr = EcsUPtr;
107static const primitive_kind_t IPtr = EcsIPtr;
108static const primitive_kind_t String = EcsString;
109static const primitive_kind_t Entity = EcsEntity;
110static const primitive_kind_t PrimitiveKindLast = EcsPrimitiveKindLast;
111
114namespace _ {
115
116void init(flecs::world& world);
117
118} // namespace _
119} // namespace meta
120} // namespace flecs
121
122#include "cursor.hpp"
123#include "opaque.hpp"
FLECS_API const ecs_entity_t ecs_id(EcsDocDescription)
Component id for EcsDocDescription.
struct EcsMember EcsMember
Component added to member entities.
struct EcsPrimitive EcsPrimitive
Component added to primitive types.
bool ecs_bool_t
Primitive type definitions.
Definition meta.h:97
struct EcsEnum EcsEnum
Component added to enum type entities.
uint32_t ecs_u32_t
Builtin u32 type.
Definition meta.h:102
struct ecs_bitmask_constant_t ecs_bitmask_constant_t
Type that describes an bitmask constant.
int16_t ecs_i16_t
Builtin i16 type.
Definition meta.h:106
struct EcsStruct EcsStruct
Component added to struct type entities.
uint8_t ecs_u8_t
Builtin u8 type.
Definition meta.h:100
struct ecs_member_t ecs_member_t
Element type of members vector in EcsStruct.
struct EcsVector EcsVector
Component added to vector type entities.
int64_t ecs_i64_t
Builtin i64 type.
Definition meta.h:108
char * ecs_string_t
Builtin string type.
Definition meta.h:112
struct EcsBitmask EcsBitmask
Component added to bitmask type entities.
FLECS_API const ecs_entity_t EcsConstant
Tag added to enum/bitmask constants.
uint64_t ecs_u64_t
Builtin u64 type.
Definition meta.h:103
intptr_t ecs_iptr_t
Builtin iptr type.
Definition meta.h:109
uintptr_t ecs_uptr_t
Builtin uptr type.
Definition meta.h:104
FLECS_API const ecs_entity_t EcsQuantity
Tag added to unit quantities.
float ecs_f32_t
Builtin f32 type.
Definition meta.h:110
ecs_primitive_kind_t
Primitive type kinds supported by meta addon.
Definition meta.h:172
struct EcsArray EcsArray
Component added to array type entities.
double ecs_f64_t
Builtin f64 type.
Definition meta.h:111
char ecs_char_t
Builtin char type.
Definition meta.h:98
struct ecs_enum_constant_t ecs_enum_constant_t
Type that describes an enum constant.
ecs_type_kind_t
Type kinds supported by meta addon.
Definition meta.h:153
uint16_t ecs_u16_t
Builtin u16 type.
Definition meta.h:101
int32_t ecs_i32_t
Builtin i32 type.
Definition meta.h:107
struct EcsType EcsType
Component that is automatically added to every type with the right kind.
int8_t ecs_i8_t
Builtin i8 type.
Definition meta.h:105
unsigned char ecs_byte_t
Builtin ecs_byte type.
Definition meta.h:99
struct EcsMemberRanges EcsMemberRanges
Component added to member entities to express valid value ranges.
struct EcsTypeSerializer EcsTypeSerializer
Component that stores the type serializer.
struct EcsUnit EcsUnit
Component that stores unit data.
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:346
Helpers for opaque type registration.
Base type for bitmasks.
Definition decl.hpp:53
The world.
Definition world.hpp:137