Flecs v4.1
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
flecs_c.h File Reference

Extends the core API with convenience macros for C applications. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ECS_DECLARE(id)
 Forward declare an entity, tag, prefab, or any other entity identifier.
#define ECS_ENTITY_DECLARE   ECS_DECLARE
 Forward declare an entity.
#define ECS_ENTITY_DEFINE(world, id_, ...)
 Define a forward-declared entity.
#define ECS_ENTITY(world, id, ...)
 Declare and define an entity.
#define ECS_TAG_DECLARE   ECS_DECLARE
 Forward declare a tag.
#define ECS_TAG_DEFINE(world, id)
 Define a forward-declared tag.
#define ECS_TAG(world, id)
 Declare and define a tag.
#define ECS_PREFAB_DECLARE   ECS_DECLARE
 Forward declare a prefab.
#define ECS_PREFAB_DEFINE(world, id, ...)
 Define a forward-declared prefab.
#define ECS_PREFAB(world, id, ...)
 Declare and define a prefab.
#define ECS_COMPONENT_DECLARE(id)
 Forward declare a component.
#define ECS_COMPONENT_DEFINE(world, id_)
 Define a forward-declared component.
#define ECS_COMPONENT(world, id)
 Declare and define a component.
#define ECS_OBSERVER_DECLARE(id)
 Forward declare an observer.
#define ECS_OBSERVER_DEFINE(world, id_, kind, ...)
 Define a forward-declared observer.
#define ECS_OBSERVER(world, id, kind, ...)
 Declare and define an observer.
#define ECS_QUERY_DECLARE(name)
 Forward declare a query.
#define ECS_QUERY_DEFINE(world, name_, ...)
 Define a forward-declared query.
#define ECS_QUERY(world, name, ...)
 Declare and define a query.
#define ecs_entity(world, ...)
 Shorthand for creating an entity with ecs_entity_init().
#define ecs_component(world, ...)
 Shorthand for creating a component with ecs_component_init().
#define ecs_query(world, ...)
 Shorthand for creating a query with ecs_query_init().
#define ecs_observer(world, ...)
 Shorthand for creating an observer with ecs_observer_init().
#define ecs_new_w(world, T)
 Create a new entity with a component.
#define ecs_new_w_pair(world, first, second)
 Create a new entity with a pair.
#define ecs_bulk_new(world, component, count)
 Bulk create entities with a component.
#define ecs_add(world, entity, T)
 Add a component to an entity.
#define ecs_add_pair(world, subject, first, second)
 Add a pair to an entity.
#define ecs_remove(world, entity, T)
 Remove a component from an entity.
#define ecs_remove_pair(world, subject, first, second)
 Remove a pair from an entity.
#define ecs_auto_override(world, entity, T)
 Auto-override a component on an entity.
#define ecs_auto_override_pair(world, subject, first, second)
 Auto-override a pair on an entity.
#define ecs_insert(world, ...)
 Insert a new entity with a list of component values.
#define ecs_set_ptr(world, entity, component, ptr)
 Set a component using a pointer.
#define ecs_set(world, entity, component, ...)
 Set a component value.
#define ecs_set_pair(world, subject, First, second, ...)
 Set the first element of a pair.
#define ecs_set_pair_second(world, subject, first, Second, ...)
 Set the second element of a pair.
#define ecs_set_override(world, entity, T, ...)
 Set a component with auto-override.
#define ecs_emplace(world, entity, T, is_new)
 Emplace a component.
#define ecs_emplace_pair(world, entity, First, second, is_new)
 Emplace the first element of a pair.
#define ecs_get(world, entity, T)
 Get a component.
#define ecs_get_pair(world, subject, First, second)
 Get the first element of a pair.
#define ecs_get_pair_second(world, subject, first, Second)
 Get the second element of a pair.
#define ecs_get_mut(world, entity, T)
 Get a mutable pointer to a component.
#define ecs_get_mut_pair(world, subject, First, second)
 Get a mutable pointer to the first element of a pair.
#define ecs_get_mut_pair_second(world, subject, first, Second)
 Get a mutable pointer to the second element of a pair.
#define ecs_get_mut(world, entity, T)
 Get a mutable pointer to a component.
#define ecs_ensure(world, entity, T)
 Ensure entity has a component, return mutable pointer.
#define ecs_ensure_pair(world, subject, First, second)
 Ensure entity has the first element of a pair, return mutable pointer.
#define ecs_ensure_pair_second(world, subject, first, Second)
 Ensure entity has the second element of a pair, return mutable pointer.
#define ecs_modified(world, entity, component)
 Signal that a component has been modified.
#define ecs_modified_pair(world, subject, first, second)
 Signal that a pair has been modified.
#define ecs_record_get(world, record, T)
 Get a component from a record.
#define ecs_record_has(world, record, T)
 Test if a record has a component.
#define ecs_record_get_pair(world, record, First, second)
 Get the first element of a pair from a record.
#define ecs_record_get_pair_second(world, record, first, Second)
 Get the second element of a pair from a record.
#define ecs_record_ensure(world, record, T)
 Ensure a component on a record, return mutable pointer.
#define ecs_record_ensure_pair(world, record, First, second)
 Ensure the first element of a pair on a record, return mutable pointer.
#define ecs_record_ensure_pair_second(world, record, first, Second)
 Ensure the second element of a pair on a record, return mutable pointer.
#define ecs_ref_init(world, entity, T)
 Initialize a ref for a component.
#define ecs_ref_get(world, ref, T)
 Get a component from a ref.
#define ecs_singleton_add(world, comp)
 Add a singleton component.
#define ecs_singleton_remove(world, comp)
 Remove a singleton component.
#define ecs_singleton_get(world, comp)
 Get a singleton component.
#define ecs_singleton_get_mut(world, comp)
 Get a mutable pointer to a singleton component.
#define ecs_singleton_set_ptr(world, comp, ptr)
 Set a singleton component using a pointer.
#define ecs_singleton_set(world, comp, ...)
 Set a singleton component value.
#define ecs_singleton_ensure(world, comp)
 Ensure a singleton component, return mutable pointer.
#define ecs_singleton_emplace(world, comp, is_new)
 Emplace a singleton component.
#define ecs_singleton_modified(world, comp)
 Signal that a singleton component has been modified.
#define ecs_has(world, entity, T)
 Test if an entity has a component.
#define ecs_has_pair(world, entity, first, second)
 Test if an entity has a pair.
#define ecs_owns_pair(world, entity, first, second)
 Test if an entity owns a pair.
#define ecs_owns(world, entity, T)
 Test if an entity owns a component.
#define ecs_shares_id(world, entity, id)
 Test if an entity shares a component.
#define ecs_shares_pair(world, entity, first, second)
 Test if an entity shares a pair.
#define ecs_shares(world, entity, T)
 Test if an entity shares a component.
#define ecs_get_target_for(world, entity, rel, T)
 Get the target for a relationship.
#define ecs_enable_component(world, entity, T, enable)
 Enable or disable a component.
#define ecs_is_enabled(world, entity, T)
 Test if a component is enabled.
#define ecs_enable_pair(world, entity, First, second, enable)
 Enable or disable a pair.
#define ecs_is_enabled_pair(world, entity, First, second)
 Test if a pair is enabled.
#define ecs_lookup_from(world, parent, path)
 Lookup an entity from a parent.
#define ecs_get_path_from(world, parent, child)
 Get path from a parent.
#define ecs_get_path(world, child)
 Get path from root.
#define ecs_get_path_buf(world, child, buf)
 Get path from root, write to buffer.
#define ecs_new_from_path(world, parent, path)
 Create a new entity from a path.
#define ecs_add_path(world, entity, parent, path)
 Add a path to an entity.
#define ecs_add_fullpath(world, entity, path)
 Add a full path to an entity.
#define ecs_set_hooks(world, T, ...)
 Set component hooks.
#define ecs_get_hooks(world, T)
 Get component hooks.
#define ECS_CTOR(type, var, ...)
 Declare a constructor.
#define ECS_DTOR(type, var, ...)
 Declare a destructor.
#define ECS_COPY(type, dst_var, src_var, ...)
 Declare a copy action.
#define ECS_MOVE(type, dst_var, src_var, ...)
 Declare a move action.
#define ECS_ON_ADD(type, ptr, ...)
 Declare an on_add hook.
#define ECS_ON_REMOVE(type, ptr, ...)
 Declare an on_remove hook.
#define ECS_ON_SET(type, ptr, ...)
 Declare an on_set hook.
#define ecs_ctor(type)
 Map from typename to constructor function name.
#define ecs_dtor(type)
 Map from typename to destructor function name.
#define ecs_copy(type)
 Map from typename to copy function name.
#define ecs_move(type)
 Map from typename to move function name.
#define ecs_on_set(type)
 Map from typename to on_set function name.
#define ecs_on_add(type)
 Map from typename to on_add function name.
#define ecs_on_remove(type)
 Map from typename to on_remove function name.
#define ecs_count(world, type)
 Count entities with a component.
#define ecs_field(it, T, index)
 Get field data for a component.
#define ecs_field_self(it, T, index)
 Get field data for a self-owned component.
#define ecs_field_at(it, T, index, row)
 Get field data at a specific row.
#define ecs_table_get(world, table, T, offset)
 Get a component from a table at an offset.
#define ecs_table_get_pair(world, table, First, second, offset)
 Get the first element of a pair from a table at an offset.
#define ecs_table_get_pair_second(world, table, first, Second, offset)
 Get the second element of a pair from a table at an offset.
#define ecs_ids(...)
 Convenience macro for creating a compound literal ID array.
#define ecs_values(...)
 Convenience macro for creating a compound literal values array.
#define ecs_value_ptr(T, ptr)
 Convenience macro for creating a compound literal value.
#define ecs_pair_value(R, t, ...)
 Convenience macro for creating a compound literal pair value.
#define ecs_pair_value_2nd(r, T, ...)
 Convenience macro for creating a compound literal pair value.
#define ecs_value_new_t(world, T)
 Convenience macro for creating a heap-allocated value.
#define ecs_value(T, ...)
 Convenience macro for creating a compound literal value literal.
#define ecs_sort_table(id)
 Declare a table sort function.
#define ecs_compare(id)
 Declare a comparison function.
#define ECS_SORT_TABLE_WITH_COMPARE(id, op_name, compare_fn, ...)
 Declare an efficient table sorting operation that uses the provided compare function.
#define ECS_SORT_TABLE(id, ...)
 Declare an efficient table sorting operation that uses the default component comparison operator.
#define ECS_COMPARE(id, ...)
 Declare component comparison operations.
#define ecs_isa(e)
 Construct an IsA pair.
#define ecs_childof(e)
 Construct a ChildOf pair.
#define ecs_dependson(e)
 Construct a DependsOn pair.
#define ecs_with(e)
 Construct a With pair.
#define ecs_each(world, id)
 Iterate entities with a component.
#define ecs_each_pair(world, r, t)
 Iterate entities with a pair.
#define ecs_each_pair_t(world, R, t)
 Iterate entities with a pair (type-safe first element).

Detailed Description

Extends the core API with convenience macros for C applications.

Definition in file flecs_c.h.