34#define FLECS_VERSION_MAJOR 4
35#define FLECS_VERSION_MINOR 0
36#define FLECS_VERSION_PATCH 2
39#define FLECS_VERSION FLECS_VERSION_IMPL(\
40 FLECS_VERSION_MAJOR, FLECS_VERSION_MINOR, FLECS_VERSION_PATCH)
45#ifdef FLECS_CONFIG_HEADER
46#include "flecs_config.h"
52#define ecs_float_t float
59#define ecs_ftime_t ecs_float_t
82#if defined(FLECS_DEBUG) && defined(FLECS_NDEBUG)
83#error "invalid configuration: cannot both define FLECS_DEBUG and FLECS_NDEBUG"
85#if defined(FLECS_DEBUG) && defined(NDEBUG)
86#error "invalid configuration: cannot both define FLECS_DEBUG and NDEBUG"
93#if !defined(FLECS_DEBUG) && !defined(FLECS_NDEBUG)
186#ifndef FLECS_CUSTOM_BUILD
195#define FLECS_PIPELINE
203#define FLECS_OS_API_IMPL
214#ifdef FLECS_LOW_FOOTPRINT
215#define FLECS_HI_COMPONENT_ID (16)
216#define FLECS_HI_ID_RECORD_ID (16)
217#define FLECS_SPARSE_PAGE_BITS (6)
218#define FLECS_ENTITY_PAGE_BITS (6)
219#define FLECS_USE_OS_ALLOC
232#ifndef FLECS_HI_COMPONENT_ID
233#define FLECS_HI_COMPONENT_ID (256)
242#ifndef FLECS_HI_ID_RECORD_ID
243#define FLECS_HI_ID_RECORD_ID (1024)
251#ifndef FLECS_SPARSE_PAGE_BITS
252#define FLECS_SPARSE_PAGE_BITS (12)
257#ifndef FLECS_ENTITY_PAGE_BITS
258#define FLECS_ENTITY_PAGE_BITS (12)
269#ifndef FLECS_ID_DESC_MAX
270#define FLECS_ID_DESC_MAX (32)
275#ifndef FLECS_EVENT_DESC_MAX
276#define FLECS_EVENT_DESC_MAX (8)
281#define FLECS_VARIABLE_COUNT_MAX (64)
285#ifndef FLECS_TERM_COUNT_MAX
286#define FLECS_TERM_COUNT_MAX 32
291#ifndef FLECS_TERM_ARG_COUNT_MAX
292#define FLECS_TERM_ARG_COUNT_MAX (16)
297#ifndef FLECS_QUERY_VARIABLE_COUNT_MAX
298#define FLECS_QUERY_VARIABLE_COUNT_MAX (64)
303#ifndef FLECS_QUERY_SCOPE_NESTING_MAX
304#define FLECS_QUERY_SCOPE_NESTING_MAX (8)
309#include "flecs/private/api_defines.h"
310#include "flecs/datastructures/vec.h"
311#include "flecs/datastructures/sparse.h"
312#include "flecs/datastructures/block_allocator.h"
313#include "flecs/datastructures/stack_allocator.h"
314#include "flecs/datastructures/map.h"
315#include "flecs/datastructures/switch_list.h"
316#include "flecs/datastructures/allocator.h"
317#include "flecs/datastructures/strbuf.h"
594typedef void* (*ecs_group_create_action_t)(
696#define EcsSelf (1llu << 63)
702#define EcsUp (1llu << 62)
708#define EcsTrav (1llu << 61)
714#define EcsCascade (1llu << 60)
720#define EcsDesc (1llu << 59)
726#define EcsIsVariable (1llu << 58)
732#define EcsIsEntity (1llu << 57)
738#define EcsIsName (1llu << 56)
744#define EcsTraverseFlags (EcsSelf|EcsUp|EcsTrav|EcsCascade|EcsDesc)
750#define EcsTermRefFlags (EcsTraverseFlags|EcsIsVariable|EcsIsEntity|EcsIsName)
924#include "flecs/private/api_types.h"
925#include "flecs/private/api_support.h"
926#include "flecs/datastructures/hashmap.h"
1131#define EcsQueryMatchPrefab (1u << 1u)
1137#define EcsQueryMatchDisabled (1u << 2u)
1143#define EcsQueryMatchEmptyTables (1u << 3u)
1149#define EcsQueryAllowUnresolvedByName (1u << 6u)
1155#define EcsQueryTableOnly (1u << 7u)
1291 ecs_flags32_t flags_;
1473#ifdef FLECS_DEPRECATED
1564#define EcsSingleton EcsVariable
1824#define EcsLastInternalComponentId (ecs_id(EcsPoly))
1828#define EcsFirstUserComponentId (8)
1832#define EcsFirstUserEntityId (FLECS_HI_COMPONENT_ID + 128)
2105 ecs_flags32_t flags);
2186 bool multi_threaded);
2469 int32_t entity_count);
2532 ecs_flags32_t flags);
2571 uint16_t clear_generation,
2572 uint16_t delete_generation,
2573 int32_t min_id_count,
2574 double time_budget_seconds);
2615#define flecs_poly_is(object, type)\
2616 flecs_poly_is_(object, type##_magic)
3823 const char *symbol);
3934 bool lookup_as_path,
3964 const char *prefix);
4007 const char *prefix);
4030 const char *prefix);
4073 const char *prefix);
4760 ecs_table_range_t *range,
5197 const ecs_table_range_t *range);
5831 ecs_flags32_t flags);
5995 ecs_flags64_t flags,
6211#include "flecs/private/addons.h"
The deprecated addon contains deprecated operations.
Extends the core API with convenience macros for C applications.
ecs_entity_t ecs_set_with(ecs_world_t *world, ecs_id_t id)
Set current with id.
void ecs_add_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Add a (component) id to an entity.
void ecs_remove_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Remove a (component) id from an entity.
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.
void ecs_remove_all(ecs_world_t *world, ecs_id_t id)
Remove all instances of the specified (component) id.
void ecs_auto_override_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Add auto override for (component) id.
struct ecs_value_t ecs_value_t
Utility to hold a value of a dynamic type.
struct EcsIdentifier EcsIdentifier
A (string) identifier.
struct EcsPoly EcsPoly
Component for storing a poly object.
struct EcsDefaultChildComponent EcsDefaultChildComponent
When added to an entity this informs serialization formats which component to use when a value is ass...
struct EcsComponent EcsComponent
Component information.
FLECS_API const ecs_entity_t ecs_id(EcsDocDescription)
Component id for EcsDocDescription.
ecs_world_t * ecs_stage_new(ecs_world_t *world)
Create unmanaged stage.
bool ecs_defer_end(ecs_world_t *world)
End block of operations to defer.
bool ecs_readonly_begin(ecs_world_t *world, bool multi_threaded)
Begin readonly mode.
void ecs_defer_resume(ecs_world_t *world)
Resume deferring.
bool ecs_defer_begin(ecs_world_t *world)
Defer operations until end of frame.
void ecs_defer_suspend(ecs_world_t *world)
Suspend deferring but do not flush queue.
bool ecs_is_deferred(const ecs_world_t *world)
Test if deferring is enabled for current stage.
void ecs_stage_free(ecs_world_t *stage)
Free unmanaged stage.
void ecs_merge(ecs_world_t *world)
Merge world or stage.
int32_t ecs_stage_get_id(const ecs_world_t *world)
Get stage id.
bool ecs_stage_is_readonly(const ecs_world_t *world)
Test whether the current world is readonly.
int32_t ecs_get_stage_count(const ecs_world_t *world)
Get number of configured stages.
ecs_world_t * ecs_get_stage(const ecs_world_t *world, int32_t stage_id)
Get stage-specific world pointer.
void ecs_set_stage_count(ecs_world_t *world, int32_t stages)
Configure world to have N stages.
void ecs_readonly_end(ecs_world_t *world)
End readonly mode.
ecs_entity_t ecs_component_init(ecs_world_t *world, const ecs_component_desc_t *desc)
Find or create a component.
void ecs_set_hooks_id(ecs_world_t *world, ecs_entity_t id, const ecs_type_hooks_t *hooks)
Register hooks for component.
struct ecs_component_desc_t ecs_component_desc_t
Used with ecs_component_init().
const ecs_type_info_t * ecs_get_type_info(const ecs_world_t *world, ecs_id_t id)
Get the type for an id.
const ecs_type_hooks_t * ecs_get_hooks_id(const ecs_world_t *world, ecs_entity_t id)
Get hooks for component.
struct ecs_header_t ecs_header_t
Header for ecs_poly_t objects.
struct ecs_stage_t ecs_stage_t
A stage enables modification while iterating and from multiple threads.
struct ecs_ref_t ecs_ref_t
A ref is a fast way to fetch a component for a specific entity.
ecs_id_t ecs_entity_t
An entity identifier.
struct ecs_table_record_t ecs_table_record_t
Metadata describing where a component id is stored in a table.
struct ecs_id_record_t ecs_id_record_t
Information about a (component) id, such as type info and tables with the id.
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
struct ecs_mixins_t ecs_mixins_t
Type that stores poly mixins.
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
struct ecs_observable_t ecs_observable_t
An observable produces events that can be listened for by an observer.
struct ecs_table_t ecs_table_t
A table stores entities and components for a specific type.
void ecs_poly_t
A poly object.
struct ecs_table_cache_hdr_t ecs_table_cache_hdr_t
Header for table cache elements.
ecs_entity_t ecs_new_low_id(ecs_world_t *world)
Create new low id.
ecs_entity_t ecs_new_w_id(ecs_world_t *world, ecs_id_t id)
Create new entity with (component) id.
const ecs_entity_t * ecs_bulk_init(ecs_world_t *world, const ecs_bulk_desc_t *desc)
Bulk create/populate new entities.
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.
const ecs_entity_t * ecs_bulk_new_w_id(ecs_world_t *world, ecs_id_t id, int32_t count)
Create N new entities.
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_with(ecs_world_t *world, ecs_id_t id)
Delete all entities with the specified id.
void ecs_delete(ecs_world_t *world, ecs_entity_t entity)
Delete an entity.
ecs_entity_t ecs_new_w_table(ecs_world_t *world, ecs_table_t *table)
Create new entity in table.
bool ecs_children_next(ecs_iter_t *it)
Progress an iterator created with ecs_children().
bool ecs_each_next(ecs_iter_t *it)
Progress an iterator created with ecs_each_id().
ecs_iter_t ecs_children(const ecs_world_t *world, ecs_entity_t parent)
Iterate children of parent.
ecs_iter_t ecs_each_id(const ecs_world_t *world, ecs_id_t id)
Iterate all entities with specified (component id).
bool ecs_is_enabled_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Test if component is enabled.
void ecs_enable_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id, bool enable)
Enable or disable component.
void ecs_enable(ecs_world_t *world, ecs_entity_t entity, bool enabled)
Enable or disable entity.
struct ecs_bulk_desc_t ecs_bulk_desc_t
Used with ecs_bulk_init().
struct ecs_entity_desc_t ecs_entity_desc_t
Used with ecs_entity_init().
char * ecs_entity_str(const ecs_world_t *world, ecs_entity_t entity)
Convert entity to string.
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 parent (target of ChildOf relationship) for entity.
const ecs_type_t * ecs_get_type(const ecs_world_t *world, ecs_entity_t entity)
Get the type of an entity.
bool ecs_has_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Test if an entity has an id.
char * ecs_type_str(const ecs_world_t *world, const ecs_type_t *type)
Convert type to string.
char * ecs_table_str(const ecs_world_t *world, const ecs_table_t *table)
Convert table to string.
int32_t ecs_count_id(const ecs_world_t *world, ecs_id_t entity)
Count entities that have the specified id.
bool ecs_owns_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Test if an entity owns an id.
int32_t ecs_get_depth(const ecs_world_t *world, ecs_entity_t entity, ecs_entity_t rel)
Return depth for entity in tree for the specified relationship.
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.
void(* ecs_module_action_t)(ecs_world_t *world)
Initialization action for modules.
uint64_t(* ecs_group_by_action_t)(ecs_world_t *world, ecs_table_t *table, ecs_id_t group_id, void *ctx)
Callback used for grouping tables in a query.
uint64_t(* ecs_hash_value_action_t)(const void *ptr)
Callback used for hashing values.
void(* ecs_group_delete_action_t)(ecs_world_t *world, uint64_t group_id, void *group_ctx, void *group_by_ctx)
Callback invoked when a query deletes an existing group.
void(* ecs_iter_fini_action_t)(ecs_iter_t *it)
Function prototype for freeing an iterator.
void *(* ecs_group_create_action_t)(ecs_world_t *world, uint64_t group_id, void *group_by_ctx)
Callback invoked when a query creates a new group.
void(* ecs_sort_table_action_t)(ecs_world_t *world, ecs_table_t *table, ecs_entity_t *entities, void *ptr, int32_t size, int32_t lo, int32_t hi, ecs_order_by_action_t order_by)
Callback used for sorting the entire table of components.
bool(* ecs_iter_next_action_t)(ecs_iter_t *it)
Function prototype for iterating an iterator.
void(* ecs_iter_action_t)(ecs_iter_t *it)
Function prototype for iterables.
void(* ecs_copy_t)(void *dst_ptr, const void *src_ptr, int32_t count, const ecs_type_info_t *type_info)
Copy is invoked when a component is copied into another component.
int(* ecs_compare_action_t)(const void *ptr1, const void *ptr2)
Callback used for sorting values.
void(* ecs_fini_action_t)(ecs_world_t *world, void *ctx)
Action callback on world exit.
void(* ecs_move_t)(void *dst_ptr, void *src_ptr, int32_t count, const ecs_type_info_t *type_info)
Move is invoked when a component is moved to another component.
void(* flecs_poly_dtor_t)(ecs_poly_t *poly)
Destructor function for poly objects.
void(* ecs_run_action_t)(ecs_iter_t *it)
Function prototype for runnables (systems, observers).
void(* ecs_ctx_free_t)(void *ctx)
Function to cleanup context data.
int(* ecs_order_by_action_t)(ecs_entity_t e1, const void *ptr1, ecs_entity_t e2, const void *ptr2)
Callback used for comparing components.
void(* ecs_xtor_t)(void *ptr, int32_t count, const ecs_type_info_t *type_info)
Constructor/destructor callback.
void * ecs_get_mut_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Get a mutable pointer to a component.
ecs_ref_t ecs_ref_init_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Create a component ref.
ecs_entity_t ecs_record_get_entity(const ecs_record_t *record)
Get entity corresponding with record.
void ecs_ref_update(const ecs_world_t *world, ecs_ref_t *ref)
Update ref.
const void * ecs_record_get_id(const ecs_world_t *world, const ecs_record_t *record, ecs_id_t id)
Get component from entity record.
void * ecs_record_get_by_column(const ecs_record_t *record, int32_t column, size_t size)
Get component pointer from column/record.
void ecs_read_end(const ecs_record_t *record)
End read access to entity.
void * ecs_emplace_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id, bool *is_new)
Emplace a component.
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_write_end(ecs_record_t *record)
End exclusive write access to entity.
void ecs_set_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id, size_t size, const void *ptr)
Set the value of a component.
void * ecs_ensure_modified_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Combines ensure + modified in single operation.
void * ecs_ref_get_id(const ecs_world_t *world, ecs_ref_t *ref, ecs_id_t id)
Get component from ref.
bool ecs_record_has_id(ecs_world_t *world, const ecs_record_t *record, ecs_id_t id)
Test if entity for record has a (component) id.
void * ecs_record_ensure_id(ecs_world_t *world, ecs_record_t *record, ecs_id_t id)
Same as ecs_record_get_id(), but returns a mutable pointer.
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_write_begin(ecs_world_t *world, ecs_entity_t entity)
Begin exclusive write access to entity.
void ecs_modified_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Signal that a component has been modified.
ecs_record_t * ecs_record_find(const ecs_world_t *world, ecs_entity_t entity)
Find record for entity.
const ecs_record_t * ecs_read_begin(ecs_world_t *world, ecs_entity_t entity)
Begin read access to entity.
const ecs_id_t ECS_PAIR
Indicates that the id is a pair.
const ecs_id_t ECS_AUTO_OVERRIDE
Automatically override component when it is inherited.
const ecs_id_t ECS_TOGGLE
Adds bitset to storage which allows component to be enabled/disabled.
bool ecs_id_is_valid(const ecs_world_t *world, ecs_id_t id)
Utility to check if id is valid.
bool ecs_id_is_pair(ecs_id_t id)
Utility to check if id is a pair.
ecs_entity_t ecs_get_typeid(const ecs_world_t *world, ecs_id_t id)
Get the type for an id.
bool ecs_id_match(ecs_id_t id, ecs_id_t pattern)
Utility to match an id with a pattern.
const char * ecs_id_flag_str(ecs_id_t id_flags)
Convert id flag to string.
bool ecs_id_in_use(const ecs_world_t *world, ecs_id_t id)
Returns whether specified id is in use.
bool ecs_id_is_tag(const ecs_world_t *world, ecs_id_t id)
Returns whether specified id a tag.
void ecs_id_str_buf(const ecs_world_t *world, ecs_id_t id, ecs_strbuf_t *buf)
Write (component) id string to buffer.
char * ecs_id_str(const ecs_world_t *world, ecs_id_t id)
Convert (component) id to string.
bool ecs_id_is_wildcard(ecs_id_t id)
Utility to check if id is a wildcard.
ecs_id_t ecs_id_from_str(const ecs_world_t *world, const char *expr)
Convert string to a (component) id.
ecs_flags32_t ecs_id_get_flags(const ecs_world_t *world, ecs_id_t id)
Get flags associated with id.
ecs_entity_t ecs_field_src(const ecs_iter_t *it, int8_t index)
Return field source.
bool ecs_iter_changed(ecs_iter_t *it)
Returns whether current iterator result has changed.
bool ecs_field_is_writeonly(const ecs_iter_t *it, int8_t index)
Test whether the field is writeonly.
bool ecs_field_is_readonly(const ecs_iter_t *it, int8_t index)
Test whether the field is readonly.
ecs_iter_t ecs_worker_iter(const ecs_iter_t *it, int32_t index, int32_t count)
Create a worker iterator.
bool ecs_iter_is_true(ecs_iter_t *it)
Test if iterator is true.
void ecs_iter_fini(ecs_iter_t *it)
Cleanup iterator resources.
char * ecs_iter_str(const ecs_iter_t *it)
Convert iterator to string.
bool ecs_iter_var_is_constrained(ecs_iter_t *it, int32_t var_id)
Returns whether variable is constrained.
ecs_iter_t ecs_page_iter(const ecs_iter_t *it, int32_t offset, int32_t limit)
Create a paged iterator.
void * ecs_field_at_w_size(const ecs_iter_t *it, size_t size, int8_t index, int32_t row)
Get data for field at specified row.
ecs_id_t ecs_field_id(const ecs_iter_t *it, int8_t index)
Return id matched for field.
bool ecs_field_is_set(const ecs_iter_t *it, int8_t index)
Test whether field is set.
void ecs_iter_set_var(ecs_iter_t *it, int32_t var_id, ecs_entity_t entity)
Set value for iterator variable.
bool ecs_field_is_self(const ecs_iter_t *it, int8_t index)
Test whether the field is matched on self.
bool ecs_iter_next(ecs_iter_t *it)
Progress any iterator.
ecs_entity_t ecs_iter_get_var(ecs_iter_t *it, int32_t var_id)
Get value of iterator variable as entity.
bool ecs_worker_next(ecs_iter_t *it)
Progress a worker iterator.
ecs_entity_t ecs_iter_first(ecs_iter_t *it)
Get first matching entity from iterator.
int32_t ecs_field_column(const ecs_iter_t *it, int8_t index)
Return index of matched table column.
void ecs_iter_set_var_as_table(ecs_iter_t *it, int32_t var_id, const ecs_table_t *table)
Same as ecs_iter_set_var(), but for a table.
ecs_table_t * ecs_iter_get_var_as_table(ecs_iter_t *it, int32_t var_id)
Get value of iterator variable as table.
void * ecs_field_w_size(const ecs_iter_t *it, size_t size, int8_t index)
Get data for field.
int32_t ecs_iter_count(ecs_iter_t *it)
Count number of matched entities in query.
bool ecs_page_next(ecs_iter_t *it)
Progress a paged iterator.
void ecs_iter_set_var_as_range(ecs_iter_t *it, int32_t var_id, const ecs_table_range_t *range)
Same as ecs_iter_set_var(), but for a range of entities This constrains the variable to a range of en...
size_t ecs_field_size(const ecs_iter_t *it, int8_t index)
Return field type size.
ecs_table_range_t ecs_iter_get_var_as_range(ecs_iter_t *it, int32_t var_id)
Get value of iterator variable as table range.
ecs_id_t ecs_strip_generation(ecs_entity_t e)
Remove generation from entity id.
bool ecs_is_valid(const ecs_world_t *world, ecs_entity_t e)
Test whether an entity is valid.
void ecs_make_alive(ecs_world_t *world, ecs_entity_t entity)
Ensure id is alive.
void ecs_make_alive_id(ecs_world_t *world, ecs_id_t id)
Same as ecs_make_alive(), but for (component) ids.
ecs_entity_t ecs_get_alive(const ecs_world_t *world, ecs_entity_t e)
Get alive identifier.
bool ecs_exists(const ecs_world_t *world, ecs_entity_t entity)
Test whether an entity exists.
bool ecs_is_alive(const ecs_world_t *world, ecs_entity_t e)
Test whether an entity is alive.
void ecs_set_version(ecs_world_t *world, ecs_entity_t entity)
Override the generation of an entity.
struct ecs_world_info_t ecs_world_info_t
Type that contains information about the world.
struct ecs_query_group_info_t ecs_query_group_info_t
Type that contains information about a query group.
struct ecs_build_info_t ecs_build_info_t
Type with information about the current Flecs build.
void ecs_emit(ecs_world_t *world, ecs_event_desc_t *desc)
Send event.
void ecs_enqueue(ecs_world_t *world, ecs_event_desc_t *desc)
Enqueue event.
ecs_entity_t ecs_observer_init(ecs_world_t *world, const ecs_observer_desc_t *desc)
Create observer.
const ecs_observer_t * ecs_observer_get(const ecs_world_t *world, ecs_entity_t observer)
Get observer object.
struct ecs_event_desc_t ecs_event_desc_t
Used with ecs_emit().
struct ecs_observer_desc_t ecs_observer_desc_t
Used with ecs_observer_init().
#define FLECS_EVENT_DESC_MAX
Maximum number of events in ecs_observer_desc_t.
#define ecs_ftime_t
Customizable precision for scalar time values.
#define FLECS_ID_DESC_MAX
Maximum number of ids to add ecs_entity_desc_t / ecs_bulk_desc_t.
#define FLECS_TERM_COUNT_MAX
Maximum number of terms in queries.
char * ecs_get_path_w_sep(const ecs_world_t *world, ecs_entity_t parent, ecs_entity_t child, const char *sep, const char *prefix)
Get a path identifier for an entity.
ecs_entity_t ecs_new_from_path_w_sep(ecs_world_t *world, ecs_entity_t parent, const char *path, const char *sep, const char *prefix)
Find or create entity from path.
ecs_entity_t ecs_lookup_symbol(const ecs_world_t *world, const char *symbol, bool lookup_as_path, bool recursive)
Lookup an entity by its symbol name.
void ecs_set_alias(ecs_world_t *world, ecs_entity_t entity, const char *alias)
Set alias for entity.
ecs_entity_t ecs_lookup(const ecs_world_t *world, const char *path)
Lookup an entity by it's path.
void ecs_get_path_w_sep_buf(const ecs_world_t *world, ecs_entity_t parent, ecs_entity_t child, const char *sep, const char *prefix, ecs_strbuf_t *buf)
Write path identifier to buffer.
ecs_entity_t ecs_get_scope(const ecs_world_t *world)
Get the current scope.
ecs_entity_t * ecs_set_lookup_path(ecs_world_t *world, const ecs_entity_t *lookup_path)
Set search path for lookup operations.
ecs_entity_t ecs_set_name(ecs_world_t *world, ecs_entity_t entity, const char *name)
Set the name of an entity.
const char * ecs_get_symbol(const ecs_world_t *world, ecs_entity_t entity)
Get the symbol 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)
Lookup an entity from a path.
ecs_entity_t ecs_set_symbol(ecs_world_t *world, ecs_entity_t entity, const char *symbol)
Set the symbol of an entity.
ecs_entity_t ecs_lookup_child(const ecs_world_t *world, ecs_entity_t parent, const char *name)
Lookup a child entity by name.
const char * ecs_get_name(const ecs_world_t *world, ecs_entity_t entity)
Get the name of an entity.
ecs_entity_t ecs_add_path_w_sep(ecs_world_t *world, ecs_entity_t entity, ecs_entity_t parent, const char *path, const char *sep, const char *prefix)
Add specified path to entity.
ecs_entity_t * ecs_get_lookup_path(const ecs_world_t *world)
Get current lookup path.
ecs_entity_t ecs_set_scope(ecs_world_t *world, ecs_entity_t scope)
Set the current scope.
const char * ecs_set_name_prefix(ecs_world_t *world, const char *prefix)
Set a name prefix for newly created entities.
void ecs_iter_skip(ecs_iter_t *it)
Skip a table while iterating.
void ecs_iter_set_group(ecs_iter_t *it, uint64_t group_id)
Set group to iterate for query iterator.
bool ecs_query_next(ecs_iter_t *it)
Progress query iterator.
const ecs_query_group_info_t * ecs_query_get_group_info(const ecs_query_t *query, uint64_t group_id)
Get information about query group.
bool ecs_query_has(ecs_query_t *query, ecs_entity_t entity, ecs_iter_t *it)
Match entity with query.
bool ecs_query_is_true(const ecs_query_t *query)
Does query return one or more results.
char * ecs_term_str(const ecs_world_t *world, const ecs_term_t *term)
Convert term to string expression.
int32_t ecs_query_find_var(const ecs_query_t *query, const char *name)
Find variable index.
void ecs_query_fini(ecs_query_t *query)
Delete a query.
char * ecs_query_plan_w_profile(const ecs_query_t *query, const ecs_iter_t *it)
Convert query to string with profile.
struct ecs_query_desc_t ecs_query_desc_t
Used with ecs_query_init().
const char * ecs_query_args_parse(ecs_query_t *query, ecs_iter_t *it, const char *expr)
Populate variables from key-value string.
int32_t ecs_query_match_count(const ecs_query_t *query)
Returns how often a match event happened for a cached query.
char * ecs_query_plan(const ecs_query_t *query)
Convert query to a string.
ecs_iter_t ecs_query_iter(const ecs_world_t *world, const ecs_query_t *query)
Create a query iterator.
char * ecs_query_str(const ecs_query_t *query)
Convert query to string expression.
bool ecs_query_var_is_entity(const ecs_query_t *query, int32_t var_id)
Test if variable is an entity.
ecs_query_t * ecs_query_init(ecs_world_t *world, const ecs_query_desc_t *desc)
Create a query.
bool ecs_query_changed(ecs_query_t *query)
Returns whether the query data changed since the last iteration.
bool ecs_query_has_range(ecs_query_t *query, ecs_table_range_t *range, ecs_iter_t *it)
Match range with query.
const char * ecs_query_var_name(const ecs_query_t *query, int32_t var_id)
Get variable name.
bool ecs_term_match_this(const ecs_term_t *term)
Is term matched on $this variable.
bool ecs_query_has_table(ecs_query_t *query, ecs_table_t *table, ecs_iter_t *it)
Match table with query.
void * ecs_query_get_group_ctx(const ecs_query_t *query, uint64_t group_id)
Get context of query group.
ecs_query_count_t ecs_query_count(const ecs_query_t *query)
Returns number of entities and results the query matches with.
bool ecs_term_ref_is_set(const ecs_term_ref_t *id)
Test whether term id is set.
bool ecs_term_is_initialized(const ecs_term_t *term)
Test whether a term is set.
struct ecs_query_count_t ecs_query_count_t
Struct returned by ecs_query_count().
bool ecs_term_match_0(const ecs_term_t *term)
Is term matched on 0 source.
const ecs_query_t * ecs_query_get_cache_query(const ecs_query_t *query)
Get query used to populate cache.
struct ecs_term_ref_t ecs_term_ref_t
Type that describes a reference to an entity or variable in a term.
ecs_query_cache_kind_t
Specify cache policy for query.
ecs_inout_kind_t
Specify read/write access for term.
ecs_oper_kind_t
Specify operator for term.
@ EcsQueryCacheAll
Require that all query terms can be cached.
@ EcsQueryCacheDefault
Behavior determined by query creation context.
@ EcsQueryCacheNone
No caching.
@ EcsQueryCacheAuto
Cache query terms that are cacheable.
@ EcsOut
Term is only written.
@ EcsInOut
Term is both read and written.
@ EcsInOutFilter
Same as InOutNone + prevents term from triggering observers.
@ EcsInOutDefault
InOut for regular terms, In for shared terms.
@ EcsInOutNone
Term is neither read nor written.
@ EcsIn
Term is only read.
@ EcsNot
The term must not match.
@ EcsOptional
The term may match.
@ EcsOr
One of the terms in an or chain must match.
@ EcsOrFrom
Term must match at least one component from term id.
@ EcsAnd
The term must match.
@ EcsNotFrom
Term must match none of the components from term id.
@ EcsAndFrom
Term must match all components from term id.
ecs_table_t * ecs_table_add_id(ecs_world_t *world, ecs_table_t *table, ecs_id_t id)
Get table that has all components of current table plus the specified id.
int32_t ecs_search(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t id, ecs_id_t *id_out)
Search for component id in table type.
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.
int32_t ecs_table_size(const ecs_table_t *table)
Returns allocated size of table.
bool ecs_table_has_flags(ecs_table_t *table, ecs_flags32_t flags)
Test table for flags.
int32_t ecs_table_column_to_type_index(const ecs_table_t *table, int32_t index)
Convert column index to type index.
int32_t ecs_table_column_count(const ecs_table_t *table)
Return number of columns in table.
bool ecs_commit(ecs_world_t *world, ecs_entity_t entity, ecs_record_t *record, ecs_table_t *table, const ecs_type_t *added, const ecs_type_t *removed)
Commit (move) entity to a table.
void * ecs_table_get_column(const ecs_table_t *table, int32_t index, int32_t offset)
Get column from table by column index.
bool ecs_table_has_id(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t id)
Test if table has id.
ecs_table_t * ecs_table_remove_id(ecs_world_t *world, ecs_table_t *table, ecs_id_t id)
Get table that has all components of current table minus the specified id.
int32_t ecs_table_count(const ecs_table_t *table)
Returns the number of entities in the table.
const ecs_entity_t * ecs_table_entities(const ecs_table_t *table)
Returns array with entity ids for table.
void ecs_table_unlock(ecs_world_t *world, ecs_table_t *table)
Unlock a table.
int32_t ecs_table_get_depth(const ecs_world_t *world, const ecs_table_t *table, ecs_entity_t rel)
Return depth for table in tree for relationship rel.
void * ecs_table_get_id(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t id, int32_t offset)
Get column from table by component id.
void ecs_table_swap_rows(ecs_world_t *world, ecs_table_t *table, int32_t row_1, int32_t row_2)
Swaps two elements inside the table.
int32_t ecs_table_get_column_index(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t id)
Get column index for id.
void ecs_table_lock(ecs_world_t *world, ecs_table_t *table)
Lock a table.
ecs_table_t * ecs_table_find(ecs_world_t *world, const ecs_id_t *ids, int32_t id_count)
Find table from id array.
int32_t ecs_table_get_type_index(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t id)
Get type index for id.
size_t ecs_table_get_column_size(const ecs_table_t *table, int32_t index)
Get column size from table.
void ecs_table_clear_entities(ecs_world_t *world, ecs_table_t *table)
Remove all entities in a table.
int32_t ecs_search_relation(const ecs_world_t *world, const ecs_table_t *table, int32_t offset, ecs_id_t id, ecs_entity_t rel, ecs_flags64_t flags, ecs_entity_t *subject_out, ecs_id_t *id_out, struct ecs_table_record_t **tr_out)
Search for component/relationship id in table type starting from an offset.
int32_t ecs_table_type_to_column_index(const ecs_table_t *table, int32_t index)
Convert type index to column index.
int ecs_value_fini_w_type_info(const ecs_world_t *world, const ecs_type_info_t *ti, void *ptr)
Destruct a value.
int ecs_value_fini(const ecs_world_t *world, ecs_entity_t type, void *ptr)
Destruct a value.
int ecs_value_copy(const ecs_world_t *world, ecs_entity_t type, void *dst, const void *src)
Copy value.
int ecs_value_move(const ecs_world_t *world, ecs_entity_t type, void *dst, void *src)
Move value.
int ecs_value_move_w_type_info(const ecs_world_t *world, const ecs_type_info_t *ti, void *dst, void *src)
Move value.
void * ecs_value_new_w_type_info(ecs_world_t *world, const ecs_type_info_t *ti)
Construct a value in new storage.
int ecs_value_move_ctor_w_type_info(const ecs_world_t *world, const ecs_type_info_t *ti, void *dst, void *src)
Move construct value.
int ecs_value_copy_w_type_info(const ecs_world_t *world, const ecs_type_info_t *ti, void *dst, const void *src)
Copy value.
int ecs_value_init_w_type_info(const ecs_world_t *world, const ecs_type_info_t *ti, void *ptr)
Construct a value in existing storage.
void * ecs_value_new(ecs_world_t *world, ecs_entity_t type)
Construct a value in new storage.
int ecs_value_free(ecs_world_t *world, ecs_entity_t type, void *ptr)
Destruct a value, free storage.
int ecs_value_move_ctor(const ecs_world_t *world, ecs_entity_t type, void *dst, void *src)
Move construct value.
int ecs_value_init(const ecs_world_t *world, ecs_entity_t type, void *ptr)
Construct a value in existing storage.
struct ecs_entities_t ecs_entities_t
Type returned by ecs_get_entities().
void ecs_atfini(ecs_world_t *world, ecs_fini_action_t action, void *ctx)
Register action to be executed when world is destroyed.
bool ecs_is_fini(const ecs_world_t *world)
Returns whether the world is being deleted.
int ecs_fini(ecs_world_t *world)
Delete a world.
ecs_flags32_t ecs_world_get_flags(const ecs_world_t *world)
Get flags set on the world.
ecs_world_t * ecs_mini(void)
Create a new world with just the core module.
ecs_world_t * ecs_init(void)
Create a new world.
ecs_world_t * ecs_init_w_args(int argc, char *argv[])
Create a new world with arguments.
ecs_entities_t ecs_get_entities(const ecs_world_t *world)
Return entity identifiers in world.
void ecs_set_target_fps(ecs_world_t *world, float fps)
Set target frames per second (FPS) for application.
void ecs_measure_system_time(ecs_world_t *world, bool enable)
Measure system time.
float ecs_frame_begin(ecs_world_t *world, float delta_time)
Begin frame.
void ecs_run_post_frame(ecs_world_t *world, ecs_fini_action_t action, void *ctx)
Register action to be executed once after frame.
bool ecs_should_quit(const ecs_world_t *world)
Return whether a quit has been requested.
void ecs_set_default_query_flags(ecs_world_t *world, ecs_flags32_t flags)
Set default query flags.
void ecs_quit(ecs_world_t *world)
Signal exit This operation signals that the application should quit.
void ecs_measure_frame_time(ecs_world_t *world, bool enable)
Measure frame time.
void ecs_frame_end(ecs_world_t *world)
End frame.
ecs_entity_t ecs_get_entity(const ecs_poly_t *poly)
Get entity from poly.
ecs_id_t ecs_make_pair(ecs_entity_t first, ecs_entity_t second)
Make a pair id.
const ecs_build_info_t * ecs_get_build_info(void)
Get build info.
bool flecs_poly_is_(const ecs_poly_t *object, int32_t type)
Test if pointer is of specified type.
ecs_entity_t ecs_get_max_id(const ecs_world_t *world)
Get the largest issued entity id (not counting generation).
void ecs_run_aperiodic(ecs_world_t *world, ecs_flags32_t flags)
Force aperiodic actions.
void * ecs_get_binding_ctx(const ecs_world_t *world)
Get the world binding context.
void ecs_dim(ecs_world_t *world, int32_t entity_count)
Dimension the world for a specified number of entities.
void ecs_set_entity_range(ecs_world_t *world, ecs_entity_t id_start, ecs_entity_t id_end)
Set a range for issuing new entity ids.
const ecs_world_info_t * ecs_get_world_info(const ecs_world_t *world)
Get world info.
const ecs_world_t * ecs_get_world(const ecs_poly_t *poly)
Get world from poly.
void ecs_set_ctx(ecs_world_t *world, void *ctx, ecs_ctx_free_t ctx_free)
Set a world context.
int32_t ecs_delete_empty_tables(ecs_world_t *world, ecs_id_t id, uint16_t clear_generation, uint16_t delete_generation, int32_t min_id_count, double time_budget_seconds)
Cleanup empty tables.
void ecs_set_binding_ctx(ecs_world_t *world, void *ctx, ecs_ctx_free_t ctx_free)
Set a world binding context.
bool ecs_enable_range_check(ecs_world_t *world, bool enable)
Enable/disable range limits.
void * ecs_get_ctx(const ecs_world_t *world)
Get the world context.
Operating system abstraction API.
ecs_size_t size
Component size.
ecs_size_t alignment
Component alignment.
When added to an entity this informs serialization formats which component to use when a value is ass...
ecs_id_t component
Default component id.
ecs_size_t length
Length of identifier.
char * value
Identifier string.
ecs_hashmap_t * index
Current index.
uint64_t hash
Hash of current value.
uint64_t index_hash
Hash of existing record in current index.
Component for storing a poly object.
ecs_poly_t * poly
Pointer to poly object.
Apply a rate filter to a tick source.
Component used to provide a tick source to systems.
Component used for one shot/interval timer functionality.
Type with information about the current Flecs build.
int16_t version_major
Major flecs version.
const char ** addons
Addons included in build.
const char * version
Stringified version.
const char * compiler
Compiler used to compile flecs.
bool sanitize
Is this a sanitize build.
bool perf_trace
Is this a perf tracing build.
int16_t version_minor
Minor flecs version.
bool debug
Is this a debug build.
int16_t version_patch
Patch flecs version.
Used with ecs_bulk_init().
void ** data
Array with component data to insert.
ecs_id_t ids[(32)]
Ids to create the entities with.
int32_t count
Number of entities to create/populate.
int32_t _canary
Used for validity testing.
ecs_entity_t * entities
Entities to bulk insert.
ecs_table_t * table
Table to insert the entities into.
Used with ecs_component_init().
int32_t _canary
Used for validity testing.
ecs_type_info_t type
Parameters for type (size, hooks, ...)
ecs_entity_t entity
Existing entity to associate with observer (optional)
Type returned by ecs_get_entities().
int32_t alive_count
Number of alive entity ids.
int32_t count
Total number of entity ids.
const ecs_entity_t * ids
Array with all entity ids in the world.
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.
bool use_low_id
When set to true, a low id (typically reserved for components) will be used to create the entity,...
const char * symbol
Optional entity symbol.
int32_t _canary
Used for validity testing.
const ecs_id_t * add
0-terminated array of ids to add to the entity.
const char * add_expr
String expression with components to add.
const ecs_value_t * set
0-terminated array of values to set on the entity.
ecs_entity_t id
Set to modify existing entity (optional)
ecs_entity_t parent
Parent entity.
ecs_entity_t entity
Single-entity alternative to setting table / offset / count.
const void * const_param
Same as param, but with the guarantee that the value won't be modified.
ecs_table_t * table
The table for which to notify.
int32_t count
Limit number of notified entities to count.
ecs_table_t * other_table
Optional 2nd table to notify.
int32_t offset
Limit notified entities to ones starting from offset (row) in table.
const ecs_type_t * ids
Component ids.
ecs_poly_t * observable
Observable (usually the world)
ecs_entity_t event
The event id.
ecs_flags32_t flags
Event flags.
void * param
Optional context.
ecs_world_t * real_world
Actual world.
void * param
Param passed to ecs_run.
ecs_entity_t event
The event (if applicable)
int32_t frame_offset
Offset relative to start of iteration.
char ** variable_names
Names of variables (if any)
ecs_flags32_t ref_fields
Bitset with fields that aren't component arrays.
int8_t variable_count
Number of variables for query.
ecs_entity_t interrupted_by
When set, system execution is interrupted.
ecs_flags32_t flags
Iterator flags.
ecs_iter_t * chain_it
Optional, allows for creating iterator chains.
void * ctx
System context.
void * run_ctx
Run language binding context.
ecs_table_t * table
Current table.
int32_t offset
Offset relative to current table.
ecs_id_t event_id
The (component) id for the event.
ecs_iter_fini_action_t fini
Function to cleanup iterator resources.
ecs_var_t * variables
Values of variables (if any)
ecs_iter_private_t priv_
Private data.
ecs_world_t * world
The world.
void * callback_ctx
Callback language binding context.
ecs_entity_t * sources
Entity on which the id was matched (0 if same as entities)
void * binding_ctx
System binding context.
ecs_flags32_t row_fields
Fields that must be obtained with field_at.
float delta_system_time
Time elapsed since last system invocation.
const ecs_query_t * query
Query being evaluated.
int8_t term_index
Index of term that emitted an event.
ecs_entity_t system
The system (if applicable)
ecs_flags32_t set_fields
Fields that are set.
const ecs_size_t * sizes
Component sizes.
float delta_time
Time elapsed since last frame.
ecs_flags32_t up_fields
Bitset with fields matched through up traversal.
ecs_iter_action_t callback
Callback of system or observer.
int8_t field_count
Number of fields in iterator.
ecs_table_t * other_table
Prev or next table when adding/removing.
int32_t event_cur
Unique event id.
const ecs_table_record_t ** trs
Info on where to find field in table.
int32_t count
Number of entities to iterate.
uint64_t group_id
Group id for table, if group_by is used.
ecs_iter_next_action_t next
Function to progress iterator.
const ecs_entity_t * entities
Entity identifiers.
ecs_id_t * ids
(Component) ids
ecs_flags64_t constrained_vars
Bitset that marks constrained variables.
Used with ecs_observer_init().
ecs_ctx_free_t run_ctx_free
Callback to free run ctx.
ecs_ctx_free_t ctx_free
Callback to free ctx.
void * run_ctx
Context associated with run (for language bindings).
ecs_entity_t entity
Existing entity to associate with observer (optional)
ecs_entity_t events[(8)]
Events to observe (OnAdd, OnRemove, OnSet)
int32_t * last_event_id
Optional shared last event id for multiple observers.
void * callback_ctx
Context associated with callback (for language bindings).
void * ctx
User context to pass to callback.
ecs_query_desc_t query
Query for observer.
ecs_poly_t * observable
Observable with which to register the observer.
ecs_ctx_free_t callback_ctx_free
Callback to free callback ctx.
int8_t term_index_
Used for internal purposes.
ecs_iter_action_t callback
Callback to invoke on an event, invoked when the observer matches.
bool yield_existing
When observer is created, generate events from existing data.
ecs_run_action_t run
Callback invoked on an event.
int32_t _canary
Used for validity testing.
An observer reacts to events matching a query.
int32_t event_count
Number of events.
ecs_iter_action_t callback
See ecs_observer_desc_t::callback.
ecs_entity_t entity
Entity associated with observer.
ecs_observable_t * observable
Observable for observer.
ecs_run_action_t run
See ecs_observer_desc_t::run.
ecs_header_t hdr
Object header.
ecs_ctx_free_t ctx_free
Callback to free ctx.
void * run_ctx
Run language binding context.
ecs_world_t * world
The world.
ecs_ctx_free_t run_ctx_free
Callback to free run_ctx.
void * callback_ctx
Callback language binding context.
void * ctx
Observer context.
ecs_entity_t events[(8)]
Observer events.
ecs_ctx_free_t callback_ctx_free
Callback to free callback_ctx.
ecs_query_t * query
Observer query.
Struct returned by ecs_query_count().
int32_t empty_tables
Number of empty tables returned by query.
int32_t entities
Number of entities returned by query.
int32_t results
Number of results returned by query.
int32_t tables
Number of tables returned by query.
Used with ecs_query_init().
ecs_ctx_free_t ctx_free
Callback to free ctx.
ecs_id_t group_by
Component id to be used for grouping.
ecs_term_t terms[32]
Query terms.
int32_t _canary
Used for validity testing.
void * ctx
User context to pass to callback.
ecs_ctx_free_t group_by_ctx_free
Function to free group_by_ctx.
void * group_by_ctx
Context to pass to group_by.
void * binding_ctx
Context to be used for language bindings.
ecs_entity_t order_by
Component to sort on, used together with order_by_callback or order_by_table_callback.
ecs_order_by_action_t order_by_callback
Callback used for ordering query results.
ecs_group_create_action_t on_group_create
Callback that is invoked when a new group is created.
ecs_entity_t entity
Entity associated with query (optional)
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
ecs_group_by_action_t group_by_callback
Callback used for grouping results.
ecs_group_delete_action_t on_group_delete
Callback that is invoked when an existing group is deleted.
ecs_sort_table_action_t order_by_table_callback
Callback used for ordering query results.
ecs_flags32_t flags
Flags for enabling query features.
ecs_query_cache_kind_t cache_kind
Caching policy of query.
const char * expr
Query DSL expression (optional)
Type that contains information about a query group.
int32_t table_count
Number of tables in group.
void * ctx
Group context, returned by on_group_create.
int32_t match_count
How often tables have been matched/unmatched.
Queries are lists of constraints (terms) that match entities.
ecs_flags32_t row_fields
Fields that must be acquired with field_at.
ecs_flags32_t data_fields
Fields that have data.
ecs_flags32_t read_fields
Fields that read data.
ecs_header_t hdr
Object header.
ecs_term_t terms[32]
Query terms.
int8_t var_count
Number of query variables.
ecs_flags32_t fixed_fields
Fields with a fixed source.
ecs_flags32_t var_fields
Fields with non-$this variable source.
ecs_flags32_t write_fields
Fields that write data.
int32_t sizes[32]
Component sizes.
int32_t eval_count
Number of times query is evaluated.
ecs_world_t * world
World or stage query was created with.
ecs_flags32_t static_id_fields
Fields with a static (component) id.
ecs_world_t * real_world
Actual world.
ecs_flags32_t set_fields
Fields that will be set.
ecs_entity_t entity
Entity associated with query (optional)
void * ctx
User context to pass to callback.
ecs_flags32_t shared_readonly_fields
Fields that don't write shared data.
ecs_id_t ids[32]
Component ids.
ecs_query_cache_kind_t cache_kind
Caching policy of query.
int8_t term_count
Number of query terms.
char ** vars
Array with variable names for iterator.
int8_t field_count
Number of fields returned by query.
ecs_flags32_t flags
Query flags.
void * binding_ctx
Context to be used for language bindings.
ecs_table_t * table
Identifies a type (and table) in world.
uint32_t row
Table row of the entity.
ecs_id_record_t * idr
Id record to (*, entity) for target entities.
int32_t dense
Index in dense array of entity index.
Header for table cache elements.
bool empty
Whether element is in empty list.
struct ecs_table_cache_hdr_t * next
Next/previous elements for id in table cache.
struct ecs_table_cache_t * cache
Table cache of element.
ecs_table_t * table
Table associated with element.
Metadata describing where a component id is stored in a table.
ecs_table_cache_hdr_t hdr
Table cache header.
int16_t index
First type index where id occurs in table.
int16_t column
First column index where id occurs.
int16_t count
Number of times id occurs in table.
Type that describes a reference to an entity or variable in a term.
ecs_entity_t id
Entity id.
Type that describes a term (single element in a query).
ecs_term_ref_t src
Source of term.
int8_t field_index
Index of field for term in iterator.
ecs_id_t id
Component id to be matched by term.
int16_t oper
Operator of term.
ecs_term_ref_t second
Second element of pair.
ecs_flags16_t flags_
Flags that help eval, set by ecs_query_init()
ecs_entity_t trav
Relationship to traverse when looking for the component.
int16_t inout
Access to contents matched by term.
ecs_term_ref_t first
Component or first element of pair.
Type that contains component lifecycle callbacks.
ecs_copy_t copy_ctor
Ctor + copy.
void * lifecycle_ctx
Component lifecycle context (see meta add-on)
void * ctx
User defined context.
ecs_iter_action_t on_remove
Callback that is invoked when an instance of the component is removed.
void * binding_ctx
Language binding context.
ecs_move_t move_dtor
Move + dtor.
ecs_copy_t copy
copy assignment
ecs_ctx_free_t lifecycle_ctx_free
Callback to free lifecycle_ctx.
ecs_iter_action_t on_set
Callback that is invoked when an instance of the component is set.
ecs_move_t move
move assignment
ecs_ctx_free_t ctx_free
Callback to free ctx.
ecs_iter_action_t on_add
Callback that is invoked when an instance of a component is added.
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
ecs_move_t move_ctor
Ctor + move.
ecs_move_t ctor_move_dtor
Ctor + move + dtor (or move_ctor + dtor).
Type that contains component information (passed to ctors/dtors/...)
ecs_size_t alignment
Alignment of type.
ecs_size_t size
Size of type.
const char * name
Type name.
ecs_entity_t component
Handle to component (do not set)
ecs_type_hooks_t hooks
Type hooks.
A type is a list of (component) ids.
ecs_id_t * array
Array with ids.
int32_t count
Number of elements in array.
Utility to hold a value of a dynamic type.
void * ptr
Pointer to value.
ecs_entity_t type
Type of value.
Type that contains information about the world.
float delta_time
Time passed to or computed by ecs_progress()
ecs_entity_t min_id
First allowed entity id.
int64_t set_count
Set commands processed.
double world_time_total
Time elapsed in simulation.
int32_t tag_id_count
Number of tag (no data) ids in the world.
int32_t component_id_count
Number of component (data) ids in the world.
int64_t pipeline_build_count_total
Total number of pipeline builds.
int64_t eval_comp_monitors_total
Total number of monitor evaluations.
int32_t table_count
Number of tables.
float delta_time_raw
Raw delta time (no time scaling)
float frame_time_total
Total time spent processing a frame.
int64_t table_create_total
Total number of times a table was created.
int64_t observers_ran_frame
Total number of times observer was invoked.
float system_time_total
Total time spent in systems.
int64_t id_delete_total
Total number of times an id was deleted.
int64_t systems_ran_frame
Total number of systems ran in last frame.
float merge_time_total
Total time spent in merges.
struct ecs_world_info_t::@0 cmd
Command statistics.
int64_t discard_count
Commands discarded, happens when entity is no longer alive when running the command.
int64_t clear_count
Clear commands processed.
ecs_entity_t last_component_id
Last issued component entity id.
int32_t empty_table_count
Number of tables without entities.
int64_t frame_count_total
Total number of frames.
ecs_entity_t max_id
Last allowed entity id.
int64_t merge_count_total
Total number of merges.
int64_t other_count
Other commands processed.
int64_t batched_command_count
Commands batched.
int64_t table_delete_total
Total number of times a table was deleted.
int64_t delete_count
Selete commands processed.
int64_t rematch_count_total
Total number of rematches.
int64_t id_create_total
Total number of times a new id was created.
int64_t batched_entity_count
Entities for which commands were batched.
float time_scale
Time scale applied to delta_time.
int32_t pair_id_count
Number of pair ids in the world.
float rematch_time_total
Time spent on query rematching.
int64_t ensure_count
Ensure/emplace commands processed.
float target_fps
Target fps.
double world_time_total_raw
Time elapsed in simulation (no scaling)
float emit_time_total
Total time spent notifying observers.
int64_t modified_count
Modified commands processed.
const char * name_prefix
Value set by ecs_set_name_prefix().
int64_t event_count
Enqueued custom events.
int64_t add_count
Add commands processed.
int64_t remove_count
Remove commands processed.