15template <
typename Self>
16template <
typename Func>
19 this->world_, this->id_, func);
23template <typename T, if_t< is_enum<T>::value > >
30 const T* v =
static_cast<const T*
>(
ecs_get_id(world_, c, r));
32 "missing enum constant value");
36 return static_cast<const T*
>(
ecs_get_id(world_, id_, r));
40template<
typename First>
48 flecs::entity_t relationship,
56 flecs::entity_t relationship,
68template <
typename First,
typename Second>
70 return target_for(relationship, _::type<First, Second>::id(world_));
74 return target(flecs::ChildOf);
79 "cannot use readonly world/stage to create mutable handle");
85 "cannot use iterator created for readonly world/stage to create mutable handle");
91 "cannot use entity created for readonly world/stage to create mutable handle");
111 ECS_RECORD_TO_ROW(r->
row), 1);
116template <
typename Func>
126 for (
int i = 0; i < count; i ++) {
133template <
typename Func>
135 flecs::world_t *real_world =
const_cast<flecs::world_t*
>(
148 flecs::id_t pattern = pred;
150 pattern = ecs_pair(pred, obj);
164template <
typename Func>
172template <typename Func, if_t< is_callable<Func>::value > >
178 ecs_assert(id_ != 0, ECS_INVALID_PARAMETER,
"invalid lookup from null handle");
183inline flecs::entity entity_view::clone(
bool copy_value, flecs::entity_t dst_id)
const {
189 ecs_clone(world_, dst_id, id_, copy_value);
194template <
typename... Args>
199template <typename E, if_t< is_enum<E>::value >>
200inline flecs::id world::id(E value)
const {
201 flecs::entity_t constant = enum_type<E>(world_).entity(value);
205template <typename E, if_t< is_enum<E>::value >>
207 flecs::entity_t constant = enum_type<E>(world_).entity(value);
214 _::type<T>::id_explicit(world_, name,
true, 0,
false) );
217template <
typename... Args>
220 result.
add(flecs::Prefab);
227 result.
add(flecs::Prefab);
#define ecs_assert(condition, error_code,...)
Assert.
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
struct ecs_table_t ecs_table_t
A table stores entities and components for a specific type.
flecs::entity prefab(Args &&... args) const
Create a prefab.
flecs::entity entity(Args &&... args) const
Create an entity.
flecs::id_t * array() const
Return pointer to array.
int32_t count() const
Return number of ids in type.
ecs_entity_t ecs_clone(ecs_world_t *world, ecs_entity_t dst, ecs_entity_t src, bool copy_value)
Clone an entity This operation clones the components of one entity into another entity.
ecs_entity_t ecs_new(ecs_world_t *world)
Create new entity id.
ecs_entity_t ecs_get_target(const ecs_world_t *world, ecs_entity_t entity, ecs_entity_t rel, int32_t index)
Get the target of a relationship.
const ecs_type_t * ecs_get_type(const ecs_world_t *world, ecs_entity_t entity)
Get the type of an entity.
ecs_entity_t ecs_get_target_for_id(const ecs_world_t *world, ecs_entity_t entity, ecs_entity_t rel, ecs_id_t id)
Get the target of a relationship for a given id.
ecs_table_t * ecs_get_table(const ecs_world_t *world, ecs_entity_t entity)
Get the table of an entity.
const void * ecs_get_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Get an immutable pointer to a component.
ecs_record_t * ecs_record_find(const ecs_world_t *world, ecs_entity_t entity)
Find record for entity.
ecs_entity_t ecs_lookup_path_w_sep(const ecs_world_t *world, ecs_entity_t parent, const char *path, const char *sep, const char *prefix, bool recursive)
Lookup an entity from a path.
const ecs_type_t * ecs_table_get_type(const ecs_table_t *table)
Get type for table.
int32_t ecs_search_offset(const ecs_world_t *world, const ecs_table_t *table, int32_t offset, ecs_id_t id, ecs_id_t *id_out)
Search for component id in table type starting from an offset.
const ecs_world_t * ecs_get_world(const ecs_poly_t *poly)
Get world from poly.
ecs_table_t * table
Identifies a type (and table) in world.
uint32_t row
Table row of the entity.
A type is a list of (component) ids.
const Self & insert(const Func &func) const
Set 1..N components.
const Self & add() const
Add a component to an entity.
flecs::type type() const
Get the entity's type.
const T * get() const
Get component value.
flecs::string path(const char *sep="::", const char *init_sep="::") const
Return the entity path.
flecs::table_range range() const
Get table range for the entity.
flecs::entity target_for(flecs::entity_t relationship, flecs::id_t id) const
Get the target of a pair for a given relationship id.
flecs::entity lookup(const char *path, bool search_path=false) const
Lookup an entity by name.
flecs::table table() const
Get the entity's table.
flecs::entity parent() const
Get parent of entity.
void each(const Func &func) const
Iterate (component) ids of an entity.
flecs::entity target(int32_t index=0) const
Get target for a given pair.
flecs::entity mut(const flecs::world &stage) const
Return mutable entity handle for current stage When an entity handle created from the world is used w...
Class that wraps around a flecs::id_t.
flecs::entity second() const
Get second element from a pair.
Class for iterating over query results.
world_t * c_ptr() const
Obtain pointer to C world object.
bool is_readonly() const
Test whether the current world object is readonly.