21template <
typename Self>
22template <
typename Func>
25 this->world_, this->id_, func);
29template<
typename Enum>
35template<
typename First>
63template <
typename First,
typename Second>
74 "cannot use read-only world/stage to create mutable handle");
80 "cannot use iterator created for read-only world/stage to create mutable handle");
86 "cannot use entity created for read-only world/stage to create mutable handle");
106 ECS_RECORD_TO_ROW(r->row), 1);
111template <
typename Func>
121 for (
int i = 0; i < count; i ++) {
128template <
typename Func>
145 pattern = ecs_pair(pred, obj);
159template <
typename Func>
167template <typename Func, if_t< is_callable<Func>::value > >
189template <
typename... Args>
194template <typename E, if_t< is_enum<E>::value >>
195inline flecs::id world::id(E value)
const {
200template <typename E, if_t< is_enum<E>::value >>
211template <
typename... Args>
214 result.
add(flecs::Prefab);
221 result.
add(flecs::Prefab);
component< T > & constant(const char *name, T value)
Add a constant.
#define ecs_assert(condition, error_code,...)
Assert.
#define ECS_INVALID_PARAMETER
Invalid parameter error code.
uint64_t ecs_id_t
IDs are the things that can be added to an entity.
struct ecs_record_t ecs_record_t
Information about an entity, like its table and row.
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.
E to_constant() const
Convert an entity to an enum constant.
flecs::entity entity(Args &&... args) const
Create an entity.
ecs_entity_t entity_t
Entity type.
ecs_world_t world_t
World type.
ecs_entity_t ecs_clone(ecs_world_t *world, ecs_entity_t dst, ecs_entity_t src, bool copy_value)
Clone an 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.
ecs_entity_t ecs_get_parent(const ecs_world_t *world, ecs_entity_t entity)
Get the parent (target of the ChildOf relationship) for 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 component)
Get the target of a relationship for a given component.
const ecs_type_t * ecs_get_type(const ecs_world_t *world, ecs_entity_t entity)
Get the type of an entity.
ecs_table_t * ecs_get_table(const ecs_world_t *world, ecs_entity_t entity)
Get the table of an 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)
Look up an entity from a path.
int32_t ecs_search_offset(const ecs_world_t *world, const ecs_table_t *table, int32_t offset, ecs_id_t component, ecs_id_t *component_out)
Search for a component in a table type starting from an offset.
const ecs_type_t * ecs_table_get_type(const ecs_table_t *table)
Get the type for a table.
const ecs_world_t * ecs_get_world(const ecs_poly_t *poly)
Get the world from a poly.
Component added to enum type entities.
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.
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.
const T & get() const
Get component value.
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 clone(bool clone_value=true, flecs::entity_t dst_id=0) const
Clone an entity.
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.
Enum get_constant() const
Get enum constant for enum relationship.
flecs::entity target(int32_t index=0) const
Get target for a given pair.
flecs::entity mut(const flecs::world &stage) const
Return a mutable entity handle for the current stage.
entity()
Default constructor.
Class that wraps around a flecs::id_t.
flecs::entity entity() const
Return ID as entity (only allowed when ID is a valid entity).
flecs::world world() const
Get the world.
flecs::id_t id_
The raw ID value.
flecs::entity second() const
Get second element from a pair.
flecs::world_t * world_
World is optional, but guarantees that entity identifiers extracted from the ID are valid.
Class for iterating over query results.
flecs::world world() const
Get the world associated with the iterator.
ref()
Default constructor.
flecs::id_t * array() const
Return a pointer to the ID array.
int32_t count() const
Return the number of IDs in the type.
Untyped component reference.
untyped_ref()
Default constructor.
flecs::entity entity() const
Return the entity associated with the reference.
world_t * world_
Pointer to the underlying C world.
world_t * c_ptr() const
Obtain a pointer to the C world object.
bool is_readonly() const
Test whether the current world object is readonly.