54 explicit entity(
const flecs::world_t *
world, flecs::entity_t
id) {
55 world_ =
const_cast<flecs::world_t*
>(
world);
102 "operation invalid for empty type");
103 return *
static_cast<T*
>(
ecs_ensure_id(world_, id_, comp_id));
125 template <
typename First,
typename Second,
typename P = pair<First, Second>,
126 typename A = actual_type_t<P>, if_not_t< flecs::is_pair<First>::value> = 0>
139 template <
typename First>
143 "operation invalid for empty type");
144 return *
static_cast<First*
>(
166 template <
typename Second>
170 ECS_INVALID_PARAMETER,
"pair is not a component");
172 ECS_INVALID_PARAMETER,
"type of pair is not Second");
174 "operation invalid for empty type");
175 return *
static_cast<Second*
>(
185 template <
typename T>
189 "operation invalid for empty type");
198 template <
typename First,
typename Second,
typename A = actual_type_t<flecs::pair<First, Second>>>
203 "operation invalid for empty type");
212 template <
typename First>
216 "operation invalid for empty type");
246 template <typename T, if_t< is_actual<T>::value > = 0>
260 template <
typename T,
typename A = actual_type_t<T>, if_t< flecs::is_pair<T>::value > = 0>
262 return ref<A>(world_, id_,
268 template <
typename First,
typename Second,
typename P = flecs::pair<First, Second>,
269 typename A = actual_type_t<P>>
271 return ref<A>(world_, id_,
275 template <
typename First>
277 auto first = _::type<First>::id(world_);
278 return ref<First>(world_, id_, ecs_pair(
first,
second));
281 template <
typename Second>
282 ref<Second> get_ref_second(flecs::entity_t
first)
const {
283 auto second = _::type<Second>::id(world_);
285 ECS_INVALID_PARAMETER,
"pair is not a component");
287 ECS_INVALID_PARAMETER,
"type of pair is not Second");
288 return ref<Second>(world_, id_, ecs_pair(
first,
second));
333 result.world_ =
const_cast<flecs::world_t*
>(
world);
343# 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.
ecs_id_t ecs_get_with(const ecs_world_t *world)
Get current with id.
#define ecs_assert(condition, error_code,...)
Assert.
const ecs_type_info_t * ecs_get_type_info(const ecs_world_t *world, ecs_id_t id)
Get the type for an id.
ecs_entity_t ecs_new(ecs_world_t *world)
Create new entity id.
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_ensure_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Get a mutable pointer to a component.
void ecs_modified_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Signal that a component has been modified.
ecs_entity_t ecs_get_scope(const ecs_world_t *world)
Get the current scope.
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.
entity_t id() const
Get entity id.
void destruct() const
Delete an entity.
ref< T > get_ref() const
Get reference to component.
void modified(entity_t second) const
Signal that the first part of a pair was modified.
void modified() const
Signal that the first element of a pair was modified.
First & ensure(entity_t second) const
Get mutable pointer for the first element of a pair.
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).
entity(world_t *world, const char *name)
Create a named entity.
void * ensure(entity_t first, entity_t second) const
Get mutable pointer for a pair (untyped).
entity(const flecs::world_t *world, flecs::entity_t id)
Wrap an existing entity id.
void modified() const
Signal that component was modified.
T & ensure() const
Get mutable component value.
static flecs::entity null(const flecs::world_t *world)
Entity id 0.
Second & ensure_second(entity_t first) const
Get mutable pointer for the second element of a pair.
void * ensure(entity_t comp) const
Get mutable component value (untyped).
entity(entity_t id)
Conversion from flecs::entity_t to flecs::entity.
entity(world_t *world)
Create entity.
flecs::entity_view view() const
Return entity as entity_view.
ref< A > get_ref() const
Get reference to component.
A & ensure() const
Get mutable pointer for a pair.
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.