Flecs v4.0
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
flecs.h
Go to the documentation of this file.
1
8#ifndef FLECS_H
9#define FLECS_H
10
33/* Flecs version macros */
34#define FLECS_VERSION_MAJOR 4
35#define FLECS_VERSION_MINOR 1
36#define FLECS_VERSION_PATCH 0
39#define FLECS_VERSION FLECS_VERSION_IMPL(\
40 FLECS_VERSION_MAJOR, FLECS_VERSION_MINOR, FLECS_VERSION_PATCH)
41
45#ifdef FLECS_CONFIG_HEADER
46#include "flecs_config.h"
47#endif
48
51#ifndef ecs_float_t
52#define ecs_float_t float
53#endif
54
58#ifndef ecs_ftime_t
59#define ecs_ftime_t ecs_float_t
60#endif
61
65// #define FLECS_LEGACY
66
72// #define FLECS_ACCURATE_COUNTERS
73
79// #define FLECS_DISABLE_COUNTERS
80
81/* Make sure provided configuration is valid */
82#if defined(FLECS_DEBUG) && defined(FLECS_NDEBUG)
83#error "invalid configuration: cannot both define FLECS_DEBUG and FLECS_NDEBUG"
84#endif
85#if defined(FLECS_DEBUG) && defined(NDEBUG)
86#error "invalid configuration: cannot both define FLECS_DEBUG and NDEBUG"
87#endif
88
93#if !defined(FLECS_DEBUG) && !defined(FLECS_NDEBUG)
94#if defined(NDEBUG)
95#define FLECS_NDEBUG
96#else
97#define FLECS_DEBUG
98#endif
99#endif
100
105#ifdef FLECS_SANITIZE
106#ifndef FLECS_DEBUG
107#define FLECS_DEBUG /* If sanitized mode is enabled, so is debug mode */
108#endif
109#endif
110
115#ifdef FLECS_DEBUG
116#ifndef FLECS_DEBUG_INFO
117#define FLECS_DEBUG_INFO
118#endif
119#endif
120
121/* Tip: if you see weird behavior that you think might be a bug, make sure to
122 * test with the FLECS_DEBUG or FLECS_SANITIZE flags enabled. There's a good
123 * chance that this gives you more information about the issue! */
124
138// #define FLECS_SOFT_ASSERT
139
145// #define FLECS_KEEP_ASSERT
146
153// #define FLECS_DEFAULT_TO_UNCACHED_QUERIES
154
163// #define FLECS_CPP_NO_AUTO_REGISTRATION
164
172// #define FLECS_CPP_NO_ENUM_REFLECTION
173
178// #define FLECS_NO_ALWAYS_INLINE
179
207// #define FLECS_CUSTOM_BUILD
208
209#ifndef FLECS_CUSTOM_BUILD
210#define FLECS_ALERTS
211#define FLECS_APP
212// #define FLECS_C /**< C API convenience macros, always enabled */
213#define FLECS_CPP
214#define FLECS_DOC
215// #define FLECS_JOURNAL /**< Journaling addon */
216#define FLECS_JSON
217#define FLECS_HTTP
218#define FLECS_LOG
219#define FLECS_META
220#define FLECS_METRICS
221#define FLECS_MODULE
222#define FLECS_OS_API_IMPL
223// #define FLECS_PERF_TRACE /**< Enable performance tracing */
224#define FLECS_PIPELINE
225#define FLECS_REST
226#define FLECS_PARSER
227#define FLECS_QUERY_DSL
228#define FLECS_SCRIPT
229// #define FLECS_SCRIPT_MATH /**< Math functions for flecs script (may require linking with libm) */
230#define FLECS_SYSTEM
231#define FLECS_STATS
232#define FLECS_TIMER
233#define FLECS_UNITS
234#endif // ifndef FLECS_CUSTOM_BUILD
235
239// #define FLECS_LOW_FOOTPRINT
240#ifdef FLECS_LOW_FOOTPRINT
241#define FLECS_HI_COMPONENT_ID (16)
242#define FLECS_HI_ID_RECORD_ID (16)
243#define FLECS_ENTITY_PAGE_BITS (6)
244#define FLECS_USE_OS_ALLOC
245#define FLECS_DEFAULT_TO_UNCACHED_QUERIES
246#endif
247
262#ifndef FLECS_HI_COMPONENT_ID
263#define FLECS_HI_COMPONENT_ID (256)
264#endif
265
272#ifndef FLECS_HI_ID_RECORD_ID
273#define FLECS_HI_ID_RECORD_ID (1024)
274#endif
275
281#ifndef FLECS_SPARSE_PAGE_BITS
282#define FLECS_SPARSE_PAGE_BITS (6)
283#endif
284
287#ifndef FLECS_ENTITY_PAGE_BITS
288#define FLECS_ENTITY_PAGE_BITS (10)
289#endif
290
295// #define FLECS_USE_OS_ALLOC
296
299#ifndef FLECS_ID_DESC_MAX
300#define FLECS_ID_DESC_MAX (32)
301#endif
302
305#ifndef FLECS_EVENT_DESC_MAX
306#define FLECS_EVENT_DESC_MAX (8)
307#endif
308
311#define FLECS_VARIABLE_COUNT_MAX (64)
312
315#ifndef FLECS_TERM_COUNT_MAX
316#define FLECS_TERM_COUNT_MAX 32
317#endif
318
321#ifndef FLECS_TERM_ARG_COUNT_MAX
322#define FLECS_TERM_ARG_COUNT_MAX (16)
323#endif
324
327#ifndef FLECS_QUERY_VARIABLE_COUNT_MAX
328#define FLECS_QUERY_VARIABLE_COUNT_MAX (64)
329#endif
330
333#ifndef FLECS_QUERY_SCOPE_NESTING_MAX
334#define FLECS_QUERY_SCOPE_NESTING_MAX (8)
335#endif
336
341#ifndef FLECS_DAG_DEPTH_MAX
342#define FLECS_DAG_DEPTH_MAX (128)
343#endif
344
347#include "flecs/private/api_defines.h"
348#include "flecs/datastructures/vec.h" /* Vector datatype */
349#include "flecs/datastructures/sparse.h" /* Sparse set */
350#include "flecs/datastructures/block_allocator.h" /* Block allocator */
351#include "flecs/datastructures/stack_allocator.h" /* Stack allocator */
352#include "flecs/datastructures/map.h" /* Map */
353#include "flecs/datastructures/allocator.h" /* Allocator */
354#include "flecs/datastructures/strbuf.h" /* String builder */
355#include "flecs/os_api.h" /* Abstraction for operating system functions */
356
357#ifdef __cplusplus
358extern "C" {
359#endif
360
377typedef uint64_t ecs_id_t;
378
385
401typedef struct {
403 int32_t count;
404} ecs_type_t;
405
429
432
435
437typedef struct ecs_term_t ecs_term_t;
438
441
460
465
470typedef struct ecs_iter_t ecs_iter_t;
471
480typedef struct ecs_ref_t ecs_ref_t;
481
486
491
494
497
517typedef void ecs_poly_t;
518
521
528
529typedef struct ecs_table_record_t ecs_table_record_t;
530
549typedef void (*ecs_run_action_t)(
550 ecs_iter_t *it);
551
558typedef void (*ecs_iter_action_t)(
559 ecs_iter_t *it);
560
569 ecs_iter_t *it);
570
577 ecs_iter_t *it);
578
581 ecs_entity_t e1,
582 const void *ptr1,
583 ecs_entity_t e2,
584 const void *ptr2);
585
588 ecs_world_t* world,
589 ecs_table_t* table,
590 ecs_entity_t* entities,
591 void* ptr,
592 int32_t size,
593 int32_t lo,
594 int32_t hi,
595 ecs_order_by_action_t order_by);
596
598typedef uint64_t (*ecs_group_by_action_t)(
599 ecs_world_t *world,
600 ecs_table_t *table,
601 ecs_id_t group_id,
602 void *ctx);
603
605typedef void* (*ecs_group_create_action_t)(
606 ecs_world_t *world,
607 uint64_t group_id,
608 void *group_by_ctx); /* from ecs_query_desc_t */
609
612 ecs_world_t *world,
613 uint64_t group_id,
614 void *group_ctx, /* return value from ecs_group_create_action_t */
615 void *group_by_ctx); /* from ecs_query_desc_t */
616
618typedef void (*ecs_module_action_t)(
619 ecs_world_t *world);
620
622typedef void (*ecs_fini_action_t)(
623 ecs_world_t *world,
624 void *ctx);
625
627typedef void (*ecs_ctx_free_t)(
628 void *ctx);
629
631typedef int (*ecs_compare_action_t)(
632 const void *ptr1,
633 const void *ptr2);
634
636typedef uint64_t (*ecs_hash_value_action_t)(
637 const void *ptr);
638
640typedef void (*ecs_xtor_t)(
641 void *ptr,
642 int32_t count,
643 const ecs_type_info_t *type_info);
644
646typedef void (*ecs_copy_t)(
647 void *dst_ptr,
648 const void *src_ptr,
649 int32_t count,
650 const ecs_type_info_t *type_info);
651
653typedef void (*ecs_move_t)(
654 void *dst_ptr,
655 void *src_ptr,
656 int32_t count,
657 const ecs_type_info_t *type_info);
658
660typedef int (*ecs_cmp_t)(
661 const void *a_ptr,
662 const void *b_ptr,
663 const ecs_type_info_t *type_info);
664
666typedef bool (*ecs_equals_t)(
667 const void *a_ptr,
668 const void *b_ptr,
669 const ecs_type_info_t *type_info);
670
672typedef void (*flecs_poly_dtor_t)(
673 ecs_poly_t *poly);
674
693
704
712
713/* Term id flags */
714
719#define EcsSelf (1llu << 63)
720
725#define EcsUp (1llu << 62)
726
731#define EcsTrav (1llu << 61)
732
737#define EcsCascade (1llu << 60)
738
743#define EcsDesc (1llu << 59)
744
749#define EcsIsVariable (1llu << 58)
750
755#define EcsIsEntity (1llu << 57)
756
761#define EcsIsName (1llu << 56)
762
767#define EcsTraverseFlags (EcsSelf|EcsUp|EcsTrav|EcsCascade|EcsDesc)
768
773#define EcsTermRefFlags (EcsTraverseFlags|EcsIsVariable|EcsIsEntity|EcsIsName)
774
789
811
819 int32_t *sizes;
822 uint64_t bloom_filter;
823 ecs_flags32_t flags;
824 int8_t var_count;
825 int8_t term_count;
826 int8_t field_count;
828 /* Bitmasks for quick field information lookups */
829 ecs_termset_t fixed_fields;
830 ecs_termset_t var_fields;
831 ecs_termset_t static_id_fields;
832 ecs_termset_t data_fields;
833 ecs_termset_t write_fields;
834 ecs_termset_t read_fields;
835 ecs_termset_t row_fields;
837 ecs_termset_t set_fields;
841 char **vars;
843 void *ctx;
850 int32_t eval_count;
851};
852
881
889/* Flags that can be used to check which hooks a type has set */
890#define ECS_TYPE_HOOK_CTOR ECS_CAST(ecs_flags32_t, 1 << 0)
891#define ECS_TYPE_HOOK_DTOR ECS_CAST(ecs_flags32_t, 1 << 1)
892#define ECS_TYPE_HOOK_COPY ECS_CAST(ecs_flags32_t, 1 << 2)
893#define ECS_TYPE_HOOK_MOVE ECS_CAST(ecs_flags32_t, 1 << 3)
894#define ECS_TYPE_HOOK_COPY_CTOR ECS_CAST(ecs_flags32_t, 1 << 4)
895#define ECS_TYPE_HOOK_MOVE_CTOR ECS_CAST(ecs_flags32_t, 1 << 5)
896#define ECS_TYPE_HOOK_CTOR_MOVE_DTOR ECS_CAST(ecs_flags32_t, 1 << 6)
897#define ECS_TYPE_HOOK_MOVE_DTOR ECS_CAST(ecs_flags32_t, 1 << 7)
898#define ECS_TYPE_HOOK_CMP ECS_CAST(ecs_flags32_t, 1 << 8)
899#define ECS_TYPE_HOOK_EQUALS ECS_CAST(ecs_flags32_t, 1 << 9)
900
901
902/* Flags that can be used to set/check which hooks of a type are invalid */
903#define ECS_TYPE_HOOK_CTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 10)
904#define ECS_TYPE_HOOK_DTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 12)
905#define ECS_TYPE_HOOK_COPY_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 13)
906#define ECS_TYPE_HOOK_MOVE_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 14)
907#define ECS_TYPE_HOOK_COPY_CTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 15)
908#define ECS_TYPE_HOOK_MOVE_CTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 16)
909#define ECS_TYPE_HOOK_CTOR_MOVE_DTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 17)
910#define ECS_TYPE_HOOK_MOVE_DTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 18)
911#define ECS_TYPE_HOOK_CMP_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 19)
912#define ECS_TYPE_HOOK_EQUALS_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 20)
913
914
915/* All valid hook flags */
916#define ECS_TYPE_HOOKS (ECS_TYPE_HOOK_CTOR|ECS_TYPE_HOOK_DTOR|\
917 ECS_TYPE_HOOK_COPY|ECS_TYPE_HOOK_MOVE|ECS_TYPE_HOOK_COPY_CTOR|\
918 ECS_TYPE_HOOK_MOVE_CTOR|ECS_TYPE_HOOK_CTOR_MOVE_DTOR|\
919 ECS_TYPE_HOOK_MOVE_DTOR|ECS_TYPE_HOOK_CMP|ECS_TYPE_HOOK_EQUALS)
920
921/* All invalid hook flags */
922#define ECS_TYPE_HOOKS_ILLEGAL (ECS_TYPE_HOOK_CTOR_ILLEGAL|\
923 ECS_TYPE_HOOK_DTOR_ILLEGAL|ECS_TYPE_HOOK_COPY_ILLEGAL|\
924 ECS_TYPE_HOOK_MOVE_ILLEGAL|ECS_TYPE_HOOK_COPY_CTOR_ILLEGAL|\
925 ECS_TYPE_HOOK_MOVE_CTOR_ILLEGAL|ECS_TYPE_HOOK_CTOR_MOVE_DTOR_ILLEGAL|\
926 ECS_TYPE_HOOK_MOVE_DTOR_ILLEGAL|ECS_TYPE_HOOK_CMP_ILLEGAL|\
927 ECS_TYPE_HOOK_EQUALS_ILLEGAL)
993
1005
1006#include "flecs/private/api_types.h" /* Supporting API types */
1007#include "flecs/private/api_support.h" /* Supporting API functions */
1008#include "flecs/datastructures/hashmap.h" /* Hashmap */
1009#include "flecs/private/api_internals.h" /* Supporting API functions */
1010
1016
1021typedef struct ecs_entity_desc_t {
1022 int32_t _canary;
1028 const char *name;
1033 const char *sep;
1037 const char *root_sep;
1039 const char *symbol;
1055
1058
1060 const char *add_expr;
1062
1092
1106
1146 /* World */
1150 /* Matched data */
1151 int32_t offset;
1152 int32_t count;
1154 void **ptrs;
1155 const ecs_table_record_t **trs;
1156 const ecs_size_t *sizes;
1161 ecs_flags64_t constrained_vars;
1162 ecs_termset_t set_fields;
1163 ecs_termset_t ref_fields;
1164 ecs_termset_t row_fields;
1165 ecs_termset_t up_fields;
1167 /* Input information */
1171 int32_t event_cur;
1173 /* Query information */
1175 int8_t term_index;
1180 /* Context */
1181 void *param;
1182 void *ctx;
1185 void *run_ctx;
1187 /* Time */
1191 /* Iterator counters */
1194 /* Misc */
1195 ecs_flags32_t flags;
1197 ecs_iter_private_t priv_;
1199 /* Chained iterators */
1204};
1205
1206
1211#define EcsQueryMatchPrefab (1u << 1u)
1212
1217#define EcsQueryMatchDisabled (1u << 2u)
1218
1223#define EcsQueryMatchEmptyTables (1u << 3u)
1224
1229#define EcsQueryAllowUnresolvedByName (1u << 6u)
1230
1235#define EcsQueryTableOnly (1u << 7u)
1236
1247#define EcsQueryDetectChanges (1u << 8u)
1248
1249
1323
1385
1390typedef struct ecs_event_desc_t {
1393
1398
1401
1405
1407 int32_t offset;
1408
1412 int32_t count;
1413
1416
1421 void *param;
1422
1426 const void *const_param;
1427
1430
1432 ecs_flags32_t flags;
1434
1435
1444typedef struct ecs_build_info_t {
1445 const char *compiler;
1446 const char **addons;
1447 const char *version;
1451 bool debug;
1455
1514
1517 uint64_t id;
1518 int32_t match_count;
1519 int32_t table_count;
1520 void *ctx;
1522
1533typedef struct EcsIdentifier {
1534 char *value;
1535 ecs_size_t length;
1536 uint64_t hash;
1537 uint64_t index_hash;
1538 ecs_hashmap_t *index;
1540
1542typedef struct EcsComponent {
1543 ecs_size_t size;
1544 ecs_size_t alignment;
1546
1551
1560
1564/* Only include deprecated definitions if deprecated addon is required */
1565#ifdef FLECS_DEPRECATED
1567#endif
1568
1584FLECS_API extern const ecs_id_t ECS_PAIR;
1585
1587FLECS_API extern const ecs_id_t ECS_AUTO_OVERRIDE;
1588
1590FLECS_API extern const ecs_id_t ECS_TOGGLE;
1591
1599/* Builtin component ids */
1600
1602FLECS_API extern const ecs_entity_t ecs_id(EcsComponent);
1603
1605FLECS_API extern const ecs_entity_t ecs_id(EcsIdentifier);
1606
1608FLECS_API extern const ecs_entity_t ecs_id(EcsPoly);
1609
1611FLECS_API extern const ecs_entity_t ecs_id(EcsDefaultChildComponent);
1612
1614FLECS_API extern const ecs_entity_t EcsQuery;
1615
1617FLECS_API extern const ecs_entity_t EcsObserver;
1618
1620FLECS_API extern const ecs_entity_t EcsSystem;
1621
1623FLECS_API extern const ecs_entity_t ecs_id(EcsTickSource);
1624
1626FLECS_API extern const ecs_entity_t ecs_id(EcsPipelineQuery);
1627
1629FLECS_API extern const ecs_entity_t ecs_id(EcsTimer);
1630
1632FLECS_API extern const ecs_entity_t ecs_id(EcsRateFilter);
1633
1635FLECS_API extern const ecs_entity_t EcsFlecs;
1636
1638FLECS_API extern const ecs_entity_t EcsFlecsCore;
1639
1641FLECS_API extern const ecs_entity_t EcsWorld;
1642
1644FLECS_API extern const ecs_entity_t EcsWildcard;
1645
1647FLECS_API extern const ecs_entity_t EcsAny;
1648
1650FLECS_API extern const ecs_entity_t EcsThis;
1651
1653FLECS_API extern const ecs_entity_t EcsVariable;
1654
1656#define EcsSingleton EcsVariable
1657
1665FLECS_API extern const ecs_entity_t EcsTransitive;
1666
1674FLECS_API extern const ecs_entity_t EcsReflexive;
1675
1686FLECS_API extern const ecs_entity_t EcsFinal;
1687
1693FLECS_API extern const ecs_entity_t EcsInheritable;
1694
1696FLECS_API extern const ecs_entity_t EcsOnInstantiate;
1697
1701FLECS_API extern const ecs_entity_t EcsOverride;
1702
1706FLECS_API extern const ecs_entity_t EcsInherit;
1707
1712FLECS_API extern const ecs_entity_t EcsDontInherit;
1713
1721FLECS_API extern const ecs_entity_t EcsSymmetric;
1722
1732FLECS_API extern const ecs_entity_t EcsExclusive;
1733
1735FLECS_API extern const ecs_entity_t EcsAcyclic;
1736
1739FLECS_API extern const ecs_entity_t EcsTraversable;
1740
1750FLECS_API extern const ecs_entity_t EcsWith;
1751
1761FLECS_API extern const ecs_entity_t EcsOneOf;
1762
1764FLECS_API extern const ecs_entity_t EcsCanToggle;
1765
1769FLECS_API extern const ecs_entity_t EcsTrait;
1770
1780FLECS_API extern const ecs_entity_t EcsRelationship;
1781
1791FLECS_API extern const ecs_entity_t EcsTarget;
1792
1795FLECS_API extern const ecs_entity_t EcsPairIsTag;
1796
1798FLECS_API extern const ecs_entity_t EcsName;
1799
1801FLECS_API extern const ecs_entity_t EcsSymbol;
1802
1804FLECS_API extern const ecs_entity_t EcsAlias;
1805
1807FLECS_API extern const ecs_entity_t EcsChildOf;
1808
1810FLECS_API extern const ecs_entity_t EcsIsA;
1811
1813FLECS_API extern const ecs_entity_t EcsDependsOn;
1814
1816FLECS_API extern const ecs_entity_t EcsSlotOf;
1817
1819FLECS_API extern const ecs_entity_t EcsOrderedChildren;
1820
1822FLECS_API extern const ecs_entity_t EcsModule;
1823
1825FLECS_API extern const ecs_entity_t EcsPrivate;
1826
1829FLECS_API extern const ecs_entity_t EcsPrefab;
1830
1833FLECS_API extern const ecs_entity_t EcsDisabled;
1834
1838FLECS_API extern const ecs_entity_t EcsNotQueryable;
1839
1841FLECS_API extern const ecs_entity_t EcsOnAdd;
1842
1844FLECS_API extern const ecs_entity_t EcsOnRemove;
1845
1847FLECS_API extern const ecs_entity_t EcsOnSet;
1848
1850FLECS_API extern const ecs_entity_t EcsMonitor;
1851
1853FLECS_API extern const ecs_entity_t EcsOnTableCreate;
1854
1856FLECS_API extern const ecs_entity_t EcsOnTableDelete;
1857
1859FLECS_API extern const ecs_entity_t EcsOnDelete;
1860
1863FLECS_API extern const ecs_entity_t EcsOnDeleteTarget;
1864
1867FLECS_API extern const ecs_entity_t EcsRemove;
1868
1871FLECS_API extern const ecs_entity_t EcsDelete;
1872
1875FLECS_API extern const ecs_entity_t EcsPanic;
1876
1878FLECS_API extern const ecs_entity_t EcsSparse;
1879
1881FLECS_API extern const ecs_entity_t EcsDontFragment;
1882
1884FLECS_API extern const ecs_entity_t EcsPredEq;
1885
1887FLECS_API extern const ecs_entity_t EcsPredMatch;
1888
1890FLECS_API extern const ecs_entity_t EcsPredLookup;
1891
1893FLECS_API extern const ecs_entity_t EcsScopeOpen;
1894
1896FLECS_API extern const ecs_entity_t EcsScopeClose;
1897
1902FLECS_API extern const ecs_entity_t EcsEmpty;
1903
1904FLECS_API extern const ecs_entity_t ecs_id(EcsPipeline);
1905FLECS_API extern const ecs_entity_t EcsOnStart;
1906FLECS_API extern const ecs_entity_t EcsPreFrame;
1907FLECS_API extern const ecs_entity_t EcsOnLoad;
1908FLECS_API extern const ecs_entity_t EcsPostLoad;
1909FLECS_API extern const ecs_entity_t EcsPreUpdate;
1910FLECS_API extern const ecs_entity_t EcsOnUpdate;
1911FLECS_API extern const ecs_entity_t EcsOnValidate;
1912FLECS_API extern const ecs_entity_t EcsPostUpdate;
1913FLECS_API extern const ecs_entity_t EcsPreStore;
1914FLECS_API extern const ecs_entity_t EcsOnStore;
1915FLECS_API extern const ecs_entity_t EcsPostFrame;
1916FLECS_API extern const ecs_entity_t EcsPhase;
1918FLECS_API extern const ecs_entity_t EcsConstant;
1922#define EcsLastInternalComponentId (ecs_id(EcsPoly))
1923
1926#define EcsFirstUserComponentId (8)
1927
1930#define EcsFirstUserEntityId (FLECS_HI_COMPONENT_ID + 128)
1931
1932/* When visualized the reserved id ranges look like this:
1933 * - [1..8]: Builtin components
1934 * - [9..FLECS_HI_COMPONENT_ID]: Low ids reserved for application components
1935 * - [FLECS_HI_COMPONENT_ID + 1..EcsFirstUserEntityId]: Builtin entities
1936 */
1937
1959FLECS_API
1961
1968FLECS_API
1970
1978FLECS_API
1980 int argc,
1981 char *argv[]);
1982
1989FLECS_API
1991 ecs_world_t *world);
1992
2000FLECS_API
2002 const ecs_world_t *world);
2003
2011FLECS_API
2013 ecs_world_t *world,
2014 ecs_fini_action_t action,
2015 void *ctx);
2016
2023
2050FLECS_API
2052 const ecs_world_t *world);
2053
2061FLECS_API
2063 const ecs_world_t *world);
2064
2090FLECS_API
2092 ecs_world_t *world,
2093 ecs_ftime_t delta_time);
2094
2101FLECS_API
2103 ecs_world_t *world);
2104
2112FLECS_API
2114 ecs_world_t *world,
2115 ecs_fini_action_t action,
2116 void *ctx);
2117
2124FLECS_API
2126 ecs_world_t *world);
2127
2134FLECS_API
2136 const ecs_world_t *world);
2137
2150 ecs_world_t *world,
2151 bool enable);
2152
2164 ecs_world_t *world,
2165 bool enable);
2166
2182FLECS_API
2184 ecs_world_t *world,
2185 ecs_ftime_t fps);
2186
2200FLECS_API
2202 ecs_world_t *world,
2203 ecs_flags32_t flags);
2204
2281FLECS_API
2283 ecs_world_t *world,
2284 bool multi_threaded);
2285
2293FLECS_API
2295 ecs_world_t *world);
2296
2307FLECS_API
2309 ecs_world_t *world);
2310
2326FLECS_API
2328 ecs_world_t *world);
2329
2340FLECS_API
2342 const ecs_world_t *world);
2343
2357FLECS_API
2359 ecs_world_t *world);
2360
2375FLECS_API
2377 ecs_world_t *world);
2378
2389FLECS_API
2391 ecs_world_t *world);
2392
2406FLECS_API
2408 ecs_world_t *world,
2409 int32_t stages);
2410
2417FLECS_API
2419 const ecs_world_t *world);
2420
2436FLECS_API
2438 const ecs_world_t *world,
2439 int32_t stage_id);
2440
2448FLECS_API
2450 const ecs_world_t *world);
2451
2459FLECS_API
2461 ecs_world_t *world);
2462
2467FLECS_API
2469 ecs_world_t *stage);
2470
2478FLECS_API
2480 const ecs_world_t *world);
2481
2497FLECS_API
2499 ecs_world_t *world,
2500 void *ctx,
2501 ecs_ctx_free_t ctx_free);
2502
2511FLECS_API
2513 ecs_world_t *world,
2514 void *ctx,
2515 ecs_ctx_free_t ctx_free);
2516
2524FLECS_API
2526 const ecs_world_t *world);
2527
2535FLECS_API
2537 const ecs_world_t *world);
2538
2544FLECS_API
2546
2552FLECS_API
2554 const ecs_world_t *world);
2555
2564FLECS_API
2566 ecs_world_t *world,
2567 int32_t entity_count);
2568
2583FLECS_API
2585 ecs_world_t *world);
2586
2602FLECS_API
2604 ecs_world_t *world,
2605 ecs_entity_t id_start,
2606 ecs_entity_t id_end);
2607
2618FLECS_API
2620 ecs_world_t *world,
2621 bool enable);
2622
2628FLECS_API
2630 const ecs_world_t *world);
2631
2645FLECS_API
2647 ecs_world_t *world,
2648 ecs_flags32_t flags);
2649
2661
2691FLECS_API
2693 ecs_world_t *world,
2694 const ecs_delete_empty_tables_desc_t *desc);
2695
2701FLECS_API
2703 const ecs_poly_t *poly);
2704
2710FLECS_API
2712 const ecs_poly_t *poly);
2713
2727FLECS_API
2729 const ecs_poly_t *object,
2730 int32_t type);
2731
2735#define flecs_poly_is(object, type)\
2736 flecs_poly_is_(object, type##_magic)
2737
2746FLECS_API
2748 ecs_entity_t first,
2749 ecs_entity_t second);
2750
2773FLECS_API
2775 ecs_world_t *world,
2776 const char *thread_name);
2777
2800FLECS_API
2802 ecs_world_t *world,
2803 bool lock_world);
2804
2831FLECS_API
2833 ecs_world_t *world);
2834
2852FLECS_API
2854 ecs_world_t *world);
2855
2864FLECS_API
2866 ecs_world_t *world,
2867 ecs_id_t id);
2868
2876FLECS_API
2878 ecs_world_t *world,
2879 ecs_table_t *table);
2880
2899FLECS_API
2901 ecs_world_t *world,
2902 const ecs_entity_desc_t *desc);
2903
2930FLECS_API
2932 ecs_world_t *world,
2933 const ecs_bulk_desc_t *desc);
2934
2944FLECS_API
2946 ecs_world_t *world,
2947 ecs_id_t id,
2948 int32_t count);
2949
2965FLECS_API
2967 ecs_world_t *world,
2968 ecs_entity_t dst,
2969 ecs_entity_t src,
2970 bool copy_value);
2971
2980FLECS_API
2982 ecs_world_t *world,
2983 ecs_entity_t entity);
2984
2992FLECS_API
2994 ecs_world_t *world,
2995 ecs_id_t id);
2996
3014FLECS_API
3016 ecs_world_t *world,
3017 ecs_entity_t parent,
3018 const ecs_entity_t *children,
3019 int32_t child_count);
3020
3030FLECS_API
3032 const ecs_world_t *world,
3033 ecs_entity_t parent);
3034
3052FLECS_API
3054 ecs_world_t *world,
3055 ecs_entity_t entity,
3056 ecs_id_t id);
3057
3066FLECS_API
3068 ecs_world_t *world,
3069 ecs_entity_t entity,
3070 ecs_id_t id);
3071
3123FLECS_API
3125 ecs_world_t *world,
3126 ecs_entity_t entity,
3127 ecs_id_t id);
3128
3135FLECS_API
3137 ecs_world_t *world,
3138 ecs_entity_t entity);
3139
3147FLECS_API
3149 ecs_world_t *world,
3150 ecs_id_t id);
3151
3159FLECS_API
3161 ecs_world_t *world,
3162 ecs_id_t id);
3163
3170FLECS_API
3172 const ecs_world_t *world);
3173
3192FLECS_API
3194 ecs_world_t *world,
3195 ecs_entity_t entity,
3196 bool enabled);
3197
3211FLECS_API
3213 ecs_world_t *world,
3214 ecs_entity_t entity,
3215 ecs_id_t id,
3216 bool enable);
3217
3228FLECS_API
3230 const ecs_world_t *world,
3231 ecs_entity_t entity,
3232 ecs_id_t id);
3233
3257FLECS_API
3258FLECS_ALWAYS_INLINE const void* ecs_get_id(
3259 const ecs_world_t *world,
3260 ecs_entity_t entity,
3261 ecs_id_t id);
3262
3274FLECS_API
3275FLECS_ALWAYS_INLINE void* ecs_get_mut_id(
3276 const ecs_world_t *world,
3277 ecs_entity_t entity,
3278 ecs_id_t id);
3279
3296FLECS_API
3298 ecs_world_t *world,
3299 ecs_entity_t entity,
3300 ecs_id_t id,
3301 size_t size);
3302
3313FLECS_API
3315 const ecs_world_t *world,
3316 ecs_entity_t entity,
3317 ecs_id_t id);
3318
3327FLECS_API
3329 const ecs_world_t *world,
3330 ecs_ref_t *ref,
3331 ecs_id_t id);
3332
3340FLECS_API
3342 const ecs_world_t *world,
3343 ecs_ref_t *ref);
3344
3364FLECS_API
3366 ecs_world_t *world,
3367 ecs_entity_t entity,
3368 ecs_id_t id,
3369 bool *is_new);
3370
3380FLECS_API
3382 ecs_world_t *world,
3383 ecs_entity_t entity,
3384 ecs_id_t id);
3385
3401FLECS_API
3403 ecs_world_t *world,
3404 ecs_entity_t entity,
3405 ecs_id_t id,
3406 size_t size,
3407 const void *ptr);
3408
3436FLECS_API
3438 const ecs_world_t *world,
3439 ecs_entity_t e);
3440
3466FLECS_API
3468 const ecs_world_t *world,
3469 ecs_entity_t e);
3470
3476FLECS_API
3478 ecs_entity_t e);
3479
3496FLECS_API
3498 const ecs_world_t *world,
3499 ecs_entity_t e);
3500
3523FLECS_API
3525 ecs_world_t *world,
3526 ecs_entity_t entity);
3527
3546FLECS_API
3548 ecs_world_t *world,
3549 ecs_id_t id);
3550
3558FLECS_API
3560 const ecs_world_t *world,
3561 ecs_entity_t entity);
3562
3577FLECS_API
3579 ecs_world_t *world,
3580 ecs_entity_t entity);
3581
3597FLECS_API
3599 const ecs_world_t *world,
3600 ecs_entity_t entity);
3601
3608FLECS_API
3610 const ecs_world_t *world,
3611 ecs_entity_t entity);
3612
3620FLECS_API
3622 const ecs_world_t *world,
3623 const ecs_type_t* type);
3624
3636FLECS_API
3638 const ecs_world_t *world,
3639 const ecs_table_t *table);
3640
3655FLECS_API
3657 const ecs_world_t *world,
3658 ecs_entity_t entity);
3659
3670FLECS_API
3671FLECS_ALWAYS_INLINE bool ecs_has_id(
3672 const ecs_world_t *world,
3673 ecs_entity_t entity,
3674 ecs_id_t id);
3675
3686FLECS_API
3687FLECS_ALWAYS_INLINE bool ecs_owns_id(
3688 const ecs_world_t *world,
3689 ecs_entity_t entity,
3690 ecs_id_t id);
3691
3706FLECS_API
3708 const ecs_world_t *world,
3709 ecs_entity_t entity,
3710 ecs_entity_t rel,
3711 int32_t index);
3712
3726FLECS_API
3728 const ecs_world_t *world,
3729 ecs_entity_t entity);
3730
3751FLECS_API
3753 const ecs_world_t *world,
3754 ecs_entity_t entity,
3755 ecs_entity_t rel,
3756 ecs_id_t id);
3757
3768FLECS_API
3770 const ecs_world_t *world,
3771 ecs_entity_t entity,
3772 ecs_entity_t rel);
3773
3781FLECS_API
3783 const ecs_world_t *world,
3784 ecs_id_t entity);
3785
3805FLECS_API
3806const char* ecs_get_name(
3807 const ecs_world_t *world,
3808 ecs_entity_t entity);
3809
3819FLECS_API
3820const char* ecs_get_symbol(
3821 const ecs_world_t *world,
3822 ecs_entity_t entity);
3823
3837FLECS_API
3839 ecs_world_t *world,
3840 ecs_entity_t entity,
3841 const char *name);
3842
3856FLECS_API
3858 ecs_world_t *world,
3859 ecs_entity_t entity,
3860 const char *symbol);
3861
3873FLECS_API
3875 ecs_world_t *world,
3876 ecs_entity_t entity,
3877 const char *alias);
3878
3894FLECS_API
3896 const ecs_world_t *world,
3897 const char *path);
3898
3913FLECS_API
3915 const ecs_world_t *world,
3916 ecs_entity_t parent,
3917 const char *name);
3918
3941FLECS_API
3943 const ecs_world_t *world,
3944 ecs_entity_t parent,
3945 const char *path,
3946 const char *sep,
3947 const char *prefix,
3948 bool recursive);
3949
3967FLECS_API
3969 const ecs_world_t *world,
3970 const char *symbol,
3971 bool lookup_as_path,
3972 bool recursive);
3973
3995FLECS_API
3997 const ecs_world_t *world,
3998 ecs_entity_t parent,
3999 ecs_entity_t child,
4000 const char *sep,
4001 const char *prefix);
4002
4015FLECS_API
4017 const ecs_world_t *world,
4018 ecs_entity_t parent,
4019 ecs_entity_t child,
4020 const char *sep,
4021 const char *prefix,
4022 ecs_strbuf_t *buf,
4023 bool escape);
4024
4040FLECS_API
4042 ecs_world_t *world,
4043 ecs_entity_t parent,
4044 const char *path,
4045 const char *sep,
4046 const char *prefix);
4047
4062FLECS_API
4064 ecs_world_t *world,
4065 ecs_entity_t entity,
4066 ecs_entity_t parent,
4067 const char *path,
4068 const char *sep,
4069 const char *prefix);
4070
4084FLECS_API
4086 ecs_world_t *world,
4087 ecs_entity_t scope);
4088
4096FLECS_API
4098 const ecs_world_t *world);
4099
4109FLECS_API
4111 ecs_world_t *world,
4112 const char *prefix);
4113
4140FLECS_API
4142 ecs_world_t *world,
4143 const ecs_entity_t *lookup_path);
4144
4151FLECS_API
4153 const ecs_world_t *world);
4154
4179FLECS_API
4181 ecs_world_t *world,
4182 const ecs_component_desc_t *desc);
4183
4193FLECS_API
4195 const ecs_world_t *world,
4196 ecs_id_t id);
4197
4209FLECS_API
4211 ecs_world_t *world,
4212 ecs_entity_t id,
4213 const ecs_type_hooks_t *hooks);
4214
4221FLECS_API
4223 const ecs_world_t *world,
4224 ecs_entity_t id);
4225
4249FLECS_API
4251 const ecs_world_t *world,
4252 ecs_id_t id);
4253
4262FLECS_API
4264 const ecs_world_t *world,
4265 ecs_id_t id);
4266
4286FLECS_API
4288 const ecs_world_t *world,
4289 ecs_id_t id);
4290
4299FLECS_API
4301 ecs_id_t id,
4302 ecs_id_t pattern);
4303
4309FLECS_API
4311 ecs_id_t id);
4312
4318FLECS_API
4320 ecs_id_t id);
4321
4328 ecs_id_t id);
4329
4343FLECS_API
4345 const ecs_world_t *world,
4346 ecs_id_t id);
4347
4356FLECS_API
4357ecs_flags32_t ecs_id_get_flags(
4358 const ecs_world_t *world,
4359 ecs_id_t id);
4360
4367FLECS_API
4369 ecs_id_t id_flags);
4370
4378FLECS_API
4380 const ecs_world_t *world,
4381 ecs_id_t id);
4382
4390FLECS_API
4392 const ecs_world_t *world,
4393 ecs_id_t id,
4394 ecs_strbuf_t *buf);
4395
4403FLECS_API
4405 const ecs_world_t *world,
4406 const char *expr);
4407
4421FLECS_API
4423 const ecs_term_ref_t *id);
4424
4436FLECS_API
4438 const ecs_term_t *term);
4439
4454FLECS_API
4456 const ecs_term_t *term);
4457
4470FLECS_API
4472 const ecs_term_t *term);
4473
4482FLECS_API
4484 const ecs_world_t *world,
4485 const ecs_term_t *term);
4486
4494FLECS_API
4496 const ecs_query_t *query);
4497
4538FLECS_API
4540 const ecs_world_t *world,
4541 ecs_id_t id);
4542
4548FLECS_API
4550 ecs_iter_t *it);
4551
4568FLECS_API
4570 const ecs_world_t *world,
4571 ecs_entity_t parent);
4572
4578FLECS_API
4580 ecs_iter_t *it);
4581
4597FLECS_API
4599 ecs_world_t *world,
4600 const ecs_query_desc_t *desc);
4601
4606FLECS_API
4608 ecs_query_t *query);
4609
4618FLECS_API
4620 const ecs_query_t *query,
4621 const char *name);
4622
4630FLECS_API
4632 const ecs_query_t *query,
4633 int32_t var_id);
4634
4645FLECS_API
4647 const ecs_query_t *query,
4648 int32_t var_id);
4649
4718FLECS_API
4720 const ecs_world_t *world,
4721 const ecs_query_t *query);
4722
4730FLECS_API
4732 ecs_iter_t *it);
4733
4752FLECS_API
4754 ecs_query_t *query,
4755 ecs_entity_t entity,
4756 ecs_iter_t *it);
4757
4776FLECS_API
4778 ecs_query_t *query,
4779 ecs_table_t *table,
4780 ecs_iter_t *it);
4781
4808FLECS_API
4810 ecs_query_t *query,
4811 ecs_table_range_t *range,
4812 ecs_iter_t *it);
4813
4821FLECS_API
4823 const ecs_query_t *query);
4824
4834FLECS_API
4836 const ecs_query_t *query);
4837
4852FLECS_API
4854 const ecs_query_t *query,
4855 const ecs_iter_t *it);
4856
4874FLECS_API
4876 ecs_query_t *query,
4877 ecs_iter_t *it,
4878 const char *expr);
4879
4907FLECS_API
4909 ecs_query_t *query);
4910
4919FLECS_API
4921 const ecs_world_t *world,
4922 ecs_entity_t query);
4923
4934FLECS_API
4936 ecs_iter_t *it);
4937
4960FLECS_API
4962 ecs_iter_t *it,
4963 uint64_t group_id);
4964
4973FLECS_API
4975 const ecs_query_t *query,
4976 uint64_t group_id);
4977
4986FLECS_API
4988 const ecs_query_t *query,
4989 uint64_t group_id);
4990
4999
5006FLECS_API
5008 const ecs_query_t *query);
5009
5015FLECS_API
5017 const ecs_query_t *query);
5018
5027FLECS_API
5029 const ecs_query_t *query);
5030
5059FLECS_API
5061 ecs_world_t *world,
5062 ecs_event_desc_t *desc);
5063
5074FLECS_API
5076 ecs_world_t *world,
5077 ecs_event_desc_t *desc);
5078
5089FLECS_API
5091 ecs_world_t *world,
5092 const ecs_observer_desc_t *desc);
5093
5102FLECS_API
5104 const ecs_world_t *world,
5105 ecs_entity_t observer);
5106
5129FLECS_API
5131 ecs_iter_t *it);
5132
5142FLECS_API
5144 ecs_iter_t *it);
5145
5157FLECS_API
5159 ecs_iter_t *it);
5160
5173FLECS_API
5175 ecs_iter_t *it);
5176
5184FLECS_API
5186 ecs_iter_t *it);
5187
5226FLECS_API
5228 ecs_iter_t *it,
5229 int32_t var_id,
5230 ecs_entity_t entity);
5231
5242FLECS_API
5244 ecs_iter_t *it,
5245 int32_t var_id,
5246 const ecs_table_t *table);
5247
5258FLECS_API
5260 ecs_iter_t *it,
5261 int32_t var_id,
5262 const ecs_table_range_t *range);
5263
5276FLECS_API
5278 ecs_iter_t *it,
5279 int32_t var_id);
5280
5287FLECS_API
5289 const ecs_iter_t *it,
5290 int32_t var_id);
5291
5297FLECS_API
5299 const ecs_iter_t *it);
5300
5306FLECS_API
5308 const ecs_iter_t *it);
5309
5323FLECS_API
5325 ecs_iter_t *it,
5326 int32_t var_id);
5327
5341FLECS_API
5343 ecs_iter_t *it,
5344 int32_t var_id);
5345
5357FLECS_API
5359 ecs_iter_t *it,
5360 int32_t var_id);
5361
5373FLECS_API
5375 const ecs_iter_t *it);
5376
5388FLECS_API
5390 ecs_iter_t *it);
5391
5403FLECS_API
5405 const ecs_iter_t *it);
5406
5422FLECS_API
5424 const ecs_iter_t *it,
5425 int32_t offset,
5426 int32_t limit);
5427
5434FLECS_API
5436 ecs_iter_t *it);
5437
5458FLECS_API
5460 const ecs_iter_t *it,
5461 int32_t index,
5462 int32_t count);
5463
5470FLECS_API
5472 ecs_iter_t *it);
5473
5515FLECS_API
5517 const ecs_iter_t *it,
5518 size_t size,
5519 int8_t index);
5520
5542FLECS_API
5544 const ecs_iter_t *it,
5545 size_t size,
5546 int8_t index,
5547 int32_t row);
5548
5557FLECS_API
5559 const ecs_iter_t *it,
5560 int8_t index);
5561
5572FLECS_API
5574 const ecs_iter_t *it,
5575 int8_t index);
5576
5583FLECS_API
5585 const ecs_iter_t *it,
5586 int8_t index);
5587
5594FLECS_API
5596 const ecs_iter_t *it,
5597 int8_t index);
5598
5607FLECS_API
5609 const ecs_iter_t *it,
5610 int8_t index);
5611
5619FLECS_API
5621 const ecs_iter_t *it,
5622 int8_t index);
5623
5631FLECS_API
5633 const ecs_iter_t *it,
5634 int8_t index);
5635
5649FLECS_API
5651 const ecs_iter_t *it,
5652 int8_t index);
5653
5669FLECS_API
5671 const ecs_table_t *table);
5672
5683FLECS_API
5685 const ecs_world_t *world,
5686 const ecs_table_t *table,
5687 ecs_id_t id);
5688
5698FLECS_API
5700 const ecs_world_t *world,
5701 const ecs_table_t *table,
5702 ecs_id_t id);
5703
5711FLECS_API
5713 const ecs_table_t *table);
5714
5728FLECS_API
5730 const ecs_table_t *table,
5731 int32_t index);
5732
5741FLECS_API
5743 const ecs_table_t *table,
5744 int32_t index);
5745
5754FLECS_API
5756 const ecs_table_t *table,
5757 int32_t index,
5758 int32_t offset);
5759
5769FLECS_API
5771 const ecs_world_t *world,
5772 const ecs_table_t *table,
5773 ecs_id_t id,
5774 int32_t offset);
5775
5783FLECS_API
5785 const ecs_table_t *table,
5786 int32_t index);
5787
5794FLECS_API
5796 const ecs_table_t *table);
5797
5805FLECS_API
5807 const ecs_table_t *table);
5808
5815FLECS_API
5817 const ecs_table_t *table);
5818
5829FLECS_API
5831 const ecs_world_t *world,
5832 const ecs_table_t *table,
5833 ecs_id_t id);
5834
5845FLECS_API
5847 const ecs_world_t *world,
5848 const ecs_table_t *table,
5849 ecs_entity_t rel);
5850
5860FLECS_API
5862 ecs_world_t *world,
5863 ecs_table_t *table,
5864 ecs_id_t id);
5865
5876FLECS_API
5878 ecs_world_t *world,
5879 const ecs_id_t *ids,
5880 int32_t id_count);
5881
5891FLECS_API
5893 ecs_world_t *world,
5894 ecs_table_t *table,
5895 ecs_id_t id);
5896
5912FLECS_API
5914 ecs_world_t *world,
5915 ecs_table_t *table);
5916
5923FLECS_API
5925 ecs_world_t *world,
5926 ecs_table_t *table);
5927
5937FLECS_API
5939 ecs_table_t *table,
5940 ecs_flags32_t flags);
5941
5949FLECS_API
5951 const ecs_table_t *table);
5952
5960FLECS_API
5962 ecs_world_t* world,
5963 ecs_table_t* table,
5964 int32_t row_1,
5965 int32_t row_2);
5966
5989FLECS_API
5991 ecs_world_t *world,
5992 ecs_entity_t entity,
5993 ecs_record_t *record,
5994 ecs_table_t *table,
5995 const ecs_type_t *added,
5996 const ecs_type_t *removed);
5997
5998
6017FLECS_API
6019 const ecs_world_t *world,
6020 const ecs_table_t *table,
6021 ecs_id_t id,
6022 ecs_id_t *id_out);
6023
6059FLECS_API
6061 const ecs_world_t *world,
6062 const ecs_table_t *table,
6063 int32_t offset,
6064 ecs_id_t id,
6065 ecs_id_t *id_out);
6066
6108FLECS_API
6110 const ecs_world_t *world,
6111 const ecs_table_t *table,
6112 int32_t offset,
6113 ecs_id_t id,
6114 ecs_entity_t rel,
6115 ecs_flags64_t flags, /* EcsSelf and/or EcsUp */
6116 ecs_entity_t *subject_out,
6117 ecs_id_t *id_out,
6118 struct ecs_table_record_t **tr_out);
6119
6127FLECS_API
6129 ecs_world_t* world,
6130 ecs_table_t* table);
6131
6148FLECS_API
6150 const ecs_world_t *world,
6151 ecs_entity_t type,
6152 void *ptr);
6153
6161FLECS_API
6163 const ecs_world_t *world,
6164 const ecs_type_info_t *ti,
6165 void *ptr);
6166
6173FLECS_API
6175 ecs_world_t *world,
6176 ecs_entity_t type);
6177
6185 ecs_world_t *world,
6186 const ecs_type_info_t *ti);
6187
6196 const ecs_world_t *world,
6197 const ecs_type_info_t *ti,
6198 void *ptr);
6199
6207FLECS_API
6209 const ecs_world_t *world,
6210 ecs_entity_t type,
6211 void* ptr);
6212
6220FLECS_API
6222 ecs_world_t *world,
6223 ecs_entity_t type,
6224 void* ptr);
6225
6234FLECS_API
6236 const ecs_world_t *world,
6237 const ecs_type_info_t *ti,
6238 void* dst,
6239 const void *src);
6240
6249FLECS_API
6251 const ecs_world_t *world,
6252 ecs_entity_t type,
6253 void* dst,
6254 const void *src);
6255
6265 const ecs_world_t *world,
6266 const ecs_type_info_t *ti,
6267 void* dst,
6268 void *src);
6269
6279 const ecs_world_t *world,
6280 ecs_entity_t type,
6281 void* dst,
6282 void *src);
6283
6293 const ecs_world_t *world,
6294 const ecs_type_info_t *ti,
6295 void* dst,
6296 void *src);
6297
6307 const ecs_world_t *world,
6308 ecs_entity_t type,
6309 void* dst,
6310 void *src);
6311
6325#include "flecs/addons/flecs_c.h"
6326
6327#ifdef __cplusplus
6328}
6329#endif
6330
6331#include "flecs/private/addons.h"
6332
6333#endif
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.
const ecs_entity_t EcsScopeClose
Marker used to indicate the end of a scope (}) in queries.
const ecs_entity_t EcsOnRemove
Event that triggers when an id is removed from an entity.
const ecs_entity_t EcsThis
This entity.
const ecs_entity_t EcsWildcard
Wildcard entity ("*").
const ecs_entity_t EcsName
Tag to indicate name identifier.
const ecs_entity_t EcsAcyclic
Marks a relationship as acyclic.
const ecs_entity_t EcsSymmetric
Marks relationship as commutative.
const ecs_entity_t EcsAlias
Tag to indicate alias identifier.
const ecs_entity_t EcsOnSet
Event that triggers when a component is set for an entity.
const ecs_entity_t EcsReflexive
Marks a relationship as reflexive.
const ecs_entity_t EcsTrait
Can be added to components to indicate it is a trait.
const ecs_entity_t EcsEmpty
Tag used to indicate query is empty.
const ecs_entity_t EcsOneOf
Ensure that relationship target is child of specified entity.
const ecs_entity_t EcsOnTableDelete
Event that triggers when a table is deleted.
const ecs_entity_t EcsOnTableCreate
Event that triggers when a table is created.
const ecs_entity_t EcsObserver
Tag added to observers.
const ecs_entity_t EcsQuery
Tag added to queries.
const ecs_entity_t EcsRelationship
Ensure that an entity is always used in pair as relationship.
const ecs_entity_t EcsOnStart
OnStart pipeline phase.
const ecs_entity_t EcsNotQueryable
Trait added to entities that should never be returned by queries.
const ecs_entity_t EcsOnStore
OnStore pipeline phase.
const ecs_entity_t EcsOrderedChildren
Tag that when added to a parent ensures stable order of ecs_children result.
const ecs_entity_t EcsDontFragment
Mark component as non-fragmenting.
const ecs_entity_t EcsTraversable
Marks a relationship as traversable.
const ecs_entity_t EcsPredLookup
Marker used to indicate $var ~= "pattern" matching in queries.
const ecs_entity_t EcsPreStore
PreStore pipeline phase.
const ecs_entity_t EcsOnLoad
OnLoad pipeline phase.
const ecs_entity_t EcsIsA
Used to express inheritance relationships.
const ecs_entity_t EcsExclusive
Can be added to relationship to indicate that the relationship can only occur once on an entity.
const ecs_entity_t EcsSymbol
Tag to indicate symbol identifier.
const ecs_entity_t EcsDependsOn
Used to express dependency relationships.
const ecs_entity_t EcsTransitive
Marks a relationship as transitive.
const ecs_entity_t EcsDelete
Delete cleanup policy.
const ecs_entity_t EcsChildOf
Used to express parent-child relationships.
const ecs_entity_t EcsFlecsCore
Core module scope.
const ecs_entity_t EcsMonitor
Event that triggers observer when an entity starts/stops matching a query.
const ecs_entity_t EcsCanToggle
Mark a component as toggleable with ecs_enable_id().
const ecs_entity_t EcsPredEq
Marker used to indicate $var == ... matching in queries.
const ecs_entity_t EcsPhase
Phase pipeline phase.
const ecs_entity_t EcsWorld
Entity associated with world (used for "attaching" components to world)
const ecs_entity_t EcsPrivate
Tag to indicate an entity/component/system is private to a module.
const ecs_entity_t EcsScopeOpen
Marker used to indicate the start of a scope ({) in queries.
const ecs_entity_t EcsPostUpdate
PostUpdate pipeline phase.
const ecs_entity_t EcsOnValidate
OnValidate pipeline phase.
const ecs_entity_t EcsRemove
Remove cleanup policy.
const ecs_entity_t EcsOverride
Override component on instantiate.
const ecs_entity_t EcsPredMatch
Marker used to indicate $var == "name" matching in queries.
const ecs_entity_t EcsInherit
Inherit component on instantiate.
const ecs_entity_t EcsSlotOf
Used to express a slot (used with prefab inheritance)
const ecs_entity_t EcsModule
Tag added to module entities.
const ecs_entity_t EcsSparse
Mark component as sparse.
const ecs_entity_t EcsPreUpdate
PreUpdate pipeline phase.
const ecs_entity_t EcsOnAdd
Event that triggers when an id is added to an entity.
const ecs_entity_t EcsPrefab
Tag added to prefab entities.
const ecs_entity_t EcsOnInstantiate
Relationship that specifies component inheritance behavior.
const ecs_entity_t EcsPostFrame
PostFrame pipeline phase.
const ecs_entity_t EcsInheritable
Mark component as inheritable.
const ecs_entity_t EcsAny
Any entity ("_").
const ecs_entity_t EcsTarget
Ensure that an entity is always used in pair as target.
const ecs_entity_t EcsWith
Ensure that a component always is added together with another component.
const ecs_entity_t EcsPostLoad
PostLoad pipeline phase.
const ecs_entity_t EcsOnDelete
Relationship used for specifying cleanup behavior.
const ecs_entity_t EcsOnDeleteTarget
Relationship used to define what should happen when a target entity (second element of a pair) is del...
const ecs_entity_t EcsPreFrame
PreFrame pipeline phase.
const ecs_entity_t EcsFlecs
Root scope for builtin flecs entities.
const ecs_entity_t EcsSystem
Tag added to systems.
const ecs_entity_t EcsOnUpdate
OnUpdate pipeline phase.
const ecs_entity_t EcsDisabled
When this tag is added to an entity it is skipped by queries, unless EcsDisabled is explicitly querie...
const ecs_entity_t EcsDontInherit
Never inherit component on instantiate.
const ecs_entity_t EcsPairIsTag
Can be added to relationship to indicate that it should never hold data, even when it or the relation...
const ecs_entity_t EcsPanic
Panic cleanup policy.
const ecs_entity_t EcsFinal
Ensures that entity/component cannot be used as target in IsA relationship.
const ecs_entity_t EcsVariable
Variable entity ("$").
const ecs_entity_t EcsConstant
Tag added to enum/bitmask constants.
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_component_record_t ecs_component_record_t
Information about a (component) id, such as type info and tables with the id.
Definition flecs.h:496
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.
Definition flecs.h:431
struct ecs_ref_t ecs_ref_t
A ref is a fast way to fetch a component for a specific entity.
Definition flecs.h:480
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:384
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition flecs.h:428
struct ecs_mixins_t ecs_mixins_t
Type that stores poly mixins.
Definition flecs.h:520
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
Definition flecs.h:377
struct ecs_observable_t ecs_observable_t
An observable produces events that can be listened for by an observer.
Definition flecs.h:464
struct ecs_record_t ecs_record_t
Information about an entity, like its table and row.
Definition flecs.h:493
struct ecs_table_t ecs_table_t
A table stores entities and components for a specific type.
Definition flecs.h:434
void ecs_poly_t
A poly object.
Definition flecs.h:517
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.
void ecs_set_child_order(ecs_world_t *world, ecs_entity_t parent, const ecs_entity_t *children, int32_t child_count)
Set child order for parent with OrderedChildren.
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.
ecs_entities_t ecs_get_ordered_children(const ecs_world_t *world, ecs_entity_t parent)
Get ordered children.
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.
Definition flecs.h:618
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.
Definition flecs.h:598
int(* ecs_cmp_t)(const void *a_ptr, const void *b_ptr, const ecs_type_info_t *type_info)
Compare hook to compare component instances.
Definition flecs.h:660
uint64_t(* ecs_hash_value_action_t)(const void *ptr)
Callback used for hashing values.
Definition flecs.h:636
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.
Definition flecs.h:611
void(* ecs_iter_fini_action_t)(ecs_iter_t *it)
Function prototype for freeing an iterator.
Definition flecs.h:576
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.
Definition flecs.h:605
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.
Definition flecs.h:587
bool(* ecs_iter_next_action_t)(ecs_iter_t *it)
Function prototype for iterating an iterator.
Definition flecs.h:568
void(* ecs_iter_action_t)(ecs_iter_t *it)
Function prototype for iterables.
Definition flecs.h:558
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.
Definition flecs.h:646
bool(* ecs_equals_t)(const void *a_ptr, const void *b_ptr, const ecs_type_info_t *type_info)
Equals operator hook.
Definition flecs.h:666
int(* ecs_compare_action_t)(const void *ptr1, const void *ptr2)
Callback used for sorting values.
Definition flecs.h:631
void(* ecs_fini_action_t)(ecs_world_t *world, void *ctx)
Action callback on world exit.
Definition flecs.h:622
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.
Definition flecs.h:653
void(* flecs_poly_dtor_t)(ecs_poly_t *poly)
Destructor function for poly objects.
Definition flecs.h:672
void(* ecs_run_action_t)(ecs_iter_t *it)
Function prototype for runnables (systems, observers).
Definition flecs.h:549
void(* ecs_ctx_free_t)(void *ctx)
Function to cleanup context data.
Definition flecs.h:627
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.
Definition flecs.h:580
void(* ecs_xtor_t)(void *ptr, int32_t count, const ecs_type_info_t *type_info)
Constructor/destructor callback.
Definition flecs.h:640
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.
void * ecs_ensure_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id, size_t size)
Get a mutable pointer to a component.
void ecs_ref_update(const ecs_world_t *world, ecs_ref_t *ref)
Update ref.
void * ecs_emplace_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id, bool *is_new)
Emplace a component.
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_ref_get_id(const ecs_world_t *world, ecs_ref_t *ref, ecs_id_t id)
Get component from ref.
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.
void ecs_modified_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Signal that a component has been modified.
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_any(ecs_id_t id)
Utility to check if id is an any wildcard.
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.
ecs_var_t * ecs_iter_get_vars(const ecs_iter_t *it)
Get variable array.
bool ecs_field_is_readonly(const ecs_iter_t *it, int8_t index)
Test whether the field is readonly.
const char * ecs_iter_get_var_name(const ecs_iter_t *it, int32_t var_id)
Get variable name.
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.
int32_t ecs_iter_get_var_count(const ecs_iter_t *it)
Get number of variables.
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.
uint64_t ecs_iter_get_group(const ecs_iter_t *it)
Return the group id for the currently iterated result.
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.
Definition flecs.h:306
#define ecs_ftime_t
Customizable precision for scalar time values.
Definition flecs.h:59
#define FLECS_ID_DESC_MAX
Maximum number of ids to add ecs_entity_desc_t / ecs_bulk_desc_t.
Definition flecs.h:300
#define FLECS_TERM_COUNT_MAX
Maximum number of terms in queries.
Definition flecs.h:316
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.
ecs_entity_t ecs_get_scope(const ecs_world_t *world)
Get the current scope.
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, bool escape)
Write path identifier to buffer.
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.
const ecs_query_t * ecs_query_get(const ecs_world_t *world, ecs_entity_t query)
Get query object.
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.
Definition flecs.h:706
ecs_inout_kind_t
Specify read/write access for term.
Definition flecs.h:685
ecs_oper_kind_t
Specify operator for term.
Definition flecs.h:695
@ EcsQueryCacheAll
Require that all query terms can be cached.
Definition flecs.h:709
@ EcsQueryCacheDefault
Behavior determined by query creation context.
Definition flecs.h:707
@ EcsQueryCacheNone
No caching.
Definition flecs.h:710
@ EcsQueryCacheAuto
Cache query terms that are cacheable.
Definition flecs.h:708
@ EcsOut
Term is only written.
Definition flecs.h:691
@ EcsInOut
Term is both read and written.
Definition flecs.h:689
@ EcsInOutFilter
Same as InOutNone + prevents term from triggering observers.
Definition flecs.h:688
@ EcsInOutDefault
InOut for regular terms, In for shared terms.
Definition flecs.h:686
@ EcsInOutNone
Term is neither read nor written.
Definition flecs.h:687
@ EcsIn
Term is only read.
Definition flecs.h:690
@ EcsNot
The term must not match.
Definition flecs.h:698
@ EcsOptional
The term may match.
Definition flecs.h:699
@ EcsOr
One of the terms in an or chain must match.
Definition flecs.h:697
@ EcsOrFrom
Term must match at least one component from term id.
Definition flecs.h:701
@ EcsAnd
The term must match.
Definition flecs.h:696
@ EcsNotFrom
Term must match none of the components from term id.
Definition flecs.h:702
@ EcsAndFrom
Term must match all components from term id.
Definition flecs.h:700
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.
bool ecs_table_has_traversable(const ecs_table_t *table)
Check if table has traversable entities.
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_shrink(ecs_world_t *world)
Free unused memory.
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.
void ecs_exclusive_access_begin(ecs_world_t *world, const char *thread_name)
Begin exclusive thread access.
int32_t ecs_delete_empty_tables(ecs_world_t *world, const ecs_delete_empty_tables_desc_t *desc)
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.
struct ecs_delete_empty_tables_desc_t ecs_delete_empty_tables_desc_t
Used with ecs_delete_empty_tables().
bool ecs_enable_range_check(ecs_world_t *world, bool enable)
Enable/disable range limits.
void ecs_exclusive_access_end(ecs_world_t *world, bool lock_world)
End exclusive thread access.
void * ecs_get_ctx(const ecs_world_t *world)
Get the world context.
Operating system abstraction API.
Component information.
Definition flecs.h:1542
ecs_size_t size
Component size.
Definition flecs.h:1543
ecs_size_t alignment
Component alignment.
Definition flecs.h:1544
When added to an entity this informs serialization formats which component to use when a value is ass...
Definition flecs.h:1557
ecs_id_t component
Default component id.
Definition flecs.h:1558
A (string) identifier.
Definition flecs.h:1533
ecs_size_t length
Length of identifier.
Definition flecs.h:1535
char * value
Identifier string.
Definition flecs.h:1534
ecs_hashmap_t * index
Current index.
Definition flecs.h:1538
uint64_t hash
Hash of current value.
Definition flecs.h:1536
uint64_t index_hash
Hash of existing record in current index.
Definition flecs.h:1537
Component for storing a poly object.
Definition flecs.h:1548
ecs_poly_t * poly
Pointer to poly object.
Definition flecs.h:1549
Apply a rate filter to a tick source.
Definition timer.h:45
Component used to provide a tick source to systems.
Definition system.h:32
Component used for one shot/interval timer functionality.
Definition timer.h:35
Type with information about the current Flecs build.
Definition flecs.h:1444
int16_t version_major
Major flecs version.
Definition flecs.h:1448
const char ** addons
Addons included in build.
Definition flecs.h:1446
const char * version
Stringified version.
Definition flecs.h:1447
const char * compiler
Compiler used to compile flecs.
Definition flecs.h:1445
bool sanitize
Is this a sanitize build.
Definition flecs.h:1452
bool perf_trace
Is this a perf tracing build.
Definition flecs.h:1453
int16_t version_minor
Minor flecs version.
Definition flecs.h:1449
bool debug
Is this a debug build.
Definition flecs.h:1451
int16_t version_patch
Patch flecs version.
Definition flecs.h:1450
Used with ecs_bulk_init().
Definition flecs.h:1067
void ** data
Array with component data to insert.
Definition flecs.h:1079
ecs_id_t ids[(32)]
Ids to create the entities with.
Definition flecs.h:1077
int32_t count
Number of entities to create/populate.
Definition flecs.h:1075
int32_t _canary
Used for validity testing.
Definition flecs.h:1068
ecs_entity_t * entities
Entities to bulk insert.
Definition flecs.h:1070
ecs_table_t * table
Table to insert the entities into.
Definition flecs.h:1086
Used with ecs_component_init().
Definition flecs.h:1097
int32_t _canary
Used for validity testing.
Definition flecs.h:1098
ecs_type_info_t type
Parameters for type (size, hooks, ...)
Definition flecs.h:1104
ecs_entity_t entity
Existing entity to associate with observer (optional)
Definition flecs.h:1101
Used with ecs_delete_empty_tables().
Definition flecs.h:2651
uint16_t delete_generation
Delete table when generation > delete_generation.
Definition flecs.h:2656
double time_budget_seconds
Amount of time operation is allowed to spend.
Definition flecs.h:2659
uint16_t clear_generation
Free table data when generation > clear_generation.
Definition flecs.h:2653
Type returned by ecs_get_entities().
Definition flecs.h:2018
int32_t alive_count
Number of alive entity ids.
Definition flecs.h:2021
int32_t count
Total number of entity ids.
Definition flecs.h:2020
const ecs_entity_t * ids
Array with all entity ids in the world.
Definition flecs.h:2019
Used with ecs_entity_init().
Definition flecs.h:1021
const char * sep
Optional custom separator for hierarchical names.
Definition flecs.h:1033
const char * root_sep
Optional, used for identifiers relative to root.
Definition flecs.h:1037
const char * name
Name of the entity.
Definition flecs.h:1028
bool use_low_id
When set to true, a low id (typically reserved for components) will be used to create the entity,...
Definition flecs.h:1049
const char * symbol
Optional entity symbol.
Definition flecs.h:1039
int32_t _canary
Used for validity testing.
Definition flecs.h:1022
const ecs_id_t * add
0-terminated array of ids to add to the entity.
Definition flecs.h:1054
const char * add_expr
String expression with components to add.
Definition flecs.h:1060
const ecs_value_t * set
0-terminated array of values to set on the entity.
Definition flecs.h:1057
ecs_entity_t id
Set to modify existing entity (optional)
Definition flecs.h:1024
ecs_entity_t parent
Parent entity.
Definition flecs.h:1026
Used with ecs_emit().
Definition flecs.h:1390
ecs_entity_t entity
Single-entity alternative to setting table / offset / count.
Definition flecs.h:1415
const void * const_param
Same as param, but with the guarantee that the value won't be modified.
Definition flecs.h:1426
ecs_table_t * table
The table for which to notify.
Definition flecs.h:1400
int32_t count
Limit number of notified entities to count.
Definition flecs.h:1412
ecs_table_t * other_table
Optional 2nd table to notify.
Definition flecs.h:1404
int32_t offset
Limit notified entities to ones starting from offset (row) in table.
Definition flecs.h:1407
const ecs_type_t * ids
Component ids.
Definition flecs.h:1397
ecs_poly_t * observable
Observable (usually the world)
Definition flecs.h:1429
ecs_entity_t event
The event id.
Definition flecs.h:1392
ecs_flags32_t flags
Event flags.
Definition flecs.h:1432
void * param
Optional context.
Definition flecs.h:1421
Header for ecs_poly_t objects.
Definition flecs.h:523
int32_t type
Magic number indicating which type of flecs object.
Definition flecs.h:524
int32_t refcount
Refcount, to enable RAII handles.
Definition flecs.h:525
ecs_mixins_t * mixins
Table with offsets to (optional) mixins.
Definition flecs.h:526
Iterator.
Definition flecs.h:1145
ecs_world_t * real_world
Actual world.
Definition flecs.h:1148
void * param
Param passed to ecs_run.
Definition flecs.h:1181
ecs_entity_t event
The event (if applicable)
Definition flecs.h:1169
int32_t frame_offset
Offset relative to start of iteration.
Definition flecs.h:1192
ecs_flags32_t ref_fields
Bitset with fields that aren't component arrays.
Definition flecs.h:1163
ecs_entity_t interrupted_by
When set, system execution is interrupted.
Definition flecs.h:1196
ecs_flags32_t flags
Iterator flags.
Definition flecs.h:1195
ecs_iter_t * chain_it
Optional, allows for creating iterator chains.
Definition flecs.h:1203
void * ctx
System context.
Definition flecs.h:1182
void * run_ctx
Run language binding context.
Definition flecs.h:1185
ecs_table_t * table
Current table.
Definition flecs.h:1157
int32_t offset
Offset relative to current table.
Definition flecs.h:1151
ecs_id_t event_id
The (component) id for the event.
Definition flecs.h:1170
ecs_iter_fini_action_t fini
Function to cleanup iterator resources.
Definition flecs.h:1202
ecs_iter_private_t priv_
Private data.
Definition flecs.h:1197
ecs_world_t * world
The world.
Definition flecs.h:1147
void * callback_ctx
Callback language binding context.
Definition flecs.h:1184
ecs_entity_t * sources
Entity on which the id was matched (0 if same as entities)
Definition flecs.h:1160
void * binding_ctx
System binding context.
Definition flecs.h:1183
ecs_flags32_t row_fields
Fields that must be obtained with field_at.
Definition flecs.h:1164
float delta_system_time
Time elapsed since last system invocation.
Definition flecs.h:1189
const ecs_query_t * query
Query being evaluated.
Definition flecs.h:1178
int8_t term_index
Index of term that emitted an event.
Definition flecs.h:1175
ecs_entity_t system
The system (if applicable)
Definition flecs.h:1168
ecs_flags32_t set_fields
Fields that are set.
Definition flecs.h:1162
const ecs_size_t * sizes
Component sizes.
Definition flecs.h:1156
float delta_time
Time elapsed since last frame.
Definition flecs.h:1188
ecs_flags32_t up_fields
Bitset with fields matched through up traversal.
Definition flecs.h:1165
ecs_iter_action_t callback
Callback of system or observer.
Definition flecs.h:1201
int8_t field_count
Number of fields in iterator.
Definition flecs.h:1174
ecs_table_t * other_table
Prev or next table when adding/removing.
Definition flecs.h:1158
int32_t event_cur
Unique event id.
Definition flecs.h:1171
const ecs_table_record_t ** trs
Info on where to find field in table.
Definition flecs.h:1155
int32_t count
Number of entities to iterate.
Definition flecs.h:1152
void ** ptrs
Component pointers.
Definition flecs.h:1154
ecs_iter_next_action_t next
Function to progress iterator.
Definition flecs.h:1200
const ecs_entity_t * entities
Entity identifiers.
Definition flecs.h:1153
ecs_id_t * ids
(Component) ids
Definition flecs.h:1159
ecs_flags64_t constrained_vars
Bitset that marks constrained variables.
Definition flecs.h:1161
Used with ecs_observer_init().
Definition flecs.h:1328
ecs_ctx_free_t run_ctx_free
Callback to free run ctx.
Definition flecs.h:1372
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:1360
void * run_ctx
Context associated with run (for language bindings).
Definition flecs.h:1369
ecs_entity_t entity
Existing entity to associate with observer (optional)
Definition flecs.h:1333
ecs_entity_t events[(8)]
Events to observe (OnAdd, OnRemove, OnSet)
Definition flecs.h:1339
int32_t * last_event_id
Optional shared last event id for multiple observers.
Definition flecs.h:1379
void * callback_ctx
Context associated with callback (for language bindings).
Definition flecs.h:1363
void * ctx
User context to pass to callback.
Definition flecs.h:1357
ecs_query_desc_t query
Query for observer.
Definition flecs.h:1336
ecs_poly_t * observable
Observable with which to register the observer.
Definition flecs.h:1375
ecs_ctx_free_t callback_ctx_free
Callback to free callback ctx.
Definition flecs.h:1366
int8_t term_index_
Used for internal purposes.
Definition flecs.h:1382
ecs_iter_action_t callback
Callback to invoke on an event, invoked when the observer matches.
Definition flecs.h:1346
bool yield_existing
When observer is created, generate events from existing data.
Definition flecs.h:1343
ecs_run_action_t run
Callback invoked on an event.
Definition flecs.h:1354
int32_t _canary
Used for validity testing.
Definition flecs.h:1330
An observer reacts to events matching a query.
Definition flecs.h:856
int32_t event_count
Number of events.
Definition flecs.h:863
ecs_iter_action_t callback
See ecs_observer_desc_t::callback.
Definition flecs.h:865
ecs_entity_t entity
Entity associated with observer.
Definition flecs.h:879
ecs_observable_t * observable
Observable for observer.
Definition flecs.h:876
ecs_run_action_t run
See ecs_observer_desc_t::run.
Definition flecs.h:866
ecs_header_t hdr
Object header.
Definition flecs.h:857
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:872
void * run_ctx
Run language binding context.
Definition flecs.h:870
ecs_world_t * world
The world.
Definition flecs.h:878
ecs_ctx_free_t run_ctx_free
Callback to free run_ctx.
Definition flecs.h:874
void * callback_ctx
Callback language binding context.
Definition flecs.h:869
void * ctx
Observer context.
Definition flecs.h:868
ecs_entity_t events[(8)]
Observer events.
Definition flecs.h:862
ecs_ctx_free_t callback_ctx_free
Callback to free callback_ctx.
Definition flecs.h:873
ecs_query_t * query
Observer query.
Definition flecs.h:859
Struct returned by ecs_query_count().
Definition flecs.h:4992
int32_t entities
Number of entities returned by query.
Definition flecs.h:4994
int32_t results
Number of results returned by query.
Definition flecs.h:4993
int32_t tables
Number of tables returned by query.
Definition flecs.h:4995
Used with ecs_query_init().
Definition flecs.h:1254
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:1315
ecs_id_t group_by
Component id to be used for grouping.
Definition flecs.h:1285
ecs_term_t terms[32]
Query terms.
Definition flecs.h:1259
int32_t _canary
Used for validity testing.
Definition flecs.h:1256
void * ctx
User context to pass to callback.
Definition flecs.h:1309
ecs_ctx_free_t group_by_ctx_free
Function to free group_by_ctx.
Definition flecs.h:1306
void * group_by_ctx
Context to pass to group_by.
Definition flecs.h:1303
void * binding_ctx
Context to be used for language bindings.
Definition flecs.h:1312
ecs_entity_t order_by
Component to sort on, used together with order_by_callback or order_by_table_callback.
Definition flecs.h:1281
ecs_order_by_action_t order_by_callback
Callback used for ordering query results.
Definition flecs.h:1273
ecs_group_create_action_t on_group_create
Callback that is invoked when a new group is created.
Definition flecs.h:1296
ecs_entity_t entity
Entity associated with query (optional)
Definition flecs.h:1321
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:1318
ecs_group_by_action_t group_by_callback
Callback used for grouping results.
Definition flecs.h:1292
ecs_group_delete_action_t on_group_delete
Callback that is invoked when an existing group is deleted.
Definition flecs.h:1300
ecs_sort_table_action_t order_by_table_callback
Callback used for ordering query results.
Definition flecs.h:1277
ecs_flags32_t flags
Flags for enabling query features.
Definition flecs.h:1268
ecs_query_cache_kind_t cache_kind
Caching policy of query.
Definition flecs.h:1265
const char * expr
Query DSL expression (optional)
Definition flecs.h:1262
Type that contains information about a query group.
Definition flecs.h:1516
int32_t table_count
Number of tables in group.
Definition flecs.h:1519
void * ctx
Group context, returned by on_group_create.
Definition flecs.h:1520
int32_t match_count
How often tables have been matched/unmatched.
Definition flecs.h:1518
Queries are lists of constraints (terms) that match entities.
Definition flecs.h:815
ecs_flags32_t row_fields
Fields that must be acquired with field_at.
Definition flecs.h:835
ecs_flags32_t data_fields
Fields that have data.
Definition flecs.h:832
ecs_flags32_t read_fields
Fields that read data.
Definition flecs.h:834
ecs_header_t hdr
Object header.
Definition flecs.h:816
int8_t var_count
Number of query variables.
Definition flecs.h:824
ecs_flags32_t fixed_fields
Fields with a fixed source.
Definition flecs.h:829
ecs_flags32_t var_fields
Fields with non-$this variable source.
Definition flecs.h:830
ecs_flags32_t write_fields
Fields that write data.
Definition flecs.h:833
int32_t eval_count
Number of times query is evaluated.
Definition flecs.h:850
ecs_world_t * world
World or stage query was created with.
Definition flecs.h:848
ecs_flags32_t static_id_fields
Fields with a static (component) id.
Definition flecs.h:831
uint64_t bloom_filter
Bitmask used to quickly discard tables.
Definition flecs.h:822
ecs_world_t * real_world
Actual world.
Definition flecs.h:847
ecs_flags32_t set_fields
Fields that will be set.
Definition flecs.h:837
ecs_entity_t entity
Entity associated with query (optional)
Definition flecs.h:846
void * ctx
User context to pass to callback.
Definition flecs.h:843
int32_t * sizes
Component sizes.
Definition flecs.h:819
ecs_id_t * ids
Component ids.
Definition flecs.h:820
ecs_flags32_t shared_readonly_fields
Fields that don't write shared data.
Definition flecs.h:836
ecs_term_t * terms
Query terms.
Definition flecs.h:818
ecs_query_cache_kind_t cache_kind
Caching policy of query.
Definition flecs.h:839
int8_t term_count
Number of query terms.
Definition flecs.h:825
char ** vars
Array with variable names for iterator.
Definition flecs.h:841
int8_t field_count
Number of fields returned by query.
Definition flecs.h:826
ecs_flags32_t flags
Query flags.
Definition flecs.h:823
void * binding_ctx
Context to be used for language bindings.
Definition flecs.h:844
Type that describes a reference to an entity or variable in a term.
Definition flecs.h:776
const char * name
Name.
Definition flecs.h:783
ecs_entity_t id
Entity id.
Definition flecs.h:777
Type that describes a term (single element in a query).
Definition flecs.h:791
ecs_term_ref_t src
Source of term.
Definition flecs.h:797
int8_t field_index
Index of field for term in iterator.
Definition flecs.h:808
ecs_id_t id
Component id to be matched by term.
Definition flecs.h:792
int16_t oper
Operator of term.
Definition flecs.h:806
ecs_term_ref_t second
Second element of pair.
Definition flecs.h:799
ecs_flags16_t flags_
Flags that help eval, set by ecs_query_init()
Definition flecs.h:809
ecs_entity_t trav
Relationship to traverse when looking for the component.
Definition flecs.h:801
int16_t inout
Access to contents matched by term.
Definition flecs.h:805
ecs_term_ref_t first
Component or first element of pair.
Definition flecs.h:798
ecs_copy_t copy_ctor
Ctor + copy.
Definition flecs.h:935
void * lifecycle_ctx
Component lifecycle context (see meta add-on)
Definition flecs.h:987
void * ctx
User defined context.
Definition flecs.h:985
ecs_iter_action_t on_remove
Callback that is invoked when an instance of the component is removed.
Definition flecs.h:977
void * binding_ctx
Language binding context.
Definition flecs.h:986
ecs_move_t move_dtor
Move + dtor.
Definition flecs.h:950
ecs_flags32_t flags
Hook flags.
Definition flecs.h:962
ecs_cmp_t cmp
Compare hook.
Definition flecs.h:953
ecs_copy_t copy
copy assignment
Definition flecs.h:931
ecs_ctx_free_t lifecycle_ctx_free
Callback to free lifecycle_ctx.
Definition flecs.h:991
ecs_iter_action_t on_set
Callback that is invoked when an instance of the component is set.
Definition flecs.h:972
ecs_move_t move
move assignment
Definition flecs.h:932
ecs_xtor_t ctor
ctor
Definition flecs.h:929
ecs_iter_action_t on_replace
Callback that is invoked with the existing and new value before the value is assigned.
Definition flecs.h:983
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:989
ecs_iter_action_t on_add
Callback that is invoked when an instance of a component is added.
Definition flecs.h:967
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:990
ecs_move_t move_ctor
Ctor + move.
Definition flecs.h:938
ecs_equals_t equals
Equals hook.
Definition flecs.h:956
ecs_move_t ctor_move_dtor
Ctor + move + dtor (or move_ctor + dtor).
Definition flecs.h:944
ecs_xtor_t dtor
dtor
Definition flecs.h:930
Type that contains component information (passed to ctors/dtors/...)
Definition flecs.h:998
ecs_size_t alignment
Alignment of type.
Definition flecs.h:1000
ecs_size_t size
Size of type.
Definition flecs.h:999
const char * name
Type name.
Definition flecs.h:1003
ecs_entity_t component
Handle to component (do not set)
Definition flecs.h:1002
ecs_type_hooks_t hooks
Type hooks.
Definition flecs.h:1001
A type is a list of (component) ids.
Definition flecs.h:401
ecs_id_t * array
Array with ids.
Definition flecs.h:402
int32_t count
Number of elements in array.
Definition flecs.h:403
Utility to hold a value of a dynamic type.
Definition flecs.h:1012
void * ptr
Pointer to value.
Definition flecs.h:1014
ecs_entity_t type
Type of value.
Definition flecs.h:1013
Type that contains information about the world.
Definition flecs.h:1457
float delta_time
Time passed to or computed by ecs_progress()
Definition flecs.h:1463
ecs_entity_t min_id
First allowed entity id.
Definition flecs.h:1459
int64_t set_count
Set commands processed.
Definition flecs.h:1499
double world_time_total
Time elapsed in simulation.
Definition flecs.h:1471
int32_t tag_id_count
Number of tag (no data) ids in the world.
Definition flecs.h:1487
int32_t component_id_count
Number of component (data) ids in the world.
Definition flecs.h:1488
int64_t pipeline_build_count_total
Total number of pipeline builds.
Definition flecs.h:1483
int64_t eval_comp_monitors_total
Total number of monitor evaluations.
Definition flecs.h:1476
int32_t table_count
Number of tables.
Definition flecs.h:1491
float delta_time_raw
Raw delta time (no time scaling)
Definition flecs.h:1462
float frame_time_total
Total time spent processing a frame.
Definition flecs.h:1466
int64_t table_create_total
Total number of times a table was created.
Definition flecs.h:1481
int64_t observers_ran_frame
Total number of times observer was invoked.
Definition flecs.h:1485
float system_time_total
Total time spent in systems.
Definition flecs.h:1467
int64_t id_delete_total
Total number of times an id was deleted.
Definition flecs.h:1480
int64_t systems_ran_frame
Total number of systems ran in last frame.
Definition flecs.h:1484
float merge_time_total
Total time spent in merges.
Definition flecs.h:1469
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.
Definition flecs.h:1502
int64_t clear_count
Clear commands processed.
Definition flecs.h:1498
ecs_entity_t last_component_id
Last issued component entity id.
Definition flecs.h:1458
int64_t frame_count_total
Total number of frames.
Definition flecs.h:1474
ecs_entity_t max_id
Last allowed entity id.
Definition flecs.h:1460
int64_t merge_count_total
Total number of merges.
Definition flecs.h:1475
int64_t other_count
Other commands processed.
Definition flecs.h:1504
int64_t batched_command_count
Commands batched.
Definition flecs.h:1506
int64_t table_delete_total
Total number of times a table was deleted.
Definition flecs.h:1482
int64_t delete_count
Selete commands processed.
Definition flecs.h:1497
int64_t rematch_count_total
Total number of rematches.
Definition flecs.h:1477
int64_t id_create_total
Total number of times a new id was created.
Definition flecs.h:1479
int64_t batched_entity_count
Entities for which commands were batched.
Definition flecs.h:1505
float time_scale
Time scale applied to delta_time.
Definition flecs.h:1464
int32_t pair_id_count
Number of pair ids in the world.
Definition flecs.h:1489
float rematch_time_total
Time spent on query rematching.
Definition flecs.h:1470
int64_t ensure_count
Ensure/emplace commands processed.
Definition flecs.h:1500
float target_fps
Target fps.
Definition flecs.h:1465
double world_time_total_raw
Time elapsed in simulation (no scaling)
Definition flecs.h:1472
float emit_time_total
Total time spent notifying observers.
Definition flecs.h:1468
int64_t modified_count
Modified commands processed.
Definition flecs.h:1501
const char * name_prefix
Value set by ecs_set_name_prefix().
Definition flecs.h:1509
int64_t event_count
Enqueued custom events.
Definition flecs.h:1503
int64_t add_count
Add commands processed.
Definition flecs.h:1495
int64_t remove_count
Remove commands processed.
Definition flecs.h:1496