C API

API toggles & constants

FLECS_FLOAT float

FLECS_NO_DEPRECATED_WARNINGS

FLECS_SANITIZE

FLECS_CPP /* C++ API */

Mentioned in:

FLECS_MODULE /* Module support */

FLECS_PARSER /* String parser for queries */

FLECS_PLECS /* ECS data definition format */

Mentioned in:

FLECS_RULES /* Constraint solver for advanced queries */

FLECS_SNAPSHOT /* Snapshot & restore ECS data */

Mentioned in:

FLECS_STATS /* Keep track of runtime statistics */

Mentioned in:

FLECS_SYSTEM /* System support */

FLECS_PIPELINE /* Pipeline support */

FLECS_TIMER /* Timer support */

Mentioned in:

FLECS_META /* Reflection support */

FLECS_META_C /* Utilities for populating reflection data */

Mentioned in:

FLECS_EXPR /* Parsing strings to/from component values */

Mentioned in:

FLECS_JSON /* Parsing JSON to/from component values */

FLECS_DOC /* Document entities & components */

Mentioned in:

FLECS_COREDOC /* Documentation for core entities & components */

Mentioned in:

FLECS_LOG /* When enabled ECS provides more detailed logs */

Mentioned in:

FLECS_APP /* Application addon */

Mentioned in:

FLECS_OS_API_IMPL /* Default implementation for OS API */

FLECS_HTTP /* Tiny HTTP server for connecting to remote UI */

Mentioned in:

FLECS_REST /* REST API for querying application data */

Mentioned in:

Basic API types

typedef void ecs_poly_t

A poly object. A poly (short for polymorph) object is an object that has a variable list of capabilities, determined by a mixin table. This is the current list of types in the flecs API that can be used as an ecs_poly_t:

Functions that accept an ecs_poly_t argument can accept objects of these types. If the object does not have the requested mixin the API will throw an assert.

The poly/mixin framework enables partially overlapping features to be implemented once, and enables objects of different types to interact with each other depending on what mixins they have, rather than their type (in some ways it's like a mini-ECS). Additionally, each poly object has a header that enables the API to do sanity checking on the input arguments.

typedef uint64_t ecs_id_t

An id. Ids are the things that can be added to an entity. An id can be an entity or pair, and can have an optional role.

Mentioned in:

Quickstart / Pair

Quickstart / Type

Manual / Local component handles

Query Manual / Iter (C)

Relations Manual / Relation wildcards

Relations Manual / Inspecting relations

Relations Manual / Relation performance

typedef ecs_id_t ecs_entity_t

An entity identifier.

Mentioned in:

Readme / Show me the code!

Quickstart / Entity

Quickstart / Component

Quickstart / Tag

Quickstart / Pair

Quickstart / Hierarchies

Quickstart / Instancing

Quickstart / Type

Quickstart / System

Quickstart / Observer

Manual / Entity

Manual / Component

Manual / Tag

Manual / System

Manual / Phase

Manual / Pipeline

Manual / Trigger

Manual / Type

Manual / Scope

Manual / Naming conventions

Manual / Entity names

Manual / Macro's

Manual / Entities

Manual / Generations

Manual / Basic usage

Manual / Advanced usage

Manual / Type roles

Manual / Components

Manual / Global component handles

Manual / Component disabling

Manual / Tag handles

Manual / Switchable tags

Manual / Modules

Manual / Hierarchies

Manual / Iteration

Manual / Path identifiers

Manual / Scoping

Manual / Paths and signatures

Manual / Inheritance

Manual / Overriding

Manual / Automatic overriding

Manual / Inheritance hierarchies

Manual / Prefabs

Manual / Deferred operations

Manual / Staging

Query Manual / Iter (C)

Query Manual / Sorting

Query Manual / Sorting by entity id

Query Manual / Tag

Query Manual / Relation

Relations Manual / Relations

Relations Manual / Relation components

Relations Manual / Using relations to add components multiple times

Relations Manual / Relation wildcards

Relations Manual / Inspecting relations

Relations Manual / The IsA relation

Relations Manual / Component sharing

Relations Manual / Final entities

Relations Manual / The ChildOf relation

Relations Manual / Namespacing

Relations Manual / Scoping

Relations Manual / Relation cleanup properties

Relations Manual / Transitive relations

Relations Manual / Tag relations

Relations Manual / Symmetric relations

Relations Manual / With relations

typedef const ecs_vector_t * ecs_type_t

A vector containing component identifiers used to describe a type.

Mentioned in:

Quickstart / Type

Manual / Basic usage

Manual / Advanced usage

Manual / Local component handles

Manual / Tag handles

typedef struct ecs_world_t ecs_world_t

A world is the container for all ECS data and supporting features.

Mentioned in:

Readme / Show me the code!

Quickstart / World

Quickstart / Module

Manual / Naming conventions

Manual / Components

Manual / Global component handles

Manual / Local component handles

Manual / Component disabling

Manual / Tagging

Manual / Tag handles

Manual / Modules

typedef struct ecs_query_t ecs_query_t

A query allows for cached iteration over ECS data

Mentioned in:

Quickstart / Hierarchies

Quickstart / Query

Manual / Hierarchical queries

Query Manual / Query Descriptors (C)

Query Manual / Iter (C)

Query Manual / Sorting

Query Manual / Sorting by entity id

Query Manual / Not operator

Query Manual / Optional operator

Query Manual / Or operator

Query Manual / AndFrom, OrFrom, NotFrom operators

Query Manual / Read/write access

Query Manual / Component

Query Manual / Tag

Query Manual / Relation

Query Manual / Singleton

Query Manual / Assigning Identifiers with the API

Query Manual / Wildcard

Query Manual / Variables

Query Manual / Substitution on Identifiers

Relations Manual / Relations

Relations Manual / Relation wildcards

typedef struct ecs_rule_t ecs_rule_t

A rule implements a non-trivial filter

typedef struct ecs_observable_t ecs_observable_t

An observable contains lists of triggers for specific events/components

typedef struct ecs_iter_t ecs_iter_t

Mentioned in:

typedef struct ecs_ref_t ecs_ref_t

Refs cache data that lets them access components faster than ecs_get.

typedef struct ecs_mixins_t ecs_mixins_t

API constants

ECS_MAX_ADD_REMOVE (32)

ECS_TERM_CACHE_SIZE (4)

ECS_TERM_DESC_CACHE_SIZE (16)

ECS_TRIGGER_DESC_EVENT_COUNT_MAX (8)

Function Prototypes

typedef void(* ecs_run_action_t)(ecs_iter_t *it)

Function prototype for runnables (systems, observers). The run callback overrides the default behavior for iterating through the results of a runnable object.

The default runnable iterates the iterator, and calls an iter_action (see below) for each returned result.

Parameters

it - The iterator to be iterated by the runnable.

typedef void(* ecs_iter_action_t)(ecs_iter_t *it)

Function prototype for iterables. A system may invoke a callback multiple times, typically once for each matched table.

Parameters

it - The iterator containing the data for the current match.

typedef void(* ecs_iter_init_action_t)(const ecs_world_t *world, const ecs_poly_t *iterable, ecs_iter_t *it, ecs_term_t *filter)

Function prototype for creating an iterator from a poly. Used to create iterators from poly objects with the iterable mixin. When a filter is provided, an array of two iterators must be passed to the function. This allows the mixin implementation to create a chained iterator when necessary, which requires two iterator objects.

Parameters

world - The world or stage for which to create the iterator.

iterable - An iterable poly object.

it - The iterator to create (out parameter)

filter - Optional term to filter results.

typedef bool(* ecs_iter_next_action_t)(ecs_iter_t *it)

Function prototype for iterating an iterator. Stored inside initialized iterators. This allows an application to * iterate an iterator without needing to know what created it.

Parameters

it - The iterator to iterate.

Returns
True if iterator has no more results, false if it does.

typedef void(* ecs_iter_fini_action_t)(ecs_iter_t *it)

Function prototype for freeing an iterator. Free iterator resources.

Parameters

it - The iterator to free.

typedef int(* ecs_order_by_action_t)(ecs_entity_t e1, const void *ptr1, ecs_entity_t e2, const void *ptr2)

Callback used for sorting components

typedef uint64_t(* ecs_group_by_action_t)(ecs_world_t *world, ecs_type_t type, ecs_id_t id, void *ctx)

Callback used for ranking types

typedef void(* ecs_module_action_t)(ecs_world_t *world)

Initialization action for modules

typedef void(* ecs_fini_action_t)(ecs_world_t *world, void *ctx)

Action callback on world exit

typedef void(* ecs_ctx_free_t)(void *ctx)

Function to cleanup context data

typedef int(* ecs_compare_action_t)(const void *ptr1, const void *ptr2)

Callback used for sorting values

typedef uint64_t(* ecs_hash_value_action_t)(const void *ptr)

Callback used for hashing values

Public mixin types.

ecs_header_tHeader for ecs_poly_t objects.
ecs_iterable_tIterable mixin

Types used to describe filters, terms and triggers

EcsDefaultSet (0) /* Default set, SuperSet|Self for This subject */

Set flags describe if & how a matched entity should be substituted

EcsSelf (1) /* Select self (inclusive) */

Mentioned in:

EcsSuperSet (2) /* Select superset until predicate match */

Mentioned in:

EcsSubSet (4) /* Select subset until predicate match */

EcsCascade (8) /* Use breadth-first ordering of relations */

Mentioned in:

EcsAll (16) /* Walk full super/subset, regardless of match */

EcsParent (32) /* Shortcut for SuperSet(ChildOf) */

EcsNothing (64) /* Select from nothing */

ecs_inout_kind_tSpecify read/write access for term
ecs_var_kind_tSpecifies whether term identifier is a variable or entity
ecs_oper_kind_tType describing an operator used in an signature of a system signature
ecs_term_set_tSubstitution with set parameters
ecs_term_id_tType that describes a single identifier in a term
ecs_term_tType that describes a single column in the system signature
ecs_filter_tFilters alllow for ad-hoc quick filtering of entity tables.
ecs_trigger_tA trigger reacts to events matching a single term
ecs_observer_tAn observer reacts to events matching multiple filter terms

Types used for creating API constructs

ecs_entity_desc_tUsed with ecs_entity_init
ecs_bulk_desc_tUsed with ecs_bulk_init
ecs_component_desc_tUsed with ecs_component_init.
ecs_type_desc_tUsed with ecs_type_init.
ecs_filter_desc_tUsed with ecs_filter_init.
ecs_query_desc_tUsed with ecs_query_init.
ecs_trigger_desc_tUsed with ecs_trigger_init.
ecs_observer_desc_tUsed with ecs_observer_init.

Builtin components

EcsIdentifierA (string) identifier
EcsComponentComponent information.
EcsTypeComponent that stores an ecs_type_t
EcsComponentLifecycleComponent that contains lifecycle callbacks for a component.
EcsTriggerComponent that stores reference to trigger
EcsObserverComponent that stores reference to observer
EcsQueryComponent for storing a query

typedef ecs_iterable_t EcsIterable

Component for iterable entities

Miscalleneous types

ecs_world_info_tType that contains information about the world.

Type Roles

ECS_ROLE (1ull << 63)

Role bit added to roles to differentiate between roles and generations

Builtin components & tags

ecs_id overloadBuiltin component ids
ecs_id overloadPipeline module component ids
ecs_id overloadTimer module component ids

EcsLastInternalComponentId (ecs_id(EcsSystem))

EcsFirstUserComponentId (32)

EcsFirstUserEntityId (ECS_HI_COMPONENT_ID + 128)

Mentioned in:

World API

ecs_initCreate a new world
ecs_miniSame as ecs_init, but with minimal set of modules loaded.
ecs_init_w_argsCreate a new world with arguments
ecs_finiDelete a world
ecs_atfiniRegister action to be executed when world is destroyed
ecs_run_post_frameRegister action to be executed once after frame
ecs_quitSignal exit This operation signals that the application should quit
ecs_should_quitReturn whether a quit has been signaled.
ecs_set_component_actions_w_idRegister ctor, dtor, copy & move actions for component.
ecs_set_contextSet a world context
ecs_get_contextGet the world context
ecs_get_world_infoGet world info.
ecs_dimDimension the world for a specified number of entities
ecs_set_entity_rangeSet a range for issueing new entity ids
ecs_set_entity_generationSets the entity's generation in the world's sparse set
ecs_enable_range_checkEnable/disable range limits
ecs_enable_lockingEnable world locking while in progress
ecs_lockLocks the world
ecs_unlockUnlocks the world
ecs_begin_waitWait until world becomes available
ecs_end_waitRelease world after calling ecs_begin_wait
ecs_measure_frame_timeMeasure frame time
ecs_measure_system_timeMeasure system time
ecs_set_target_fpsSet target frames per second (FPS) for application
ecs_get_threadsGet current number of threads.

Creating Entities

ecs_new_idCreate new entity id
ecs_new_low_idCreate new low id
ecs_new_w_idCreate new entity
ecs_entity_initFind or create an entity
ecs_bulk_initBulk create/populate new entities
ecs_component_initFind or create a component
ecs_type_initCreate a new type entity
ecs_bulk_new_w_idCreate N new entities
ecs_cloneClone an entity This operation clones the components of one entity into another entity

Adding & Removing

ecs_add_idAdd an entity to an entity
ecs_remove_idRemove an entity from an entity

Enabling & Disabling components.

ecs_enable_component_w_idEnable or disable component
ecs_is_component_enabled_w_idTest if component is enabled

Pairs

ecs_make_pairMake a pair identifier

Deleting Entities and components

ecs_clearClear all components
ecs_deleteDelete an entity
ecs_delete_withDelete all entities with the specified id
ecs_remove_allRemove all instances of the specified id

Getting Components

ecs_get_idGet an immutable pointer to a component
ecs_get_ref_idGet an immutable reference to a component
ecs_get_caseGet case for switch

Setting Components

ecs_get_mut_idGet a mutable pointer to a component
ecs_emplace_idEmplace a component
ecs_modified_idSignal that a component has been modified
ecs_set_idSet the value of a component

Entity Metadata

ecs_is_validTest whether an entity is valid
ecs_is_aliveTest whether an entity is alive
ecs_strip_generationRemove generation from entity id.
ecs_get_aliveGet alive identifier
ecs_ensureEnsure id is alive
ecs_existsTest whether an entity exists
ecs_get_typeGet the type of an entity.
ecs_get_tableGet the table of an entity.
ecs_get_storage_tableGet the storage table of an entity
ecs_get_typeidGet the typeid of an entity.
ecs_get_nameGet the name of an entity
ecs_get_symbolGet the symbol of an entity
ecs_set_nameSet the name of an entity
ecs_set_symbolSet the symbol of an entity
ecs_role_strConvert role to string
ecs_id_strConvert id to string
ecs_id_str_bufWrite id string to buffer
ecs_type_strConvert type to string
ecs_has_idTest if an entity has an entity
ecs_get_objectGet the object of a relation
ecs_get_object_for_idGet the object of a relation for a given id
ecs_enableEnable or disable an entity
ecs_count_idCount entities that have the specified id

Lookups

ecs_lookupLookup an entity by name
ecs_lookup_childLookup a child entity by name
ecs_lookup_path_w_sepLookup an entity from a path
ecs_lookup_symbolLookup an entity by its symbol name
ecs_use

Paths

ecs_get_path_w_sepGet a path identifier for an entity
ecs_get_path_w_sep_bufWrite path identifier to buffer
ecs_new_from_path_w_sepFind or create entity from path
ecs_add_path_w_sepAdd specified path to entity

Scopes

ecs_set_scopeSet the current scope
ecs_get_scopeGet the current scope
ecs_set_withSet current with id
ecs_get_withGet current with id
ecs_set_name_prefixSet a name prefix for newly created entities

Terms

ecs_term_iterIterator for a single (component) id
ecs_term_chain_iterReturn a chained term iterator
ecs_term_nextProgress the term iterator
ecs_term_id_is_setTest whether term id is set.
ecs_term_is_initializedTest whether a term is set
ecs_term_is_trivialTest whether a term is a trivial term
ecs_term_finalizeFinalize term
ecs_term_copyCopy resources of a term to another term
ecs_term_moveMove resources of a term to another term
ecs_term_finiFree resources of term
ecs_id_matchUtility to match an id with a pattern
ecs_id_is_pairUtility to check if id is a pair.
ecs_id_is_wildcardUtility to check if id is a wildcard.

Filters

ecs_filter_initInitialize filter A filter is a lightweight object that can be used to query for entities in a world
ecs_filter_finiDeinitialize filter
ecs_filter_finalizeFinalize filter
ecs_term_strConvert ter, to string expression
ecs_filter_strConvert filter to string expression
ecs_filter_iterReturn a filter iterator
ecs_filter_chain_iterReturn a chained filter iterator
ecs_filter_nextIterate tables matched by filter
ecs_filter_next_instancedSame as ecs_filter_next, but always instanced
ecs_filter_moveMove resources of one filter to another.
ecs_filter_copyCopy resources of one filter to another.

Queries

ecs_query_initCreate a query
ecs_query_finiDestroy a query
ecs_query_get_filterGet filter object of query
ecs_query_iterReturn a query iterator
ecs_query_nextProgress the query iterator
ecs_query_next_instancedSame as ecs_query_next, but always instanced
ecs_query_changedReturns whether the query data changed since the last iteration
ecs_query_skipSkip a table while iterating
ecs_query_orphanedReturns whether query is orphaned

Iterators

ecs_iter_polyCreate iterator from poly object
ecs_iter_nextProgress any iterator
ecs_iter_finiCleanup iterator resources
ecs_iter_countCount number of matched entities in query
ecs_page_iterCreate a paged iterator
ecs_page_nextProgress a paged iterator
ecs_worker_iterCreate a worker iterator
ecs_worker_nextProgress a worker iterator
ecs_term_w_sizeObtain data for a query term
ecs_term_is_readonlyTest whether the term is readonly This operation returns whether this is a readonly term
ecs_term_is_setTest whether term is set.
ecs_term_is_ownedTest whether the term is owned This operation returns whether the term is owned by the currently iterated entity
ecs_iter_strConvert iterator to string
ecs_iter_find_columnFind the column index for a given id
ecs_iter_column_w_sizeObtain data for a column index
ecs_iter_column_sizeObtain size for a column index

Staging

ecs_frame_beginBegin frame
ecs_frame_endEnd frame
ecs_staging_beginBegin staging
ecs_staging_endEnd staging
ecs_mergeMerge world or stage
ecs_defer_beginDefer operations until end of frame
ecs_is_deferredTest if deferring is enabled for current stage.
ecs_defer_endEnd block of operations to defer
ecs_set_automergeEnable/disable automerging for world or stage
ecs_set_stagesConfigure world to have N stages
ecs_get_stage_countGet number of configured stages
ecs_get_stage_idGet current stage id
ecs_get_stageGet stage-specific world pointer
ecs_get_worldGet actual world from world.
ecs_stage_is_readonlyTest whether the current world object is readonly
ecs_async_stage_newCreate asynchronous stage
ecs_async_stage_freeFree asynchronous stage
ecs_stage_is_asyncTest whether provided stage is asynchronous.

Search functions for component ids.

Low-level functions to search for component ids in table types.

ecs_search_offsetSearch for component id in table type starting from an offset
ecs_search_relationSearch for component/relation id in table type starting from an offset

Public table operations

Low-level table functions. These functions are intended to enable the creation of higher-level operations. It is not recommended to use these operations directly in application code as they do not provide the same safety guarantees as the other APIs.

ecs_table_get_typeGet type for table.
ecs_table_get_storage_tableGet storage type for table.
ecs_table_storage_countGet number of storages for table.
ecs_table_type_to_storage_indexConvert index in table type to index in table storage type.
ecs_table_storage_to_type_indexConvert index in table storage type to index in table type.
ecs_table_countReturns the number of records in the table
ecs_table_add_idGet table that has all components of current table plus the specified id
ecs_table_remove_idGet table that has all components of current table minus the specified id
ecs_table_lockLock or unlock table
ecs_table_unlockUnlock a table
ecs_table_has_moduleReturns whether table is a module or contains module contents Returns true for tables that have module contents
ecs_commitCommit (move) entity to a table
ecs_record_findFind record for entity.
ecs_record_get_columnGet component pointer from column/record.

Macro's that help with creation of ECS objects.

ECS_DECLARE(id)
ecs_entity_t id, ecs_id(id)

ECS_ENTITY_DEFINE(world,id,...)
{
ecs_entity_desc_t desc = {0};
desc.entity = id;
desc.name = #id;
desc.add_expr = #__VA_ARGS__;
id = ecs_entity_init(world, &desc);
ecs_id(id) = id;
}
(void)id;
(void)ecs_id(id);

ECS_ENTITY(world,id,...)
ecs_entity_t ecs_id(id);
ecs_entity_t id = 0;
ECS_ENTITY_DEFINE(world, id, __VA_ARGS__);

Mentioned in:

ECS_TAG_DEFINE(world,id)
ECS_ENTITY_DEFINE(world, id, 0)

ECS_TAG(world,id)
ECS_ENTITY(world, id, 0)

Mentioned in:

ECS_PREFAB_DEFINE(world,id,...)
ECS_ENTITY_DEFINE(world, id, Prefab, __VA_ARGS__)

ECS_PREFAB(world,id,...)
ECS_ENTITY(world, id, Prefab, __VA_ARGS__)

Mentioned in:

ECS_COMPONENT_DECLARE(id)
ecs_entity_t ecs_id(id)

Mentioned in:

ECS_COMPONENT_DEFINE(world,id)
{
ecs_component_desc_t desc = {0};
desc.entity.entity = ecs_id(id);
desc.entity.name = #id;
desc.entity.symbol = #id;
desc.size = sizeof(id);
desc.alignment = ECS_ALIGNOF(id);
ecs_id(id) = ecs_component_init(world, &desc);
ecs_assert(ecs_id(id) != 0, ECS_INVALID_PARAMETER, NULL);
}

Mentioned in:

ECS_COMPONENT(world,id)
ecs_entity_t ecs_id(id) = 0;
ECS_COMPONENT_DEFINE(world, id);
(void)ecs_id(id)

Mentioned in:

ECS_SYSTEM_DECLARE(id)
ecs_entity_t ecs_id(id)

ECS_TRIGGER_DEFINE(world,id,kind,component)
{
ecs_trigger_desc_t desc = {0};
desc.entity.entity = ecs_id(id);
desc.entity.name = #id;
desc.callback = id;
desc.expr = #component;
desc.events[0] = kind;
ecs_id(id) = ecs_trigger_init(world, &desc);
ecs_assert(ecs_id(id) != 0, ECS_INVALID_PARAMETER, NULL);
}

ECS_TRIGGER(world,id,kind,component)
ecs_entity_t ecs_id(id) = 0;
ECS_TRIGGER_DEFINE(world, id, kind, component);
ecs_entity_t id = ecs_id(id);
(void)ecs_id(id);
(void)id;

Mentioned in:

ECS_OBSERVER_DEFINE(world,id,kind,...)
{
ecs_observer_desc_t desc = {0};
desc.entity.entity = ecs_id(id);
desc.entity.name = #id;
desc.callback = id;
desc.filter.expr = #__VA_ARGS__;
desc.events[0] = kind;
ecs_id(id) = ecs_observer_init(world, &desc);
ecs_assert(ecs_id(id) != 0, ECS_INVALID_PARAMETER, NULL);
}

ECS_OBSERVER(world,id,kind,...)
ecs_entity_t ecs_id(id) = 0;
ECS_OBSERVER_DEFINE(world, id, kind, __VA_ARGS__);
ecs_entity_t id = ecs_id(id);
(void)ecs_id(id);
(void)id;

Convenience macro's that wrap ECS operations

ecs_set_component_actions(world,T,...)
ecs_set_component_actions_w_id(world, ecs_id(T), &(EcsComponentLifecycle)__VA_ARGS__)

ecs_new(world,T)
ecs_new_w_id(world, ecs_id(T))

Mentioned in:

ecs_new_w_pair(world,relation,object)
ecs_new_w_id(world, ecs_pair(relation, object))

Mentioned in:

ecs_bulk_new(world,component,count)
ecs_bulk_new_w_id(world, ecs_id(component), count)

ecs_new_entity(world,n)
ecs_entity_init(world, &(ecs_entity_desc_t) {
.name = n,
})

ecs_new_prefab(world,n)
ecs_entity_init(world, &(ecs_entity_desc_t) {
.name = n,
.add = {EcsPrefab}
})

ecs_add(world,entity,T)
ecs_add_id(world, entity, ecs_id(T))

Mentioned in:

ecs_add_pair(world,subject,relation,object)
ecs_add_id(world, subject, ecs_pair(relation, object))

Mentioned in:

ecs_remove(world,entity,T)
ecs_remove_id(world, entity, ecs_id(T))

Mentioned in:

ecs_remove_pair(world,subject,relation,object)
ecs_remove_id(world, subject, ecs_pair(relation, object))

Mentioned in:

ecs_delete_children(world,parent)
ecs_delete_with(world, ecs_pair(EcsChildOf, parent))

ecs_set_ptr(world,entity,component,ptr)
ecs_set_id(world, entity, ecs_id(component), sizeof(component), ptr)

ecs_set(world,entity,component,...)
ecs_set_id(world, entity, ecs_id(component), sizeof(component), &(component)__VA_ARGS__)

Mentioned in:

ecs_set_pair(world,subject,relation,object,...)
ecs_set_id(world, subject,
ecs_pair(ecs_id(relation), object),
sizeof(relation), &(relation)__VA_ARGS__)

Mentioned in:

ecs_set_pair_object(world,subject,relation,object,...)
ecs_set_id(world, subject,
ecs_pair(relation, ecs_id(object)),
sizeof(object), &(object)__VA_ARGS__)

Mentioned in:

ecs_set_override(world,entity,T,...)
ecs_add_id(world, entity, ECS_OVERRIDE | ecs_id(T));
ecs_set(world, entity, T, __VA_ARGS__)

ecs_emplace(world,entity,T)
(ECS_CAST(T*, ecs_emplace_id(world, entity, ecs_id(T))))

ecs_get_ref(world,ref,entity,T)
(ECS_CAST(const T*, ecs_get_ref_id(world, ref, entity, ecs_id(T))))

ecs_get(world,entity,T)
(ECS_CAST(const T*, ecs_get_id(world, entity, ecs_id(T))))

Mentioned in:

ecs_get_pair(world,subject,relation,object)
(ECS_CAST(relation*, ecs_get_id(world, subject,
ecs_pair(ecs_id(relation), object))))

Mentioned in:

ecs_get_pair_object(world,subject,relation,object)
(ECS_CAST(object*, ecs_get_id(world, subject,
ecs_pair(relation, ecs_id(object)))))

Mentioned in:

ecs_get_mut(world,entity,T,is_added)
(ECS_CAST(T*, ecs_get_mut_id(world, entity, ecs_id(T), is_added)))

Mentioned in:

ecs_get_mut_pair(world,subject,relation,object,is_added)
(ECS_CAST(relation*, ecs_get_mut_id(world, subject,
ecs_pair(ecs_id(relation), object), is_added)))

ecs_get_mut_pair_object(world,subject,relation,object,is_added)
(ECS_CAST(object*, ecs_get_mut_id(world, subject,
ecs_pair(relation, ecs_id(object)), is_added)))

ecs_modified(world,entity,component)
ecs_modified_id(world, entity, ecs_id(component))

Mentioned in:

ecs_modified_pair(world,subject,relation,object)
ecs_modified_id(world, subject, ecs_pair(relation, object))

ecs_singleton_add(world,comp)
ecs_add(world, ecs_id(comp), comp)

ecs_singleton_remove(world,comp)
ecs_add(world, ecs_id(comp), comp)

ecs_singleton_get(world,comp)
ecs_get(world, ecs_id(comp), comp)

ecs_singleton_set(world,comp,...)
ecs_set(world, ecs_id(comp), comp, __VA_ARGS__)

ecs_singleton_get_mut(world,comp)
ecs_get_mut(world, ecs_id(comp), comp, NULL)

ecs_singleton_modified(world,comp)
ecs_modified(world, ecs_id(comp), comp)

ecs_has(world,entity,T)
ecs_has_id(world, entity, ecs_id(T))

Mentioned in:

ecs_has_pair(world,entity,relation,object)
ecs_has_id(world, entity, ecs_pair(relation, object))

Mentioned in:

ecs_owns_id(world,entity,id)
(ecs_search(world, ecs_get_table(world, entity), id, 0) != -1)

ecs_owns_pair(world,entity,relation,object)
ecs_owns_id(world, entity, ecs_pair(relation, object))

ecs_owns(world,entity,T)
ecs_owns_id(world, entity, ecs_id(T))

ecs_shares_id(world,entity,id)
(ecs_search_relation(world, ecs_get_table(world, entity), 0, ecs_id(id),
EcsIsA, 1, 0, 0, 0, 0) != -1)

ecs_shares_pair(world,entity,relation,object)
(ecs_shares_id(world, entity, ecs_pair(relation, object)))

ecs_shares(world,entity,T)
(ecs_shares_id(world, entity, ecs_id(T)))

ecs_enable_component(world,entity,T,enable)
ecs_enable_component_w_id(world, entity, ecs_id(T), enable)

Mentioned in:

ecs_is_component_enabled(world,entity,T)
ecs_is_component_enabled_w_id(world, entity, ecs_id(T))

Mentioned in:

ecs_count(world,type)
ecs_count_id(world, ecs_id(type))

ecs_lookup_path(world,parent,path)
ecs_lookup_path_w_sep(world, parent, path, ".", NULL, true)

Mentioned in:

ecs_lookup_fullpath(world,path)
ecs_lookup_path_w_sep(world, 0, path, ".", NULL, true)

Mentioned in:

ecs_get_path(world,parent,child)
ecs_get_path_w_sep(world, parent, child, ".", NULL)

Mentioned in:

ecs_get_fullpath(world,child)
ecs_get_path_w_sep(world, 0, child, ".", NULL)

Mentioned in:

ecs_get_fullpath_buf(world,child,buf)
ecs_get_path_w_sep_buf(world, 0, child, ".", NULL, buf)

ecs_new_from_path(world,parent,path)
ecs_new_from_path_w_sep(world, parent, path, ".", NULL)

ecs_new_from_fullpath(world,path)
ecs_new_from_path_w_sep(world, 0, path, ".", NULL)

ecs_add_path(world,entity,parent,path)
ecs_add_path_w_sep(world, entity, parent, path, ".", NULL)

ecs_add_fullpath(world,entity,path)
ecs_add_path_w_sep(world, entity, 0, path, ".", NULL)

ecs_query_table_count(query)
ecs_vector_count(query->cache.tables)

ecs_query_empty_table_count(query)
ecs_vector_count(query->cache.empty_tables)

ecs_term_id(it,index)
((it)->ids[(index) - 1])

Mentioned in:

ecs_term_source(it,index)
((it)->subjects ? (it)->subjects[(index) - 1] : 0)

ecs_term_size(it,index)
((index) == 0 ? sizeof(ecs_entity_t) : ECS_CAST(size_t, (it)->sizes[(index) - 1]))

ecs_term(it,T,index)
(ECS_CAST(T*, ecs_term_w_size(it, sizeof(T), index)))

Mentioned in:

ecs_iter_column(it,T,index)
(ECS_CAST(T*, ecs_iter_column_w_size(it, sizeof(T), index)))

Utility macro's for commonly used operations

ecs_childof(parent)
ecs_pair(EcsChildOf, parent)

ecs_isa(base)
ecs_pair(EcsIsA, base)

Temp macro's for easing the transition to v3

ECS_CTOR(type,var,...)
ECS_XTOR_IMPL(type, ctor, var, __VA_ARGS__)

Declare a constructor. Example: ECS_CTOR(MyType, ptr, { ptr->value = NULL; });

ECS_DTOR(type,var,...)
ECS_XTOR_IMPL(type, dtor, var, __VA_ARGS__)

Declare a destructor. Example: ECS_DTOR(MyType, ptr, { free(ptr->value); });

ECS_COPY(type,dst_var,src_var,...)
ECS_COPY_IMPL(type, dst_var, src_var, __VA_ARGS__)

Declare a copy action. Example: ECS_COPY(MyType, dst, src, { dst->value = strdup(src->value); });

ECS_MOVE(type,dst_var,src_var,...)
ECS_MOVE_IMPL(type, dst_var, src_var, __VA_ARGS__)

Declare a move action. Example: ECS_MOVE(MyType, dst, src, { dst->value = src->value; src->value = 0; });

ECS_ON_SET(type,ptr,...)
ECS_ON_SET_IMPL(type, ptr, __VA_ARGS__)

Declare an on_set action. Example: ECS_ON_SET(MyType, ptr, { printf("%d
n", ptr->value); });

ecs_ctor(type)
type##_ctor

ecs_dtor(type)
type##_dtor

ecs_copy(type)
type##_copy

ecs_move(type)
type##_move

ecs_on_set(type)
type##_on_set

ecs_query_new(world,q_expr)
ecs_query_init(world, &(ecs_query_desc_t){
.filter.expr = q_expr
})

Mentioned in:

ecs_rule_new(world,q_expr)
ecs_rule_init(world, &(ecs_filter_desc_t){
.expr = q_expr
})

ECS_TYPE(world,id,...)
ecs_entity_t id = ecs_type_init(world, &(ecs_type_desc_t){
.entity.name = #id,
.ids_expr = #__VA_ARGS__
});
ecs_assert(id != 0, ECS_INVALID_PARAMETER, NULL);
(void)id;

Mentioned in:

Other Types

FLECS_API const ecs_id_t ECS_CASE

Cases are used to switch between mutually exclusive components

Mentioned in:

Manual / Type role

Manual / Type roles

Manual / Switchable tags

FLECS_API const ecs_id_t ECS_SWITCH

Switches allow for fast switching between mutually exclusive components

Mentioned in:

Manual / Type role

Manual / Type roles

Manual / Switchable tags

FLECS_API const ecs_id_t ECS_PAIR

The PAIR role indicates that the entity is a pair identifier.

FLECS_API const ecs_id_t ECS_OVERRIDE

Enforce ownership of a component

Mentioned in:

Manual / Type roles

Manual / Automatic overriding

FLECS_API const ecs_id_t ECS_DISABLED

Track whether component is enabled or not

FLECS_API const ecs_entity_t EcsFlecs

Root scope for builtin flecs entities

FLECS_API const ecs_entity_t EcsFlecsCore

FLECS_API const ecs_entity_t EcsFlecsHidden

FLECS_API const ecs_entity_t EcsWorld

Mentioned in:

FLECS_API const ecs_entity_t EcsWildcard

Mentioned in:

FLECS_API const ecs_entity_t EcsAny

FLECS_API const ecs_entity_t EcsThis

Mentioned in:

FLECS_API const ecs_entity_t EcsTransitive

FLECS_API const ecs_entity_t EcsReflexive

FLECS_API const ecs_entity_t EcsFinal

Mentioned in:

FLECS_API const ecs_entity_t EcsSymmetric

Mentioned in:

FLECS_API const ecs_entity_t EcsExclusive

FLECS_API const ecs_entity_t EcsAcyclic

FLECS_API const ecs_entity_t EcsWith

Mentioned in:

FLECS_API const ecs_entity_t EcsTag

Mentioned in:

FLECS_API const ecs_entity_t EcsName

Mentioned in:

FLECS_API const ecs_entity_t EcsSymbol

FLECS_API const ecs_entity_t EcsChildOf

Mentioned in:

FLECS_API const ecs_entity_t EcsIsA

Mentioned in:

FLECS_API const ecs_entity_t EcsModule

FLECS_API const ecs_entity_t EcsPrefab

Mentioned in:

FLECS_API const ecs_entity_t EcsDisabled

FLECS_API const ecs_entity_t EcsOnAdd

Mentioned in:

FLECS_API const ecs_entity_t EcsOnRemove

FLECS_API const ecs_entity_t EcsOnSet

Mentioned in:

FLECS_API const ecs_entity_t EcsUnSet

FLECS_API const ecs_entity_t EcsMonitor

FLECS_API const ecs_entity_t EcsOnDelete

Mentioned in:

FLECS_API const ecs_entity_t EcsOnTableEmpty

FLECS_API const ecs_entity_t EcsOnTableFill

FLECS_API const ecs_entity_t EcsOnDeleteObject

Mentioned in:

FLECS_API const ecs_entity_t EcsRemove

Mentioned in:

FLECS_API const ecs_entity_t EcsDelete

Mentioned in:

FLECS_API const ecs_entity_t EcsThrow

Mentioned in:

FLECS_API const ecs_entity_t EcsDefaultChildComponent

FLECS_API const ecs_entity_t EcsInactive

FLECS_API const ecs_entity_t EcsPipeline

FLECS_API const ecs_entity_t EcsPreFrame

FLECS_API const ecs_entity_t EcsOnLoad

Mentioned in:

FLECS_API const ecs_entity_t EcsPostLoad

Mentioned in:

FLECS_API const ecs_entity_t EcsPreUpdate

Mentioned in:

FLECS_API const ecs_entity_t EcsOnUpdate

Mentioned in:

FLECS_API const ecs_entity_t EcsOnValidate

Mentioned in:

FLECS_API const ecs_entity_t EcsPostUpdate

Mentioned in:

FLECS_API const ecs_entity_t EcsPreStore

Mentioned in:

FLECS_API const ecs_entity_t EcsOnStore

Mentioned in:

FLECS_API const ecs_entity_t EcsPostFrame

ecs_trigger_initCreate trigger
ecs_get_trigger_ctxGet trigger context
ecs_get_trigger_binding_ctxSame as ecs_get_trigger_ctx, but for binding ctx
ecs_event_desc_t
ecs_emitSend event
ecs_observer_initCreate observer
ecs_get_observer_ctx
ecs_get_observer_binding_ctx