16untyped_component& internal_member(
17 flecs::entity_t type_id,
22 bool use_offset =
false)
28 ecs_assert(eid != 0, ECS_INTERNAL_ERROR, NULL);
36 m.offset =
static_cast<int32_t
>(offset);
37 m.use_offset = use_offset;
47 flecs::entity_t type_id,
52 return internal_member(type_id, unit, name, count, 0,
false);
57 flecs::entity_t type_id,
63 return internal_member(type_id, unit, name, count, offset,
true);
68 flecs::entity_t type_id,
72 return member(type_id, 0, name, count);
77 flecs::entity_t type_id,
82 return member(type_id, 0, name, count, offset);
86template <
typename MemberType>
92 return member(type_id, name, count);
96template <
typename MemberType>
103 return member(type_id, name, count, offset);
107template <
typename MemberType>
109 flecs::entity_t unit,
114 return member(type_id, unit, name, count);
118template <
typename MemberType>
120 flecs::entity_t unit,
126 return member(type_id, unit, name, count, offset);
130template <
typename MemberType,
typename UnitType>
137 return member(type_id, unit_id, name, count);
141template <
typename MemberType,
typename UnitType>
149 return member(type_id, unit_id, name, count, offset);
153template <
typename MemberType,
typename ComponentType,
154 typename RealType =
typename std::remove_extent<MemberType>::type>
157 const MemberType ComponentType::* ptr)
160 size_t offset =
reinterpret_cast<size_t>(&(
static_cast<ComponentType*
>(
nullptr)->*ptr));
161 return member(type_id, name, std::extent<MemberType>::value, offset);
165template <
typename MemberType,
typename ComponentType,
166 typename RealType =
typename std::remove_extent<MemberType>::type>
168 flecs::entity_t unit,
170 const MemberType ComponentType::* ptr)
173 size_t offset =
reinterpret_cast<size_t>(&(
static_cast<ComponentType*
>(
nullptr)->*ptr));
174 return member(type_id, unit, name, std::extent<MemberType>::value, offset);
178template <
typename UnitType,
typename MemberType,
typename ComponentType,
179 typename RealType =
typename std::remove_extent<MemberType>::type>
182 const MemberType ComponentType::* ptr)
186 size_t offset =
reinterpret_cast<size_t>(&(
static_cast<ComponentType*
>(
nullptr)->*ptr));
187 return member(type_id, unit_id, name, std::extent<MemberType>::value, offset);
201 ecs_assert(eid != 0, ECS_INTERNAL_ERROR, NULL);
204 ecs_pair(flecs::Constant, flecs::I32),
sizeof(int32_t),
221 ecs_assert(eid != 0, ECS_INTERNAL_ERROR, NULL);
224 ecs_pair(flecs::Constant, flecs::U32),
sizeof(uint32_t),
231template <
typename Elem>
238 desc.
count = elem_count;
void ecs_add_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Add a (component) id to an entity.
#define ecs_assert(condition, error_code,...)
Assert.
ecs_id_t ecs_entity_t
An entity identifier.
flecs::entity entity(Args &&... args) const
Create an entity.
flecs::id id(E value) const
Convert enum constant to entity.
ecs_entity_t ecs_entity_init(ecs_world_t *world, const ecs_entity_desc_t *desc)
Find or create an entity.
void * ecs_ensure_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Get a mutable pointer to a component.
void ecs_set_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id, size_t size, const void *ptr)
Set the value of a component.
Component added to member entities to express valid value ranges.
ecs_member_value_range_t warning
Member value warning range.
ecs_member_value_range_t value
Member value range.
ecs_member_value_range_t error
Member value error range.
ecs_entity_t type
Member type.
Used with ecs_array_init().
ecs_entity_t entity
Existing entity to use for type (optional).
ecs_entity_t type
Element type.
int32_t count
Number of elements.
Used with ecs_entity_init().
const char * name
Name of the entity.
ecs_entity_t parent
Parent entity.
Element type of members vector in EcsStruct.
ecs_entity_t member
Should not be set by ecs_struct_desc_t.
double min
Min member value.
double max
Max member value.
void modified() const
Signal that component was modified.