41 m_id = ecs_new(
world, 0);
49 explicit entity(
const flecs::world_t *
world, flecs::id_t
id) {
50 m_world =
const_cast<flecs::world_t*
>(
world);
117 template <
typename First,
typename Second,
typename P = pair<First, Second>,
118 typename A = actual_type_t<P>, if_not_t< flecs::is_pair<First>::value> = 0>
131 template <
typename First>
135 return static_cast<First*
>(
157 template <
typename Second>
161 return static_cast<Second*
>(
169 template <
typename T>
181 template <
typename First,
typename Second>
191 template <
typename First>
224 template <
typename T>
229 template <
typename First,
typename Second,
typename P = flecs::pair<First, Second>,
230 typename A = actual_type_t<P>>
232 return ref<A>(m_world, m_id,
237 template <
typename First>
239 return ref<First>(m_world, m_id,
240 ecs_pair(_::cpp_type<First>::id(m_world),
second));
243 template <
typename Second>
244 ref<Second> get_ref_second(flecs::entity_t
first)
const {
245 return ref<Second>(m_world, m_id,
246 ecs_pair(
first, _::cpp_type<Second>::id(m_world)));
294 result.m_world =
const_cast<flecs::world_t*
>(
world);
304# include "mixins/json/entity.inl"
Entity class with only readonly operations.
void ecs_clear(ecs_world_t *world, ecs_entity_t entity)
Clear all components.
#define ecs_assert(condition, error_code,...)
Assert.
ecs_entity_t ecs_entity_init(ecs_world_t *world, const ecs_entity_desc_t *desc)
Find or create an entity.
void ecs_delete(ecs_world_t *world, ecs_entity_t entity)
Delete an entity.
void ecs_flatten(ecs_world_t *world, ecs_id_t pair, const ecs_flatten_desc_t *desc)
Recursively flatten relationship for target entity (experimental).
void ecs_modified_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Signal that a component has been modified.
void * ecs_get_mut_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Get a mutable pointer to a component.
const ecs_world_t * ecs_get_world(const ecs_poly_t *poly)
Get world from poly.
Used with ecs_entity_init.
const char * sep
Optional custom separator for hierarchical names.
const char * root_sep
Optional, used for identifiers relative to root.
const char * name
Name of the entity.
flecs::string_view name() const
Return the entity name.
A * get_mut() const
Get mutable pointer for a pair.
void destruct() const
Delete an entity.
void modified(entity_t second) const
Signal that the first part of a pair was modified.
void * get_mut(entity_t first, entity_t second) const
Get mutable pointer for a pair (untyped).
void modified(entity_t comp) const
Signal that component was modified.
void clear() const
Clear an entity.
void modified(entity_t first, entity_t second) const
Signal that a pair has modified (untyped).
Second * get_mut_second(entity_t first) const
Get mutable pointer for the second element of a pair.
entity(world_t *world, const char *name)
Create a named entity.
T * get_mut() const
Get mutable component value.
ref< T > get_ref() const
Get reference to component.
First * get_mut(entity_t second) const
Get mutable pointer for the first element of a pair.
void modified() const
Signal that the first element of a pair was modified.
void modified() const
Signal that component was modified.
entity(const flecs::world_t *world, flecs::id_t id)
Wrap an existing entity id.
static flecs::entity null(const flecs::world_t *world)
Entity id 0.
entity(entity_t id)
Conversion from flecs::entity_t to flecs::entity.
void flatten(flecs::entity_t r, const ecs_flatten_desc_t *desc=nullptr)
Recursively flatten relationship.
entity(world_t *world)
Create entity.
flecs::entity_view view() const
Return entity as entity_view.
void * get_mut(entity_t comp) const
Get mutable component value (untyped).
Class that wraps around a flecs::id_t.
flecs::entity second() const
Get second element from a pair.
flecs::entity first() const
Get first element from a pair.