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 1
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
62
68// #define FLECS_ACCURATE_COUNTERS
69
75// #define FLECS_DISABLE_COUNTERS
76
77/* Make sure provided configuration is valid */
78#if defined(FLECS_DEBUG) && defined(FLECS_NDEBUG)
79#warning "invalid configuration: cannot both define FLECS_DEBUG and FLECS_NDEBUG"
80#endif
81#if defined(FLECS_DEBUG) && defined(NDEBUG)
82#warning "invalid configuration: cannot both define FLECS_DEBUG and NDEBUG"
83#endif
84
89#if !defined(FLECS_DEBUG) && !defined(FLECS_NDEBUG)
90#if defined(NDEBUG)
91#define FLECS_NDEBUG
92#else
93#define FLECS_DEBUG
94#endif
95#endif
96
101#ifdef FLECS_SANITIZE
102#ifndef FLECS_DEBUG
103#define FLECS_DEBUG /* If sanitized mode is enabled, so is debug mode */
104#endif
105#endif
106
111#ifdef FLECS_DEBUG
112#ifndef FLECS_DEBUG_INFO
113#define FLECS_DEBUG_INFO
114#endif
115#endif
116
117/* Tip: if you see weird behavior that you think might be a bug, make sure to
118 * test with the FLECS_DEBUG or FLECS_SANITIZE flags enabled. There's a good
119 * chance that this gives you more information about the issue! */
120
134// #define FLECS_SOFT_ASSERT
135
141// #define FLECS_KEEP_ASSERT
142
149// #define FLECS_DEFAULT_TO_UNCACHED_QUERIES
150
159// #define FLECS_CPP_NO_AUTO_REGISTRATION
160
168// #define FLECS_CPP_NO_ENUM_REFLECTION
169
174// #define FLECS_NO_ALWAYS_INLINE
175
203// #define FLECS_CUSTOM_BUILD
204
205#ifndef FLECS_CUSTOM_BUILD
206#define FLECS_ALERTS
207#define FLECS_APP
208// #define FLECS_C /**< C API convenience macros, always enabled */
209#define FLECS_CPP
210#define FLECS_DOC
211// #define FLECS_JOURNAL /**< Journaling addon */
212#define FLECS_JSON
213#define FLECS_HTTP
214#define FLECS_LOG
215#define FLECS_META
216#define FLECS_METRICS
217#define FLECS_MODULE
218#define FLECS_OS_API_IMPL
219// #define FLECS_PERF_TRACE /**< Enable performance tracing */
220#define FLECS_PIPELINE
221#define FLECS_REST
222#define FLECS_PARSER
223#define FLECS_QUERY_DSL
224#define FLECS_SCRIPT
225// #define FLECS_SCRIPT_MATH /**< Math functions for flecs script (may require linking with libm) */
226#define FLECS_SYSTEM
227#define FLECS_STATS
228#define FLECS_TIMER
229#define FLECS_UNITS
230#endif // ifndef FLECS_CUSTOM_BUILD
231
235// #define FLECS_LOW_FOOTPRINT
236#ifdef FLECS_LOW_FOOTPRINT
237#define FLECS_HI_COMPONENT_ID 16
238#define FLECS_HI_ID_RECORD_ID 16
239#define FLECS_ENTITY_PAGE_BITS 6
240#define FLECS_USE_OS_ALLOC
241#define FLECS_DEFAULT_TO_UNCACHED_QUERIES
242#endif
243
258#ifndef FLECS_HI_COMPONENT_ID
259#define FLECS_HI_COMPONENT_ID 256
260#endif
261
268#ifndef FLECS_HI_ID_RECORD_ID
269#define FLECS_HI_ID_RECORD_ID 1024
270#endif
271
277#ifndef FLECS_SPARSE_PAGE_BITS
278#define FLECS_SPARSE_PAGE_BITS 6
279#endif
280
283#ifndef FLECS_ENTITY_PAGE_BITS
284#define FLECS_ENTITY_PAGE_BITS 10
285#endif
286
291// #define FLECS_USE_OS_ALLOC
292
295#ifndef FLECS_ID_DESC_MAX
296#define FLECS_ID_DESC_MAX 32
297#endif
298
301#ifndef FLECS_EVENT_DESC_MAX
302#define FLECS_EVENT_DESC_MAX 8
303#endif
304
307#define FLECS_VARIABLE_COUNT_MAX 64
308
311#ifndef FLECS_TERM_COUNT_MAX
312#define FLECS_TERM_COUNT_MAX 32
313#endif
314
317#ifndef FLECS_TERM_ARG_COUNT_MAX
318#define FLECS_TERM_ARG_COUNT_MAX 16
319#endif
320
323#ifndef FLECS_QUERY_VARIABLE_COUNT_MAX
324#define FLECS_QUERY_VARIABLE_COUNT_MAX 64
325#endif
326
329#ifndef FLECS_QUERY_SCOPE_NESTING_MAX
330#define FLECS_QUERY_SCOPE_NESTING_MAX 8
331#endif
332
337#ifndef FLECS_DAG_DEPTH_MAX
338#define FLECS_DAG_DEPTH_MAX 128
339#endif
340
343#include "flecs/private/api_defines.h"
344
354typedef uint64_t ecs_id_t;
355
362
378typedef struct {
380 int32_t count;
381} ecs_type_t;
382
406
409
412
414typedef struct ecs_term_t ecs_term_t;
415
418
437
442
447typedef struct ecs_iter_t ecs_iter_t;
448
457typedef struct ecs_ref_t ecs_ref_t;
458
463
468
471
474
494typedef void ecs_poly_t;
495
498
505
506typedef struct ecs_table_record_t ecs_table_record_t;
507
510#include "flecs/datastructures/vec.h" /* Vector datatype */
511#include "flecs/datastructures/sparse.h" /* Sparse set */
512#include "flecs/datastructures/block_allocator.h" /* Block allocator */
513#include "flecs/datastructures/stack_allocator.h" /* Stack allocator */
514#include "flecs/datastructures/map.h" /* Map */
515#include "flecs/datastructures/allocator.h" /* Allocator */
516#include "flecs/datastructures/strbuf.h" /* String builder */
517#include "flecs/os_api.h" /* Abstraction for operating system functions */
518
519#ifdef __cplusplus
520extern "C" {
521#endif
522
547typedef void (*ecs_run_action_t)(
548 ecs_iter_t *it);
549
556typedef void (*ecs_iter_action_t)(
557 ecs_iter_t *it);
558
567 ecs_iter_t *it);
568
575 ecs_iter_t *it);
576
579 ecs_entity_t e1,
580 const void *ptr1,
581 ecs_entity_t e2,
582 const void *ptr2);
583
586 ecs_world_t* world,
587 ecs_table_t* table,
588 ecs_entity_t* entities,
589 void* ptr,
590 int32_t size,
591 int32_t lo,
592 int32_t hi,
593 ecs_order_by_action_t order_by);
594
596typedef uint64_t (*ecs_group_by_action_t)(
597 ecs_world_t *world,
598 ecs_table_t *table,
599 ecs_id_t group_id,
600 void *ctx);
601
603typedef void* (*ecs_group_create_action_t)(
604 ecs_world_t *world,
605 uint64_t group_id,
606 void *group_by_ctx); /* from ecs_query_desc_t */
607
610 ecs_world_t *world,
611 uint64_t group_id,
612 void *group_ctx, /* return value from ecs_group_create_action_t */
613 void *group_by_ctx); /* from ecs_query_desc_t */
614
616typedef void (*ecs_module_action_t)(
617 ecs_world_t *world);
618
620typedef void (*ecs_fini_action_t)(
621 ecs_world_t *world,
622 void *ctx);
623
625typedef void (*ecs_ctx_free_t)(
626 void *ctx);
627
629typedef int (*ecs_compare_action_t)(
630 const void *ptr1,
631 const void *ptr2);
632
634typedef uint64_t (*ecs_hash_value_action_t)(
635 const void *ptr);
636
638typedef void (*ecs_xtor_t)(
639 void *ptr,
640 int32_t count,
641 const ecs_type_info_t *type_info);
642
644typedef void (*ecs_copy_t)(
645 void *dst_ptr,
646 const void *src_ptr,
647 int32_t count,
648 const ecs_type_info_t *type_info);
649
651typedef void (*ecs_move_t)(
652 void *dst_ptr,
653 void *src_ptr,
654 int32_t count,
655 const ecs_type_info_t *type_info);
656
658typedef int (*ecs_cmp_t)(
659 const void *a_ptr,
660 const void *b_ptr,
661 const ecs_type_info_t *type_info);
662
664typedef bool (*ecs_equals_t)(
665 const void *a_ptr,
666 const void *b_ptr,
667 const ecs_type_info_t *type_info);
668
670typedef void (*flecs_poly_dtor_t)(
671 ecs_poly_t *poly);
672
691
702
710
711/* Term id flags */
712
717#define EcsSelf (1llu << 63)
718
723#define EcsUp (1llu << 62)
724
729#define EcsTrav (1llu << 61)
730
735#define EcsCascade (1llu << 60)
736
741#define EcsDesc (1llu << 59)
742
747#define EcsIsVariable (1llu << 58)
748
753#define EcsIsEntity (1llu << 57)
754
759#define EcsIsName (1llu << 56)
760
765#define EcsTraverseFlags (EcsSelf|EcsUp|EcsTrav|EcsCascade|EcsDesc)
766
771#define EcsTermRefFlags (EcsTraverseFlags|EcsIsVariable|EcsIsEntity|EcsIsName)
772
787
809
817 int32_t *sizes;
820 uint64_t bloom_filter;
821 ecs_flags32_t flags;
822 int8_t var_count;
823 int8_t term_count;
824 int8_t field_count;
826 /* Bitmasks for quick field information lookups */
827 ecs_termset_t fixed_fields;
828 ecs_termset_t var_fields;
829 ecs_termset_t static_id_fields;
830 ecs_termset_t data_fields;
831 ecs_termset_t write_fields;
832 ecs_termset_t read_fields;
833 ecs_termset_t row_fields;
835 ecs_termset_t set_fields;
839 char **vars;
841 void *ctx;
848 int32_t eval_count;
849};
850
879
887/* Flags that can be used to check which hooks a type has set */
888#define ECS_TYPE_HOOK_CTOR ECS_CAST(ecs_flags32_t, 1 << 0)
889#define ECS_TYPE_HOOK_DTOR ECS_CAST(ecs_flags32_t, 1 << 1)
890#define ECS_TYPE_HOOK_COPY ECS_CAST(ecs_flags32_t, 1 << 2)
891#define ECS_TYPE_HOOK_MOVE ECS_CAST(ecs_flags32_t, 1 << 3)
892#define ECS_TYPE_HOOK_COPY_CTOR ECS_CAST(ecs_flags32_t, 1 << 4)
893#define ECS_TYPE_HOOK_MOVE_CTOR ECS_CAST(ecs_flags32_t, 1 << 5)
894#define ECS_TYPE_HOOK_CTOR_MOVE_DTOR ECS_CAST(ecs_flags32_t, 1 << 6)
895#define ECS_TYPE_HOOK_MOVE_DTOR ECS_CAST(ecs_flags32_t, 1 << 7)
896#define ECS_TYPE_HOOK_CMP ECS_CAST(ecs_flags32_t, 1 << 8)
897#define ECS_TYPE_HOOK_EQUALS ECS_CAST(ecs_flags32_t, 1 << 9)
898
899
900/* Flags that can be used to set/check which hooks of a type are invalid */
901#define ECS_TYPE_HOOK_CTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 10)
902#define ECS_TYPE_HOOK_DTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 12)
903#define ECS_TYPE_HOOK_COPY_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 13)
904#define ECS_TYPE_HOOK_MOVE_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 14)
905#define ECS_TYPE_HOOK_COPY_CTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 15)
906#define ECS_TYPE_HOOK_MOVE_CTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 16)
907#define ECS_TYPE_HOOK_CTOR_MOVE_DTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 17)
908#define ECS_TYPE_HOOK_MOVE_DTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 18)
909#define ECS_TYPE_HOOK_CMP_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 19)
910#define ECS_TYPE_HOOK_EQUALS_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 20)
911
912
913/* All valid hook flags */
914#define ECS_TYPE_HOOKS (ECS_TYPE_HOOK_CTOR|ECS_TYPE_HOOK_DTOR|\
915 ECS_TYPE_HOOK_COPY|ECS_TYPE_HOOK_MOVE|ECS_TYPE_HOOK_COPY_CTOR|\
916 ECS_TYPE_HOOK_MOVE_CTOR|ECS_TYPE_HOOK_CTOR_MOVE_DTOR|\
917 ECS_TYPE_HOOK_MOVE_DTOR|ECS_TYPE_HOOK_CMP|ECS_TYPE_HOOK_EQUALS)
918
919/* All invalid hook flags */
920#define ECS_TYPE_HOOKS_ILLEGAL (ECS_TYPE_HOOK_CTOR_ILLEGAL|\
921 ECS_TYPE_HOOK_DTOR_ILLEGAL|ECS_TYPE_HOOK_COPY_ILLEGAL|\
922 ECS_TYPE_HOOK_MOVE_ILLEGAL|ECS_TYPE_HOOK_COPY_CTOR_ILLEGAL|\
923 ECS_TYPE_HOOK_MOVE_CTOR_ILLEGAL|ECS_TYPE_HOOK_CTOR_MOVE_DTOR_ILLEGAL|\
924 ECS_TYPE_HOOK_MOVE_DTOR_ILLEGAL|ECS_TYPE_HOOK_CMP_ILLEGAL|\
925 ECS_TYPE_HOOK_EQUALS_ILLEGAL)
990
1002
1003#include "flecs/private/api_types.h" /* Supporting API types */
1004#include "flecs/private/api_support.h" /* Supporting API functions */
1005#include "flecs/datastructures/hashmap.h" /* Hashmap */
1006#include "flecs/private/api_internals.h" /* Supporting API functions */
1007
1013
1018typedef struct ecs_entity_desc_t {
1019 int32_t _canary;
1025 const char *name;
1030 const char *sep;
1034 const char *root_sep;
1036 const char *symbol;
1052
1055
1057 const char *add_expr;
1059
1089
1103
1143 /* World */
1147 /* Matched data */
1148 int32_t offset;
1149 int32_t count;
1151 void **ptrs;
1152 const ecs_table_record_t **trs;
1153 const ecs_size_t *sizes;
1158 ecs_flags64_t constrained_vars;
1159 ecs_termset_t set_fields;
1160 ecs_termset_t ref_fields;
1161 ecs_termset_t row_fields;
1162 ecs_termset_t up_fields;
1164 /* Input information */
1168 int32_t event_cur;
1170 /* Query information */
1172 int8_t term_index;
1177 /* Context */
1178 void *param;
1179 void *ctx;
1182 void *run_ctx;
1184 /* Time */
1188 /* Iterator counters */
1191 /* Misc */
1192 ecs_flags32_t flags;
1194 ecs_iter_private_t priv_;
1196 /* Chained iterators */
1201};
1202
1203
1208#define EcsQueryMatchPrefab (1u << 1u)
1209
1214#define EcsQueryMatchDisabled (1u << 2u)
1215
1220#define EcsQueryMatchEmptyTables (1u << 3u)
1221
1226#define EcsQueryAllowUnresolvedByName (1u << 6u)
1227
1232#define EcsQueryTableOnly (1u << 7u)
1233
1244#define EcsQueryDetectChanges (1u << 8u)
1245
1246
1320
1376
1381typedef struct ecs_event_desc_t {
1384
1389
1392
1396
1398 int32_t offset;
1399
1403 int32_t count;
1404
1407
1412 void *param;
1413
1417 const void *const_param;
1418
1421
1423 ecs_flags32_t flags;
1425
1426
1435typedef struct ecs_build_info_t {
1436 const char *compiler;
1437 const char **addons;
1438 const char **flags;
1439 const char *version;
1443 bool debug;
1447
1509
1512 uint64_t id;
1513 int32_t match_count;
1514 int32_t table_count;
1515 void *ctx;
1517
1528typedef struct EcsIdentifier {
1529 char *value;
1530 ecs_size_t length;
1531 uint64_t hash;
1532 uint64_t index_hash;
1533 ecs_hashmap_t *index;
1535
1537typedef struct EcsComponent {
1538 ecs_size_t size;
1539 ecs_size_t alignment;
1541
1546
1555
1559/* Only include deprecated definitions if deprecated addon is required */
1560#ifdef FLECS_DEPRECATED
1562#endif
1563
1579FLECS_API extern const ecs_id_t ECS_PAIR;
1580
1582FLECS_API extern const ecs_id_t ECS_AUTO_OVERRIDE;
1583
1585FLECS_API extern const ecs_id_t ECS_TOGGLE;
1586
1594/* Builtin component ids */
1595
1597FLECS_API extern const ecs_entity_t ecs_id(EcsComponent);
1598
1600FLECS_API extern const ecs_entity_t ecs_id(EcsIdentifier);
1601
1603FLECS_API extern const ecs_entity_t ecs_id(EcsPoly);
1604
1606FLECS_API extern const ecs_entity_t ecs_id(EcsDefaultChildComponent);
1607
1609FLECS_API extern const ecs_entity_t EcsQuery;
1610
1612FLECS_API extern const ecs_entity_t EcsObserver;
1613
1615FLECS_API extern const ecs_entity_t EcsSystem;
1616
1618FLECS_API extern const ecs_entity_t ecs_id(EcsTickSource);
1619
1621FLECS_API extern const ecs_entity_t ecs_id(EcsPipelineQuery);
1622
1624FLECS_API extern const ecs_entity_t ecs_id(EcsTimer);
1625
1627FLECS_API extern const ecs_entity_t ecs_id(EcsRateFilter);
1628
1630FLECS_API extern const ecs_entity_t EcsFlecs;
1631
1633FLECS_API extern const ecs_entity_t EcsFlecsCore;
1634
1636FLECS_API extern const ecs_entity_t EcsWorld;
1637
1639FLECS_API extern const ecs_entity_t EcsWildcard;
1640
1642FLECS_API extern const ecs_entity_t EcsAny;
1643
1645FLECS_API extern const ecs_entity_t EcsThis;
1646
1648FLECS_API extern const ecs_entity_t EcsVariable;
1649
1657FLECS_API extern const ecs_entity_t EcsTransitive;
1658
1666FLECS_API extern const ecs_entity_t EcsReflexive;
1667
1678FLECS_API extern const ecs_entity_t EcsFinal;
1679
1685FLECS_API extern const ecs_entity_t EcsInheritable;
1686
1688FLECS_API extern const ecs_entity_t EcsOnInstantiate;
1689
1693FLECS_API extern const ecs_entity_t EcsOverride;
1694
1698FLECS_API extern const ecs_entity_t EcsInherit;
1699
1704FLECS_API extern const ecs_entity_t EcsDontInherit;
1705
1713FLECS_API extern const ecs_entity_t EcsSymmetric;
1714
1724FLECS_API extern const ecs_entity_t EcsExclusive;
1725
1727FLECS_API extern const ecs_entity_t EcsAcyclic;
1728
1731FLECS_API extern const ecs_entity_t EcsTraversable;
1732
1742FLECS_API extern const ecs_entity_t EcsWith;
1743
1753FLECS_API extern const ecs_entity_t EcsOneOf;
1754
1756FLECS_API extern const ecs_entity_t EcsCanToggle;
1757
1761FLECS_API extern const ecs_entity_t EcsTrait;
1762
1772FLECS_API extern const ecs_entity_t EcsRelationship;
1773
1783FLECS_API extern const ecs_entity_t EcsTarget;
1784
1787FLECS_API extern const ecs_entity_t EcsPairIsTag;
1788
1790FLECS_API extern const ecs_entity_t EcsName;
1791
1793FLECS_API extern const ecs_entity_t EcsSymbol;
1794
1796FLECS_API extern const ecs_entity_t EcsAlias;
1797
1799FLECS_API extern const ecs_entity_t EcsChildOf;
1800
1802FLECS_API extern const ecs_entity_t EcsIsA;
1803
1805FLECS_API extern const ecs_entity_t EcsDependsOn;
1806
1808FLECS_API extern const ecs_entity_t EcsSlotOf;
1809
1811FLECS_API extern const ecs_entity_t EcsOrderedChildren;
1812
1814FLECS_API extern const ecs_entity_t EcsModule;
1815
1817FLECS_API extern const ecs_entity_t EcsPrivate;
1818
1821FLECS_API extern const ecs_entity_t EcsPrefab;
1822
1825FLECS_API extern const ecs_entity_t EcsDisabled;
1826
1830FLECS_API extern const ecs_entity_t EcsNotQueryable;
1831
1833FLECS_API extern const ecs_entity_t EcsOnAdd;
1834
1836FLECS_API extern const ecs_entity_t EcsOnRemove;
1837
1839FLECS_API extern const ecs_entity_t EcsOnSet;
1840
1842FLECS_API extern const ecs_entity_t EcsMonitor;
1843
1845FLECS_API extern const ecs_entity_t EcsOnTableCreate;
1846
1848FLECS_API extern const ecs_entity_t EcsOnTableDelete;
1849
1851FLECS_API extern const ecs_entity_t EcsOnDelete;
1852
1855FLECS_API extern const ecs_entity_t EcsOnDeleteTarget;
1856
1859FLECS_API extern const ecs_entity_t EcsRemove;
1860
1863FLECS_API extern const ecs_entity_t EcsDelete;
1864
1867FLECS_API extern const ecs_entity_t EcsPanic;
1868
1871FLECS_API extern const ecs_entity_t EcsSingleton;
1872
1874FLECS_API extern const ecs_entity_t EcsSparse;
1875
1877FLECS_API extern const ecs_entity_t EcsDontFragment;
1878
1880FLECS_API extern const ecs_entity_t EcsPredEq;
1881
1883FLECS_API extern const ecs_entity_t EcsPredMatch;
1884
1886FLECS_API extern const ecs_entity_t EcsPredLookup;
1887
1889FLECS_API extern const ecs_entity_t EcsScopeOpen;
1890
1892FLECS_API extern const ecs_entity_t EcsScopeClose;
1893
1898FLECS_API extern const ecs_entity_t EcsEmpty;
1899
1900FLECS_API extern const ecs_entity_t ecs_id(EcsPipeline);
1901FLECS_API extern const ecs_entity_t EcsOnStart;
1902FLECS_API extern const ecs_entity_t EcsPreFrame;
1903FLECS_API extern const ecs_entity_t EcsOnLoad;
1904FLECS_API extern const ecs_entity_t EcsPostLoad;
1905FLECS_API extern const ecs_entity_t EcsPreUpdate;
1906FLECS_API extern const ecs_entity_t EcsOnUpdate;
1907FLECS_API extern const ecs_entity_t EcsOnValidate;
1908FLECS_API extern const ecs_entity_t EcsPostUpdate;
1909FLECS_API extern const ecs_entity_t EcsPreStore;
1910FLECS_API extern const ecs_entity_t EcsOnStore;
1911FLECS_API extern const ecs_entity_t EcsPostFrame;
1912FLECS_API extern const ecs_entity_t EcsPhase;
1914FLECS_API extern const ecs_entity_t EcsConstant;
1918#define EcsLastInternalComponentId (ecs_id(EcsPoly))
1919
1922#define EcsFirstUserComponentId (8)
1923
1926#define EcsFirstUserEntityId (FLECS_HI_COMPONENT_ID + 128)
1927
1928/* When visualized the reserved id ranges look like this:
1929 * - [1..8]: Builtin components
1930 * - [9..FLECS_HI_COMPONENT_ID]: Low ids reserved for application components
1931 * - [FLECS_HI_COMPONENT_ID + 1..EcsFirstUserEntityId]: Builtin entities
1932 */
1933
1955FLECS_API
1957
1964FLECS_API
1966
1974FLECS_API
1976 int argc,
1977 char *argv[]);
1978
1985FLECS_API
1987 ecs_world_t *world);
1988
1996FLECS_API
1998 const ecs_world_t *world);
1999
2007FLECS_API
2009 ecs_world_t *world,
2010 ecs_fini_action_t action,
2011 void *ctx);
2012
2019
2046FLECS_API
2048 const ecs_world_t *world);
2049
2057FLECS_API
2059 const ecs_world_t *world);
2060
2086FLECS_API
2088 ecs_world_t *world,
2089 ecs_ftime_t delta_time);
2090
2097FLECS_API
2099 ecs_world_t *world);
2100
2108FLECS_API
2110 ecs_world_t *world,
2111 ecs_fini_action_t action,
2112 void *ctx);
2113
2120FLECS_API
2122 ecs_world_t *world);
2123
2130FLECS_API
2132 const ecs_world_t *world);
2133
2146 ecs_world_t *world,
2147 bool enable);
2148
2160 ecs_world_t *world,
2161 bool enable);
2162
2178FLECS_API
2180 ecs_world_t *world,
2181 ecs_ftime_t fps);
2182
2196FLECS_API
2198 ecs_world_t *world,
2199 ecs_flags32_t flags);
2200
2277FLECS_API
2279 ecs_world_t *world,
2280 bool multi_threaded);
2281
2289FLECS_API
2291 ecs_world_t *world);
2292
2298FLECS_API
2300 ecs_world_t *stage);
2301
2317FLECS_API
2319 ecs_world_t *world);
2320
2331FLECS_API
2333 const ecs_world_t *world);
2334
2348FLECS_API
2350 ecs_world_t *world);
2351
2366FLECS_API
2368 ecs_world_t *world);
2369
2380FLECS_API
2382 ecs_world_t *world);
2383
2397FLECS_API
2399 ecs_world_t *world,
2400 int32_t stages);
2401
2408FLECS_API
2410 const ecs_world_t *world);
2411
2427FLECS_API
2429 const ecs_world_t *world,
2430 int32_t stage_id);
2431
2439FLECS_API
2441 const ecs_world_t *world);
2442
2450FLECS_API
2452 ecs_world_t *world);
2453
2458FLECS_API
2460 ecs_world_t *stage);
2461
2469FLECS_API
2471 const ecs_world_t *world);
2472
2488FLECS_API
2490 ecs_world_t *world,
2491 void *ctx,
2492 ecs_ctx_free_t ctx_free);
2493
2502FLECS_API
2504 ecs_world_t *world,
2505 void *ctx,
2506 ecs_ctx_free_t ctx_free);
2507
2515FLECS_API
2517 const ecs_world_t *world);
2518
2526FLECS_API
2528 const ecs_world_t *world);
2529
2535FLECS_API
2537
2543FLECS_API
2545 const ecs_world_t *world);
2546
2555FLECS_API
2557 ecs_world_t *world,
2558 int32_t entity_count);
2559
2574FLECS_API
2576 ecs_world_t *world);
2577
2593FLECS_API
2595 ecs_world_t *world,
2596 ecs_entity_t id_start,
2597 ecs_entity_t id_end);
2598
2609FLECS_API
2611 ecs_world_t *world,
2612 bool enable);
2613
2619FLECS_API
2621 const ecs_world_t *world);
2622
2636FLECS_API
2638 ecs_world_t *world,
2639 ecs_flags32_t flags);
2640
2652
2682FLECS_API
2684 ecs_world_t *world,
2685 const ecs_delete_empty_tables_desc_t *desc);
2686
2692FLECS_API
2694 const ecs_poly_t *poly);
2695
2701FLECS_API
2703 const ecs_poly_t *poly);
2704
2718FLECS_API
2720 const ecs_poly_t *object,
2721 int32_t type);
2722
2726#define flecs_poly_is(object, type)\
2727 flecs_poly_is_(object, type##_magic)
2728
2737FLECS_API
2739 ecs_entity_t first,
2740 ecs_entity_t second);
2741
2764FLECS_API
2766 ecs_world_t *world,
2767 const char *thread_name);
2768
2791FLECS_API
2793 ecs_world_t *world,
2794 bool lock_world);
2795
2822FLECS_API
2824 ecs_world_t *world);
2825
2843FLECS_API
2845 ecs_world_t *world);
2846
2855FLECS_API
2857 ecs_world_t *world,
2858 ecs_id_t component);
2859
2867FLECS_API
2869 ecs_world_t *world,
2870 ecs_table_t *table);
2871
2890FLECS_API
2892 ecs_world_t *world,
2893 const ecs_entity_desc_t *desc);
2894
2921FLECS_API
2923 ecs_world_t *world,
2924 const ecs_bulk_desc_t *desc);
2925
2935FLECS_API
2937 ecs_world_t *world,
2938 ecs_id_t component,
2939 int32_t count);
2940
2956FLECS_API
2958 ecs_world_t *world,
2959 ecs_entity_t dst,
2960 ecs_entity_t src,
2961 bool copy_value);
2962
2971FLECS_API
2973 ecs_world_t *world,
2974 ecs_entity_t entity);
2975
2983FLECS_API
2985 ecs_world_t *world,
2986 ecs_id_t component);
2987
3005FLECS_API
3007 ecs_world_t *world,
3008 ecs_entity_t parent,
3009 const ecs_entity_t *children,
3010 int32_t child_count);
3011
3021FLECS_API
3023 const ecs_world_t *world,
3024 ecs_entity_t parent);
3025
3043FLECS_API
3045 ecs_world_t *world,
3046 ecs_entity_t entity,
3047 ecs_id_t component);
3048
3057FLECS_API
3059 ecs_world_t *world,
3060 ecs_entity_t entity,
3061 ecs_id_t component);
3062
3114FLECS_API
3116 ecs_world_t *world,
3117 ecs_entity_t entity,
3118 ecs_id_t component);
3119
3126FLECS_API
3128 ecs_world_t *world,
3129 ecs_entity_t entity);
3130
3138FLECS_API
3140 ecs_world_t *world,
3141 ecs_id_t component);
3142
3157FLECS_API
3159 ecs_world_t *world,
3160 ecs_id_t component);
3161
3169FLECS_API
3171 const ecs_world_t *world);
3172
3191FLECS_API
3193 ecs_world_t *world,
3194 ecs_entity_t entity,
3195 bool enabled);
3196
3210FLECS_API
3212 ecs_world_t *world,
3213 ecs_entity_t entity,
3214 ecs_id_t component,
3215 bool enable);
3216
3227FLECS_API
3229 const ecs_world_t *world,
3230 ecs_entity_t entity,
3231 ecs_id_t component);
3232
3256FLECS_API
3257FLECS_ALWAYS_INLINE const void* ecs_get_id(
3258 const ecs_world_t *world,
3259 ecs_entity_t entity,
3260 ecs_id_t component);
3261
3276FLECS_API
3277FLECS_ALWAYS_INLINE void* ecs_get_mut_id(
3278 const ecs_world_t *world,
3279 ecs_entity_t entity,
3280 ecs_id_t component);
3281
3298FLECS_API
3300 ecs_world_t *world,
3301 ecs_entity_t entity,
3302 ecs_id_t component,
3303 size_t size);
3304
3315FLECS_ALWAYS_INLINE FLECS_API
3317 const ecs_world_t *world,
3318 ecs_entity_t entity,
3319 ecs_id_t component);
3320
3331FLECS_ALWAYS_INLINE FLECS_API
3333 const ecs_world_t *world,
3334 ecs_ref_t *ref,
3335 ecs_id_t component);
3336
3344FLECS_ALWAYS_INLINE FLECS_API
3346 const ecs_world_t *world,
3347 ecs_ref_t *ref);
3348
3369FLECS_API
3371 ecs_world_t *world,
3372 ecs_entity_t entity,
3373 ecs_id_t component,
3374 size_t size,
3375 bool *is_new);
3376
3386FLECS_API
3388 ecs_world_t *world,
3389 ecs_entity_t entity,
3390 ecs_id_t component);
3391
3407FLECS_API
3409 ecs_world_t *world,
3410 ecs_entity_t entity,
3411 ecs_id_t component,
3412 size_t size,
3413 const void *ptr);
3414
3443FLECS_API
3445 const ecs_world_t *world,
3446 ecs_entity_t e);
3447
3477FLECS_API
3479 const ecs_world_t *world,
3480 ecs_entity_t e);
3481
3487FLECS_API
3489 ecs_entity_t e);
3490
3507FLECS_API
3509 const ecs_world_t *world,
3510 ecs_entity_t e);
3511
3534FLECS_API
3536 ecs_world_t *world,
3537 ecs_entity_t entity);
3538
3557FLECS_API
3559 ecs_world_t *world,
3560 ecs_id_t component);
3561
3569FLECS_API
3571 const ecs_world_t *world,
3572 ecs_entity_t entity);
3573
3588FLECS_API
3590 ecs_world_t *world,
3591 ecs_entity_t entity);
3592
3608FLECS_API
3610 const ecs_world_t *world,
3611 ecs_entity_t entity);
3612
3619FLECS_API
3621 const ecs_world_t *world,
3622 ecs_entity_t entity);
3623
3631FLECS_API
3633 const ecs_world_t *world,
3634 const ecs_type_t* type);
3635
3647FLECS_API
3649 const ecs_world_t *world,
3650 const ecs_table_t *table);
3651
3666FLECS_API
3668 const ecs_world_t *world,
3669 ecs_entity_t entity);
3670
3681FLECS_API
3682FLECS_ALWAYS_INLINE bool ecs_has_id(
3683 const ecs_world_t *world,
3684 ecs_entity_t entity,
3685 ecs_id_t component);
3686
3697FLECS_API
3698FLECS_ALWAYS_INLINE bool ecs_owns_id(
3699 const ecs_world_t *world,
3700 ecs_entity_t entity,
3701 ecs_id_t component);
3702
3717FLECS_API
3719 const ecs_world_t *world,
3720 ecs_entity_t entity,
3721 ecs_entity_t rel,
3722 int32_t index);
3723
3737FLECS_API
3739 const ecs_world_t *world,
3740 ecs_entity_t entity);
3741
3762FLECS_API
3764 const ecs_world_t *world,
3765 ecs_entity_t entity,
3766 ecs_entity_t rel,
3767 ecs_id_t component);
3768
3779FLECS_API
3781 const ecs_world_t *world,
3782 ecs_entity_t entity,
3783 ecs_entity_t rel);
3784
3792FLECS_API
3794 const ecs_world_t *world,
3795 ecs_id_t entity);
3796
3816FLECS_API
3817const char* ecs_get_name(
3818 const ecs_world_t *world,
3819 ecs_entity_t entity);
3820
3830FLECS_API
3831const char* ecs_get_symbol(
3832 const ecs_world_t *world,
3833 ecs_entity_t entity);
3834
3848FLECS_API
3850 ecs_world_t *world,
3851 ecs_entity_t entity,
3852 const char *name);
3853
3867FLECS_API
3869 ecs_world_t *world,
3870 ecs_entity_t entity,
3871 const char *symbol);
3872
3884FLECS_API
3886 ecs_world_t *world,
3887 ecs_entity_t entity,
3888 const char *alias);
3889
3905FLECS_API
3907 const ecs_world_t *world,
3908 const char *path);
3909
3924FLECS_API
3926 const ecs_world_t *world,
3927 ecs_entity_t parent,
3928 const char *name);
3929
3952FLECS_API
3954 const ecs_world_t *world,
3955 ecs_entity_t parent,
3956 const char *path,
3957 const char *sep,
3958 const char *prefix,
3959 bool recursive);
3960
3978FLECS_API
3980 const ecs_world_t *world,
3981 const char *symbol,
3982 bool lookup_as_path,
3983 bool recursive);
3984
4006FLECS_API
4008 const ecs_world_t *world,
4009 ecs_entity_t parent,
4010 ecs_entity_t child,
4011 const char *sep,
4012 const char *prefix);
4013
4026FLECS_API
4028 const ecs_world_t *world,
4029 ecs_entity_t parent,
4030 ecs_entity_t child,
4031 const char *sep,
4032 const char *prefix,
4033 ecs_strbuf_t *buf,
4034 bool escape);
4035
4051FLECS_API
4053 ecs_world_t *world,
4054 ecs_entity_t parent,
4055 const char *path,
4056 const char *sep,
4057 const char *prefix);
4058
4073FLECS_API
4075 ecs_world_t *world,
4076 ecs_entity_t entity,
4077 ecs_entity_t parent,
4078 const char *path,
4079 const char *sep,
4080 const char *prefix);
4081
4095FLECS_API
4097 ecs_world_t *world,
4098 ecs_entity_t scope);
4099
4107FLECS_API
4109 const ecs_world_t *world);
4110
4120FLECS_API
4122 ecs_world_t *world,
4123 const char *prefix);
4124
4151FLECS_API
4153 ecs_world_t *world,
4154 const ecs_entity_t *lookup_path);
4155
4162FLECS_API
4164 const ecs_world_t *world);
4165
4190FLECS_API
4192 ecs_world_t *world,
4193 const ecs_component_desc_t *desc);
4194
4204FLECS_API
4206 const ecs_world_t *world,
4207 ecs_id_t component);
4208
4220FLECS_API
4222 ecs_world_t *world,
4223 ecs_entity_t component,
4224 const ecs_type_hooks_t *hooks);
4225
4232FLECS_API
4234 const ecs_world_t *world,
4235 ecs_entity_t component);
4236
4260FLECS_API
4262 const ecs_world_t *world,
4263 ecs_id_t component);
4264
4273FLECS_API
4275 const ecs_world_t *world,
4276 ecs_id_t component);
4277
4297FLECS_API
4299 const ecs_world_t *world,
4300 ecs_id_t component);
4301
4310FLECS_API
4312 ecs_id_t component,
4313 ecs_id_t pattern);
4314
4320FLECS_API
4322 ecs_id_t component);
4323
4329FLECS_API
4331 ecs_id_t component);
4332
4339 ecs_id_t component);
4340
4354FLECS_API
4356 const ecs_world_t *world,
4357 ecs_id_t component);
4358
4367FLECS_API
4368ecs_flags32_t ecs_id_get_flags(
4369 const ecs_world_t *world,
4370 ecs_id_t component);
4371
4382FLECS_API
4384 ecs_id_t component_flags);
4385
4401FLECS_API
4403 const ecs_world_t *world,
4404 ecs_id_t component);
4405
4413FLECS_API
4415 const ecs_world_t *world,
4416 ecs_id_t component,
4417 ecs_strbuf_t *buf);
4418
4426FLECS_API
4428 const ecs_world_t *world,
4429 const char *expr);
4430
4446FLECS_API
4448 const ecs_term_ref_t *ref);
4449
4461FLECS_API
4463 const ecs_term_t *term);
4464
4479FLECS_API
4481 const ecs_term_t *term);
4482
4495FLECS_API
4497 const ecs_term_t *term);
4498
4507FLECS_API
4509 const ecs_world_t *world,
4510 const ecs_term_t *term);
4511
4519FLECS_API
4521 const ecs_query_t *query);
4522
4563FLECS_API
4565 const ecs_world_t *world,
4566 ecs_id_t component);
4567
4573FLECS_API
4575 ecs_iter_t *it);
4576
4593FLECS_API
4595 const ecs_world_t *world,
4596 ecs_entity_t parent);
4597
4603FLECS_API
4605 ecs_iter_t *it);
4606
4622FLECS_API
4624 ecs_world_t *world,
4625 const ecs_query_desc_t *desc);
4626
4631FLECS_API
4633 ecs_query_t *query);
4634
4643FLECS_API
4645 const ecs_query_t *query,
4646 const char *name);
4647
4655FLECS_API
4657 const ecs_query_t *query,
4658 int32_t var_id);
4659
4670FLECS_API
4672 const ecs_query_t *query,
4673 int32_t var_id);
4674
4743FLECS_API
4745 const ecs_world_t *world,
4746 const ecs_query_t *query);
4747
4755FLECS_API
4757 ecs_iter_t *it);
4758
4777FLECS_API
4779 ecs_query_t *query,
4780 ecs_entity_t entity,
4781 ecs_iter_t *it);
4782
4801FLECS_API
4803 ecs_query_t *query,
4804 ecs_table_t *table,
4805 ecs_iter_t *it);
4806
4833FLECS_API
4835 ecs_query_t *query,
4836 ecs_table_range_t *range,
4837 ecs_iter_t *it);
4838
4846FLECS_API
4848 const ecs_query_t *query);
4849
4859FLECS_API
4861 const ecs_query_t *query);
4862
4877FLECS_API
4879 const ecs_query_t *query,
4880 const ecs_iter_t *it);
4881
4899FLECS_API
4901 ecs_query_t *query,
4902 ecs_iter_t *it,
4903 const char *expr);
4904
4932FLECS_API
4934 ecs_query_t *query);
4935
4944FLECS_API
4946 const ecs_world_t *world,
4947 ecs_entity_t query);
4948
4959FLECS_API
4961 ecs_iter_t *it);
4962
4985FLECS_API
4987 ecs_iter_t *it,
4988 uint64_t group_id);
4989
4998FLECS_API
5000 const ecs_query_t *query,
5001 uint64_t group_id);
5002
5011FLECS_API
5013 const ecs_query_t *query,
5014 uint64_t group_id);
5015
5024
5031FLECS_API
5033 const ecs_query_t *query);
5034
5040FLECS_API
5042 const ecs_query_t *query);
5043
5052FLECS_API
5054 const ecs_query_t *query);
5055
5084FLECS_API
5086 ecs_world_t *world,
5087 ecs_event_desc_t *desc);
5088
5099FLECS_API
5101 ecs_world_t *world,
5102 ecs_event_desc_t *desc);
5103
5114FLECS_API
5116 ecs_world_t *world,
5117 const ecs_observer_desc_t *desc);
5118
5127FLECS_API
5129 const ecs_world_t *world,
5130 ecs_entity_t observer);
5131
5154FLECS_API
5156 ecs_iter_t *it);
5157
5167FLECS_API
5169 ecs_iter_t *it);
5170
5182FLECS_API
5184 ecs_iter_t *it);
5185
5198FLECS_API
5200 ecs_iter_t *it);
5201
5209FLECS_API
5211 ecs_iter_t *it);
5212
5251FLECS_API
5253 ecs_iter_t *it,
5254 int32_t var_id,
5255 ecs_entity_t entity);
5256
5267FLECS_API
5269 ecs_iter_t *it,
5270 int32_t var_id,
5271 const ecs_table_t *table);
5272
5283FLECS_API
5285 ecs_iter_t *it,
5286 int32_t var_id,
5287 const ecs_table_range_t *range);
5288
5301FLECS_API
5303 ecs_iter_t *it,
5304 int32_t var_id);
5305
5312FLECS_API
5314 const ecs_iter_t *it,
5315 int32_t var_id);
5316
5322FLECS_API
5324 const ecs_iter_t *it);
5325
5331FLECS_API
5333 const ecs_iter_t *it);
5334
5348FLECS_API
5350 ecs_iter_t *it,
5351 int32_t var_id);
5352
5366FLECS_API
5368 ecs_iter_t *it,
5369 int32_t var_id);
5370
5382FLECS_API
5384 ecs_iter_t *it,
5385 int32_t var_id);
5386
5398FLECS_API
5400 const ecs_iter_t *it);
5401
5413FLECS_API
5415 ecs_iter_t *it);
5416
5428FLECS_API
5430 const ecs_iter_t *it);
5431
5447FLECS_API
5449 const ecs_iter_t *it,
5450 int32_t offset,
5451 int32_t limit);
5452
5459FLECS_API
5461 ecs_iter_t *it);
5462
5483FLECS_API
5485 const ecs_iter_t *it,
5486 int32_t index,
5487 int32_t count);
5488
5495FLECS_API
5497 ecs_iter_t *it);
5498
5540FLECS_API
5542 const ecs_iter_t *it,
5543 size_t size,
5544 int8_t index);
5545
5567FLECS_API
5569 const ecs_iter_t *it,
5570 size_t size,
5571 int8_t index,
5572 int32_t row);
5573
5582FLECS_API
5584 const ecs_iter_t *it,
5585 int8_t index);
5586
5597FLECS_API
5599 const ecs_iter_t *it,
5600 int8_t index);
5601
5608FLECS_API
5610 const ecs_iter_t *it,
5611 int8_t index);
5612
5619FLECS_API
5621 const ecs_iter_t *it,
5622 int8_t index);
5623
5632FLECS_API
5634 const ecs_iter_t *it,
5635 int8_t index);
5636
5644FLECS_API
5646 const ecs_iter_t *it,
5647 int8_t index);
5648
5656FLECS_API
5658 const ecs_iter_t *it,
5659 int8_t index);
5660
5674FLECS_API
5676 const ecs_iter_t *it,
5677 int8_t index);
5678
5694FLECS_API
5696 const ecs_table_t *table);
5697
5708FLECS_API
5710 const ecs_world_t *world,
5711 const ecs_table_t *table,
5712 ecs_id_t component);
5713
5723FLECS_API
5725 const ecs_world_t *world,
5726 const ecs_table_t *table,
5727 ecs_id_t component);
5728
5736FLECS_API
5738 const ecs_table_t *table);
5739
5753FLECS_API
5755 const ecs_table_t *table,
5756 int32_t index);
5757
5766FLECS_API
5768 const ecs_table_t *table,
5769 int32_t index);
5770
5779FLECS_API
5781 const ecs_table_t *table,
5782 int32_t index,
5783 int32_t offset);
5784
5794FLECS_API
5796 const ecs_world_t *world,
5797 const ecs_table_t *table,
5798 ecs_id_t component,
5799 int32_t offset);
5800
5808FLECS_API
5810 const ecs_table_t *table,
5811 int32_t index);
5812
5819FLECS_API
5821 const ecs_table_t *table);
5822
5830FLECS_API
5832 const ecs_table_t *table);
5833
5840FLECS_API
5842 const ecs_table_t *table);
5843
5854FLECS_API
5856 const ecs_world_t *world,
5857 const ecs_table_t *table,
5858 ecs_id_t component);
5859
5870FLECS_API
5872 const ecs_world_t *world,
5873 const ecs_table_t *table,
5874 ecs_entity_t rel);
5875
5885FLECS_API
5887 ecs_world_t *world,
5888 ecs_table_t *table,
5889 ecs_id_t component);
5890
5901FLECS_API
5903 ecs_world_t *world,
5904 const ecs_id_t *ids,
5905 int32_t id_count);
5906
5916FLECS_API
5918 ecs_world_t *world,
5919 ecs_table_t *table,
5920 ecs_id_t component);
5921
5937FLECS_API
5939 ecs_world_t *world,
5940 ecs_table_t *table);
5941
5948FLECS_API
5950 ecs_world_t *world,
5951 ecs_table_t *table);
5952
5962FLECS_API
5964 ecs_table_t *table,
5965 ecs_flags32_t flags);
5966
5974FLECS_API
5976 const ecs_table_t *table);
5977
5985FLECS_API
5987 ecs_world_t* world,
5988 ecs_table_t* table,
5989 int32_t row_1,
5990 int32_t row_2);
5991
6014FLECS_API
6016 ecs_world_t *world,
6017 ecs_entity_t entity,
6018 ecs_record_t *record,
6019 ecs_table_t *table,
6020 const ecs_type_t *added,
6021 const ecs_type_t *removed);
6022
6023
6043FLECS_API
6045 const ecs_world_t *world,
6046 const ecs_table_t *table,
6047 ecs_id_t component,
6048 ecs_id_t *component_out);
6049
6085FLECS_API
6087 const ecs_world_t *world,
6088 const ecs_table_t *table,
6089 int32_t offset,
6090 ecs_id_t component,
6091 ecs_id_t *component_out);
6092
6134FLECS_API
6136 const ecs_world_t *world,
6137 const ecs_table_t *table,
6138 int32_t offset,
6139 ecs_id_t component,
6140 ecs_entity_t rel,
6141 ecs_flags64_t flags, /* EcsSelf and/or EcsUp */
6142 ecs_entity_t *subject_out,
6143 ecs_id_t *component_out,
6144 struct ecs_table_record_t **tr_out);
6145
6153FLECS_API
6155 ecs_world_t* world,
6156 ecs_table_t* table);
6157
6174FLECS_API
6176 const ecs_world_t *world,
6177 ecs_entity_t type,
6178 void *ptr);
6179
6187FLECS_API
6189 const ecs_world_t *world,
6190 const ecs_type_info_t *ti,
6191 void *ptr);
6192
6199FLECS_API
6201 ecs_world_t *world,
6202 ecs_entity_t type);
6203
6211 ecs_world_t *world,
6212 const ecs_type_info_t *ti);
6213
6222 const ecs_world_t *world,
6223 const ecs_type_info_t *ti,
6224 void *ptr);
6225
6233FLECS_API
6235 const ecs_world_t *world,
6236 ecs_entity_t type,
6237 void* ptr);
6238
6246FLECS_API
6248 ecs_world_t *world,
6249 ecs_entity_t type,
6250 void* ptr);
6251
6260FLECS_API
6262 const ecs_world_t *world,
6263 const ecs_type_info_t *ti,
6264 void* dst,
6265 const void *src);
6266
6275FLECS_API
6277 const ecs_world_t *world,
6278 ecs_entity_t type,
6279 void* dst,
6280 const void *src);
6281
6291 const ecs_world_t *world,
6292 const ecs_type_info_t *ti,
6293 void* dst,
6294 void *src);
6295
6305 const ecs_world_t *world,
6306 ecs_entity_t type,
6307 void* dst,
6308 void *src);
6309
6319 const ecs_world_t *world,
6320 const ecs_type_info_t *ti,
6321 void* dst,
6322 void *src);
6323
6333 const ecs_world_t *world,
6334 ecs_entity_t type,
6335 void* dst,
6336 void *src);
6337
6351#include "flecs/addons/flecs_c.h"
6352
6353#ifdef __cplusplus
6354}
6355#endif
6356
6357#include "flecs/private/addons.h"
6358
6359#endif
The deprecated addon contains deprecated operations.
Extends the core API with convenience macros for C applications.
void ecs_remove_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Remove a component from an entity.
void ecs_auto_override_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Add auto override for component.
void ecs_remove_all(ecs_world_t *world, ecs_id_t component)
Remove all instances of the specified component.
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 component set with ecs_set_with().
void ecs_add_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Add a (component) id to an entity.
ecs_entity_t ecs_set_with(ecs_world_t *world, ecs_id_t component)
Create new entities with specified component.
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 EcsSingleton
Mark component as singleton.
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 *stage)
Merge 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.
const ecs_type_hooks_t * ecs_get_hooks_id(const ecs_world_t *world, ecs_entity_t component)
Get hooks for component.
ecs_entity_t ecs_component_init(ecs_world_t *world, const ecs_component_desc_t *desc)
Find or create a component.
const ecs_type_info_t * ecs_get_type_info(const ecs_world_t *world, ecs_id_t component)
Get the type info for an component.
struct ecs_component_desc_t ecs_component_desc_t
Used with ecs_component_init().
void ecs_set_hooks_id(ecs_world_t *world, ecs_entity_t component, const ecs_type_hooks_t *hooks)
Register 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:473
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:408
struct ecs_ref_t ecs_ref_t
A ref is a fast way to fetch a component for a specific entity.
Definition flecs.h:457
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:361
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition flecs.h:405
struct ecs_mixins_t ecs_mixins_t
Type that stores poly mixins.
Definition flecs.h:497
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
Definition flecs.h:354
struct ecs_observable_t ecs_observable_t
An observable produces events that can be listened for by an observer.
Definition flecs.h:441
struct ecs_record_t ecs_record_t
Information about an entity, like its table and row.
Definition flecs.h:470
struct ecs_table_t ecs_table_t
A table stores entities and components for a specific type.
Definition flecs.h:411
void ecs_poly_t
A poly object.
Definition flecs.h:494
ecs_entity_t ecs_new_low_id(ecs_world_t *world)
Create new low 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.
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(ecs_world_t *world, ecs_entity_t entity)
Delete an entity.
void ecs_delete_with(ecs_world_t *world, ecs_id_t component)
Delete all entities with the specified component.
ecs_entity_t ecs_new_w_id(ecs_world_t *world, ecs_id_t component)
Create new entity with (component) id.
ecs_entity_t ecs_new_w_table(ecs_world_t *world, ecs_table_t *table)
Create new entity in table.
const ecs_entity_t * ecs_bulk_new_w_id(ecs_world_t *world, ecs_id_t component, int32_t count)
Create N new entities.
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().
ecs_iter_t ecs_each_id(const ecs_world_t *world, ecs_id_t component)
Iterate all entities with specified (component id).
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.
void ecs_enable_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t component, bool enable)
Enable or disable component.
bool ecs_is_enabled_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Test if component is enabled.
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.
ecs_entity_t ecs_get_target_for_id(const ecs_world_t *world, ecs_entity_t entity, ecs_entity_t rel, ecs_id_t component)
Get the target of a relationship for a given component.
const ecs_type_t * ecs_get_type(const ecs_world_t *world, ecs_entity_t entity)
Get the type of an entity.
bool ecs_owns_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Test if an entity owns a component.
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.
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_table_t * ecs_get_table(const ecs_world_t *world, ecs_entity_t entity)
Get the table of an entity.
bool ecs_has_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Test if an entity has a component.
void(* ecs_module_action_t)(ecs_world_t *world)
Initialization action for modules.
Definition flecs.h:616
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:596
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:658
uint64_t(* ecs_hash_value_action_t)(const void *ptr)
Callback used for hashing values.
Definition flecs.h:634
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:609
void(* ecs_iter_fini_action_t)(ecs_iter_t *it)
Function prototype for freeing an iterator.
Definition flecs.h:574
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:603
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:585
bool(* ecs_iter_next_action_t)(ecs_iter_t *it)
Function prototype for iterating an iterator.
Definition flecs.h:566
void(* ecs_iter_action_t)(ecs_iter_t *it)
Function prototype for iterables.
Definition flecs.h:556
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:644
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:664
int(* ecs_compare_action_t)(const void *ptr1, const void *ptr2)
Callback used for sorting values.
Definition flecs.h:629
void(* ecs_fini_action_t)(ecs_world_t *world, void *ctx)
Action callback on world exit.
Definition flecs.h:620
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:651
void(* flecs_poly_dtor_t)(ecs_poly_t *poly)
Destructor function for poly objects.
Definition flecs.h:670
void(* ecs_run_action_t)(ecs_iter_t *it)
Function prototype for runnables (systems, observers).
Definition flecs.h:547
void(* ecs_ctx_free_t)(void *ctx)
Function to cleanup context data.
Definition flecs.h:625
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:578
void(* ecs_xtor_t)(void *ptr, int32_t count, const ecs_type_info_t *type_info)
Constructor/destructor callback.
Definition flecs.h:638
void * ecs_ref_get_id(const ecs_world_t *world, ecs_ref_t *ref, ecs_id_t component)
Get component from ref.
void * ecs_emplace_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t component, size_t size, bool *is_new)
Emplace a component.
void ecs_ref_update(const ecs_world_t *world, ecs_ref_t *ref)
Update ref.
const void * ecs_get_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Get an immutable pointer to a component.
void ecs_modified_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Signal that a component has been modified.
ecs_ref_t ecs_ref_init_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Create a component ref.
void * ecs_get_mut_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Get a mutable pointer to a component.
void * ecs_ensure_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t component, size_t size)
Ensure entity has component, return pointer.
void ecs_set_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t component, size_t size, const void *ptr)
Set the value of a component.
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.
char * ecs_id_str(const ecs_world_t *world, ecs_id_t component)
Convert component id to string.
bool ecs_id_is_tag(const ecs_world_t *world, ecs_id_t component)
Returns whether specified component is a tag.
ecs_flags32_t ecs_id_get_flags(const ecs_world_t *world, ecs_id_t component)
Get flags associated with id.
bool ecs_id_is_valid(const ecs_world_t *world, ecs_id_t component)
Utility to check if id is valid.
const char * ecs_id_flag_str(ecs_id_t component_flags)
Convert component flag to string.
bool ecs_id_in_use(const ecs_world_t *world, ecs_id_t component)
Returns whether specified component is in use.
bool ecs_id_match(ecs_id_t component, ecs_id_t pattern)
Utility to match a component with a pattern.
void ecs_id_str_buf(const ecs_world_t *world, ecs_id_t component, ecs_strbuf_t *buf)
Write component string to buffer.
bool ecs_id_is_pair(ecs_id_t component)
Utility to check if component is a pair.
ecs_entity_t ecs_get_typeid(const ecs_world_t *world, ecs_id_t component)
Get the type for a component.
ecs_id_t ecs_id_from_str(const ecs_world_t *world, const char *expr)
Convert string to a component.
bool ecs_id_is_wildcard(ecs_id_t component)
Utility to check if component is a wildcard.
bool ecs_id_is_any(ecs_id_t component)
Utility to check if component is an any wildcard.
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.
void ecs_make_alive_id(ecs_world_t *world, ecs_id_t component)
Same as ecs_make_alive(), but for components.
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.
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:302
#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:296
#define FLECS_TERM_COUNT_MAX
Maximum number of terms in queries.
Definition flecs.h:312
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_is_initialized(const ecs_term_t *term)
Test whether a term is set.
bool ecs_term_ref_is_set(const ecs_term_ref_t *ref)
Test whether term ref 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:704
ecs_inout_kind_t
Specify read/write access for term.
Definition flecs.h:683
ecs_oper_kind_t
Specify operator for term.
Definition flecs.h:693
@ EcsQueryCacheAll
Require that all query terms can be cached.
Definition flecs.h:707
@ EcsQueryCacheDefault
Behavior determined by query creation context.
Definition flecs.h:705
@ EcsQueryCacheNone
No caching.
Definition flecs.h:708
@ EcsQueryCacheAuto
Cache query terms that are cacheable.
Definition flecs.h:706
@ EcsOut
Term is only written.
Definition flecs.h:689
@ EcsInOut
Term is both read and written.
Definition flecs.h:687
@ EcsInOutFilter
Same as InOutNone + prevents term from triggering observers.
Definition flecs.h:686
@ EcsInOutDefault
InOut for regular terms, In for shared terms.
Definition flecs.h:684
@ EcsInOutNone
Term is neither read nor written.
Definition flecs.h:685
@ EcsIn
Term is only read.
Definition flecs.h:688
@ EcsNot
The term must not match.
Definition flecs.h:696
@ EcsOptional
The term may match.
Definition flecs.h:697
@ EcsOr
One of the terms in an or chain must match.
Definition flecs.h:695
@ EcsOrFrom
Term must match at least one component from term id.
Definition flecs.h:699
@ EcsAnd
The term must match.
Definition flecs.h:694
@ EcsNotFrom
Term must match none of the components from term id.
Definition flecs.h:700
@ EcsAndFrom
Term must match all components from term id.
Definition flecs.h:698
ecs_table_t * ecs_table_add_id(ecs_world_t *world, ecs_table_t *table, ecs_id_t component)
Get table that has all components of current table plus the specified id.
int32_t ecs_search_offset(const ecs_world_t *world, const ecs_table_t *table, int32_t offset, ecs_id_t component, ecs_id_t *component_out)
Search for component in table type starting from an offset.
ecs_table_t * ecs_table_remove_id(ecs_world_t *world, ecs_table_t *table, ecs_id_t component)
Get table that has all components of current table minus the specified component.
const ecs_type_t * ecs_table_get_type(const ecs_table_t *table)
Get type for table.
int32_t ecs_table_get_column_index(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t component)
Get column index for component.
void * ecs_table_get_id(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t component, int32_t offset)
Get column from table by component.
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.
int32_t ecs_search(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t component, ecs_id_t *component_out)
Search for component in table type.
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.
int32_t ecs_search_relation(const ecs_world_t *world, const ecs_table_t *table, int32_t offset, ecs_id_t component, ecs_entity_t rel, ecs_flags64_t flags, ecs_entity_t *subject_out, ecs_id_t *component_out, struct ecs_table_record_t **tr_out)
Search for component/relationship id in table type starting from an offset.
bool ecs_table_has_id(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t component)
Test if table has component.
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.
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.
size_t ecs_table_get_column_size(const ecs_table_t *table, int32_t index)
Get column size from table.
int32_t ecs_table_get_type_index(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t component)
Get type index for component.
void ecs_table_clear_entities(ecs_world_t *world, ecs_table_t *table)
Remove all entities in a table.
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:1537
ecs_size_t size
Component size.
Definition flecs.h:1538
ecs_size_t alignment
Component alignment.
Definition flecs.h:1539
When added to an entity this informs serialization formats which component to use when a value is ass...
Definition flecs.h:1552
ecs_id_t component
Default component id.
Definition flecs.h:1553
A (string) identifier.
Definition flecs.h:1528
ecs_size_t length
Length of identifier.
Definition flecs.h:1530
char * value
Identifier string.
Definition flecs.h:1529
ecs_hashmap_t * index
Current index.
Definition flecs.h:1533
uint64_t hash
Hash of current value.
Definition flecs.h:1531
uint64_t index_hash
Hash of existing record in current index.
Definition flecs.h:1532
Component for storing a poly object.
Definition flecs.h:1543
ecs_poly_t * poly
Pointer to poly object.
Definition flecs.h:1544
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:1435
const char ** flags
Compile time settings.
Definition flecs.h:1438
int16_t version_major
Major flecs version.
Definition flecs.h:1440
const char ** addons
Addons included in build.
Definition flecs.h:1437
const char * version
Stringified version.
Definition flecs.h:1439
const char * compiler
Compiler used to compile flecs.
Definition flecs.h:1436
bool sanitize
Is this a sanitize build.
Definition flecs.h:1444
bool perf_trace
Is this a perf tracing build.
Definition flecs.h:1445
int16_t version_minor
Minor flecs version.
Definition flecs.h:1441
bool debug
Is this a debug build.
Definition flecs.h:1443
int16_t version_patch
Patch flecs version.
Definition flecs.h:1442
Used with ecs_bulk_init().
Definition flecs.h:1064
ecs_id_t ids[32]
Ids to create the entities with.
Definition flecs.h:1074
void ** data
Array with component data to insert.
Definition flecs.h:1076
int32_t count
Number of entities to create/populate.
Definition flecs.h:1072
int32_t _canary
Used for validity testing.
Definition flecs.h:1065
ecs_entity_t * entities
Entities to bulk insert.
Definition flecs.h:1067
ecs_table_t * table
Table to insert the entities into.
Definition flecs.h:1083
Used with ecs_component_init().
Definition flecs.h:1094
int32_t _canary
Used for validity testing.
Definition flecs.h:1095
ecs_type_info_t type
Parameters for type (size, hooks, ...)
Definition flecs.h:1101
ecs_entity_t entity
Existing entity to associate with observer (optional)
Definition flecs.h:1098
Used with ecs_delete_empty_tables().
Definition flecs.h:2642
uint16_t delete_generation
Delete table when generation > delete_generation.
Definition flecs.h:2647
double time_budget_seconds
Amount of time operation is allowed to spend.
Definition flecs.h:2650
uint16_t clear_generation
Free table data when generation > clear_generation.
Definition flecs.h:2644
Type returned by ecs_get_entities().
Definition flecs.h:2014
int32_t alive_count
Number of alive entity ids.
Definition flecs.h:2017
int32_t count
Total number of entity ids.
Definition flecs.h:2016
const ecs_entity_t * ids
Array with all entity ids in the world.
Definition flecs.h:2015
Used with ecs_entity_init().
Definition flecs.h:1018
const char * sep
Optional custom separator for hierarchical names.
Definition flecs.h:1030
const char * root_sep
Optional, used for identifiers relative to root.
Definition flecs.h:1034
const char * name
Name of the entity.
Definition flecs.h:1025
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:1046
const char * symbol
Optional entity symbol.
Definition flecs.h:1036
int32_t _canary
Used for validity testing.
Definition flecs.h:1019
const ecs_id_t * add
0-terminated array of ids to add to the entity.
Definition flecs.h:1051
const char * add_expr
String expression with components to add.
Definition flecs.h:1057
const ecs_value_t * set
0-terminated array of values to set on the entity.
Definition flecs.h:1054
ecs_entity_t id
Set to modify existing entity (optional)
Definition flecs.h:1021
ecs_entity_t parent
Parent entity.
Definition flecs.h:1023
Used with ecs_emit().
Definition flecs.h:1381
ecs_entity_t entity
Single-entity alternative to setting table / offset / count.
Definition flecs.h:1406
const void * const_param
Same as param, but with the guarantee that the value won't be modified.
Definition flecs.h:1417
ecs_table_t * table
The table for which to notify.
Definition flecs.h:1391
int32_t count
Limit number of notified entities to count.
Definition flecs.h:1403
ecs_table_t * other_table
Optional 2nd table to notify.
Definition flecs.h:1395
int32_t offset
Limit notified entities to ones starting from offset (row) in table.
Definition flecs.h:1398
const ecs_type_t * ids
Component ids.
Definition flecs.h:1388
ecs_poly_t * observable
Observable (usually the world)
Definition flecs.h:1420
ecs_entity_t event
The event id.
Definition flecs.h:1383
ecs_flags32_t flags
Event flags.
Definition flecs.h:1423
void * param
Optional context.
Definition flecs.h:1412
Header for ecs_poly_t objects.
Definition flecs.h:500
int32_t type
Magic number indicating which type of flecs object.
Definition flecs.h:501
int32_t refcount
Refcount, to enable RAII handles.
Definition flecs.h:502
ecs_mixins_t * mixins
Table with offsets to (optional) mixins.
Definition flecs.h:503
Iterator.
Definition flecs.h:1142
ecs_world_t * real_world
Actual world.
Definition flecs.h:1145
void * param
Param passed to ecs_run.
Definition flecs.h:1178
ecs_entity_t event
The event (if applicable)
Definition flecs.h:1166
int32_t frame_offset
Offset relative to start of iteration.
Definition flecs.h:1189
ecs_flags32_t ref_fields
Bitset with fields that aren't component arrays.
Definition flecs.h:1160
ecs_entity_t interrupted_by
When set, system execution is interrupted.
Definition flecs.h:1193
ecs_flags32_t flags
Iterator flags.
Definition flecs.h:1192
ecs_iter_t * chain_it
Optional, allows for creating iterator chains.
Definition flecs.h:1200
void * ctx
System context.
Definition flecs.h:1179
void * run_ctx
Run language binding context.
Definition flecs.h:1182
ecs_table_t * table
Current table.
Definition flecs.h:1154
int32_t offset
Offset relative to current table.
Definition flecs.h:1148
ecs_id_t event_id
The (component) id for the event.
Definition flecs.h:1167
ecs_iter_fini_action_t fini
Function to cleanup iterator resources.
Definition flecs.h:1199
ecs_iter_private_t priv_
Private data.
Definition flecs.h:1194
ecs_world_t * world
The world.
Definition flecs.h:1144
void * callback_ctx
Callback language binding context.
Definition flecs.h:1181
ecs_entity_t * sources
Entity on which the id was matched (0 if same as entities)
Definition flecs.h:1157
void * binding_ctx
System binding context.
Definition flecs.h:1180
ecs_flags32_t row_fields
Fields that must be obtained with field_at.
Definition flecs.h:1161
float delta_system_time
Time elapsed since last system invocation.
Definition flecs.h:1186
const ecs_query_t * query
Query being evaluated.
Definition flecs.h:1175
int8_t term_index
Index of term that emitted an event.
Definition flecs.h:1172
ecs_entity_t system
The system (if applicable)
Definition flecs.h:1165
ecs_flags32_t set_fields
Fields that are set.
Definition flecs.h:1159
const ecs_size_t * sizes
Component sizes.
Definition flecs.h:1153
float delta_time
Time elapsed since last frame.
Definition flecs.h:1185
ecs_flags32_t up_fields
Bitset with fields matched through up traversal.
Definition flecs.h:1162
ecs_iter_action_t callback
Callback of system or observer.
Definition flecs.h:1198
int8_t field_count
Number of fields in iterator.
Definition flecs.h:1171
ecs_table_t * other_table
Prev or next table when adding/removing.
Definition flecs.h:1155
int32_t event_cur
Unique event id.
Definition flecs.h:1168
const ecs_table_record_t ** trs
Info on where to find field in table.
Definition flecs.h:1152
int32_t count
Number of entities to iterate.
Definition flecs.h:1149
void ** ptrs
Component pointers.
Definition flecs.h:1151
ecs_iter_next_action_t next
Function to progress iterator.
Definition flecs.h:1197
const ecs_entity_t * entities
Entity identifiers.
Definition flecs.h:1150
ecs_id_t * ids
(Component) ids
Definition flecs.h:1156
ecs_flags64_t constrained_vars
Bitset that marks constrained variables.
Definition flecs.h:1158
Used with ecs_observer_init().
Definition flecs.h:1325
ecs_ctx_free_t run_ctx_free
Callback to free run ctx.
Definition flecs.h:1369
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:1357
void * run_ctx
Context associated with run (for language bindings).
Definition flecs.h:1366
ecs_entity_t entity
Existing entity to associate with observer (optional)
Definition flecs.h:1330
int32_t * last_event_id
Used for internal purposes.
Definition flecs.h:1372
void * callback_ctx
Context associated with callback (for language bindings).
Definition flecs.h:1360
void * ctx
User context to pass to callback.
Definition flecs.h:1354
ecs_query_desc_t query
Query for observer.
Definition flecs.h:1333
ecs_ctx_free_t callback_ctx_free
Callback to free callback ctx.
Definition flecs.h:1363
ecs_iter_action_t callback
Callback to invoke on an event, invoked when the observer matches.
Definition flecs.h:1343
bool yield_existing
When observer is created, generate events from existing data.
Definition flecs.h:1340
ecs_run_action_t run
Callback invoked on an event.
Definition flecs.h:1351
ecs_entity_t events[8]
Events to observe (OnAdd, OnRemove, OnSet)
Definition flecs.h:1336
int32_t _canary
Used for validity testing.
Definition flecs.h:1327
An observer reacts to events matching a query.
Definition flecs.h:854
int32_t event_count
Number of events.
Definition flecs.h:861
ecs_iter_action_t callback
See ecs_observer_desc_t::callback.
Definition flecs.h:863
ecs_entity_t entity
Entity associated with observer.
Definition flecs.h:877
ecs_observable_t * observable
Observable for observer.
Definition flecs.h:874
ecs_run_action_t run
See ecs_observer_desc_t::run.
Definition flecs.h:864
ecs_header_t hdr
Object header.
Definition flecs.h:855
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:870
ecs_entity_t events[8]
Observer events.
Definition flecs.h:860
void * run_ctx
Run language binding context.
Definition flecs.h:868
ecs_world_t * world
The world.
Definition flecs.h:876
ecs_ctx_free_t run_ctx_free
Callback to free run_ctx.
Definition flecs.h:872
void * callback_ctx
Callback language binding context.
Definition flecs.h:867
void * ctx
Observer context.
Definition flecs.h:866
ecs_ctx_free_t callback_ctx_free
Callback to free callback_ctx.
Definition flecs.h:871
ecs_query_t * query
Observer query.
Definition flecs.h:857
Struct returned by ecs_query_count().
Definition flecs.h:5017
int32_t entities
Number of entities returned by query.
Definition flecs.h:5019
int32_t results
Number of results returned by query.
Definition flecs.h:5018
int32_t tables
Number of tables returned by query.
Definition flecs.h:5020
Used with ecs_query_init().
Definition flecs.h:1251
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:1312
ecs_id_t group_by
Component id to be used for grouping.
Definition flecs.h:1282
ecs_term_t terms[32]
Query terms.
Definition flecs.h:1256
int32_t _canary
Used for validity testing.
Definition flecs.h:1253
void * ctx
User context to pass to callback.
Definition flecs.h:1306
ecs_ctx_free_t group_by_ctx_free
Function to free group_by_ctx.
Definition flecs.h:1303
void * group_by_ctx
Context to pass to group_by.
Definition flecs.h:1300
void * binding_ctx
Context to be used for language bindings.
Definition flecs.h:1309
ecs_entity_t order_by
Component to sort on, used together with order_by_callback or order_by_table_callback.
Definition flecs.h:1278
ecs_order_by_action_t order_by_callback
Callback used for ordering query results.
Definition flecs.h:1270
ecs_group_create_action_t on_group_create
Callback that is invoked when a new group is created.
Definition flecs.h:1293
ecs_entity_t entity
Entity associated with query (optional)
Definition flecs.h:1318
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:1315
ecs_group_by_action_t group_by_callback
Callback used for grouping results.
Definition flecs.h:1289
ecs_group_delete_action_t on_group_delete
Callback that is invoked when an existing group is deleted.
Definition flecs.h:1297
ecs_sort_table_action_t order_by_table_callback
Callback used for ordering query results.
Definition flecs.h:1274
ecs_flags32_t flags
Flags for enabling query features.
Definition flecs.h:1265
ecs_query_cache_kind_t cache_kind
Caching policy of query.
Definition flecs.h:1262
const char * expr
Query DSL expression (optional)
Definition flecs.h:1259
Type that contains information about a query group.
Definition flecs.h:1511
int32_t table_count
Number of tables in group.
Definition flecs.h:1514
void * ctx
Group context, returned by on_group_create.
Definition flecs.h:1515
int32_t match_count
How often tables have been matched/unmatched.
Definition flecs.h:1513
Queries are lists of constraints (terms) that match entities.
Definition flecs.h:813
ecs_flags32_t row_fields
Fields that must be acquired with field_at.
Definition flecs.h:833
ecs_flags32_t data_fields
Fields that have data.
Definition flecs.h:830
ecs_flags32_t read_fields
Fields that read data.
Definition flecs.h:832
ecs_header_t hdr
Object header.
Definition flecs.h:814
int8_t var_count
Number of query variables.
Definition flecs.h:822
ecs_flags32_t fixed_fields
Fields with a fixed source.
Definition flecs.h:827
ecs_flags32_t var_fields
Fields with non-$this variable source.
Definition flecs.h:828
ecs_flags32_t write_fields
Fields that write data.
Definition flecs.h:831
int32_t eval_count
Number of times query is evaluated.
Definition flecs.h:848
ecs_world_t * world
World or stage query was created with.
Definition flecs.h:846
ecs_flags32_t static_id_fields
Fields with a static (component) id.
Definition flecs.h:829
uint64_t bloom_filter
Bitmask used to quickly discard tables.
Definition flecs.h:820
ecs_world_t * real_world
Actual world.
Definition flecs.h:845
ecs_flags32_t set_fields
Fields that will be set.
Definition flecs.h:835
ecs_entity_t entity
Entity associated with query (optional)
Definition flecs.h:844
void * ctx
User context to pass to callback.
Definition flecs.h:841
int32_t * sizes
Component sizes.
Definition flecs.h:817
ecs_id_t * ids
Component ids.
Definition flecs.h:818
ecs_flags32_t shared_readonly_fields
Fields that don't write shared data.
Definition flecs.h:834
ecs_term_t * terms
Query terms.
Definition flecs.h:816
ecs_query_cache_kind_t cache_kind
Caching policy of query.
Definition flecs.h:837
int8_t term_count
Number of query terms.
Definition flecs.h:823
char ** vars
Array with variable names for iterator.
Definition flecs.h:839
int8_t field_count
Number of fields returned by query.
Definition flecs.h:824
ecs_flags32_t flags
Query flags.
Definition flecs.h:821
void * binding_ctx
Context to be used for language bindings.
Definition flecs.h:842
Type that describes a reference to an entity or variable in a term.
Definition flecs.h:774
const char * name
Name.
Definition flecs.h:781
ecs_entity_t id
Entity id.
Definition flecs.h:775
Type that describes a term (single element in a query).
Definition flecs.h:789
ecs_term_ref_t src
Source of term.
Definition flecs.h:795
int8_t field_index
Index of field for term in iterator.
Definition flecs.h:806
ecs_id_t id
Component id to be matched by term.
Definition flecs.h:790
int16_t oper
Operator of term.
Definition flecs.h:804
ecs_term_ref_t second
Second element of pair.
Definition flecs.h:797
ecs_flags16_t flags_
Flags that help eval, set by ecs_query_init()
Definition flecs.h:807
ecs_entity_t trav
Relationship to traverse when looking for the component.
Definition flecs.h:799
int16_t inout
Access to contents matched by term.
Definition flecs.h:803
ecs_term_ref_t first
Component or first element of pair.
Definition flecs.h:796
ecs_copy_t copy_ctor
Ctor + copy.
Definition flecs.h:933
void * lifecycle_ctx
Component lifecycle context (see meta add-on)
Definition flecs.h:984
void * ctx
User defined context.
Definition flecs.h:982
ecs_iter_action_t on_remove
Callback that is invoked when an instance of the component is removed.
Definition flecs.h:974
void * binding_ctx
Language binding context.
Definition flecs.h:983
ecs_move_t move_dtor
Move + dtor.
Definition flecs.h:948
ecs_flags32_t flags
Hook flags.
Definition flecs.h:960
ecs_cmp_t cmp
Compare hook.
Definition flecs.h:951
ecs_copy_t copy
copy assignment
Definition flecs.h:929
ecs_ctx_free_t lifecycle_ctx_free
Callback to free lifecycle_ctx.
Definition flecs.h:988
ecs_iter_action_t on_set
Callback that is invoked when an instance of the component is set.
Definition flecs.h:969
ecs_move_t move
move assignment
Definition flecs.h:930
ecs_xtor_t ctor
ctor
Definition flecs.h:927
ecs_iter_action_t on_replace
Callback that is invoked with the existing and new value before the value is assigned.
Definition flecs.h:980
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:986
ecs_iter_action_t on_add
Callback that is invoked when an instance of a component is added.
Definition flecs.h:964
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:987
ecs_move_t move_ctor
Ctor + move.
Definition flecs.h:936
ecs_equals_t equals
Equals hook.
Definition flecs.h:954
ecs_move_t ctor_move_dtor
Ctor + move + dtor (or move_ctor + dtor).
Definition flecs.h:942
ecs_xtor_t dtor
dtor
Definition flecs.h:928
Type that contains component information (passed to ctors/dtors/...)
Definition flecs.h:995
ecs_size_t alignment
Alignment of type.
Definition flecs.h:997
ecs_size_t size
Size of type.
Definition flecs.h:996
const char * name
Type name.
Definition flecs.h:1000
ecs_entity_t component
Handle to component (do not set)
Definition flecs.h:999
ecs_type_hooks_t hooks
Type hooks.
Definition flecs.h:998
A type is a list of (component) ids.
Definition flecs.h:378
ecs_id_t * array
Array with ids.
Definition flecs.h:379
int32_t count
Number of elements in array.
Definition flecs.h:380
Utility to hold a value of a dynamic type.
Definition flecs.h:1009
void * ptr
Pointer to value.
Definition flecs.h:1011
ecs_entity_t type
Type of value.
Definition flecs.h:1010
Type that contains information about the world.
Definition flecs.h:1449
int64_t observers_ran_total
Total number of times observer was invoked.
Definition flecs.h:1477
float delta_time
Time passed to or computed by ecs_progress()
Definition flecs.h:1455
ecs_entity_t min_id
First allowed entity id.
Definition flecs.h:1451
int64_t systems_ran_total
Total number of systems ran.
Definition flecs.h:1476
int64_t set_count
Set commands processed.
Definition flecs.h:1494
double world_time_total
Time elapsed in simulation.
Definition flecs.h:1463
int32_t tag_id_count
Number of tag (no data) ids in the world.
Definition flecs.h:1480
int32_t component_id_count
Number of component (data) ids in the world.
Definition flecs.h:1481
int64_t pipeline_build_count_total
Total number of pipeline builds.
Definition flecs.h:1475
int64_t eval_comp_monitors_total
Total number of monitor evaluations.
Definition flecs.h:1468
int32_t table_count
Number of tables.
Definition flecs.h:1484
float delta_time_raw
Raw delta time (no time scaling)
Definition flecs.h:1454
float frame_time_total
Total time spent processing a frame.
Definition flecs.h:1458
int64_t table_create_total
Total number of times a table was created.
Definition flecs.h:1473
float system_time_total
Total time spent in systems.
Definition flecs.h:1459
int64_t id_delete_total
Total number of times an id was deleted.
Definition flecs.h:1472
float merge_time_total
Total time spent in merges.
Definition flecs.h:1461
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:1497
int64_t clear_count
Clear commands processed.
Definition flecs.h:1493
ecs_entity_t last_component_id
Last issued component entity id.
Definition flecs.h:1450
int64_t frame_count_total
Total number of frames.
Definition flecs.h:1466
ecs_entity_t max_id
Last allowed entity id.
Definition flecs.h:1452
int64_t merge_count_total
Total number of merges.
Definition flecs.h:1467
int64_t other_count
Other commands processed.
Definition flecs.h:1499
int64_t batched_command_count
Commands batched.
Definition flecs.h:1501
int64_t table_delete_total
Total number of times a table was deleted.
Definition flecs.h:1474
int64_t queries_ran_total
Total number of times a query was evaluated.
Definition flecs.h:1478
int64_t delete_count
Delete commands processed.
Definition flecs.h:1492
int64_t rematch_count_total
Total number of rematches.
Definition flecs.h:1469
int64_t id_create_total
Total number of times a new id was created.
Definition flecs.h:1471
int64_t batched_entity_count
Entities for which commands were batched.
Definition flecs.h:1500
float time_scale
Time scale applied to delta_time.
Definition flecs.h:1456
int32_t pair_id_count
Number of pair ids in the world.
Definition flecs.h:1482
float rematch_time_total
Time spent on query rematching.
Definition flecs.h:1462
int64_t ensure_count
Ensure/emplace commands processed.
Definition flecs.h:1495
float target_fps
Target fps.
Definition flecs.h:1457
double world_time_total_raw
Time elapsed in simulation (no scaling)
Definition flecs.h:1464
float emit_time_total
Total time spent notifying observers.
Definition flecs.h:1460
uint32_t creation_time
Time when world was created.
Definition flecs.h:1486
int64_t modified_count
Modified commands processed.
Definition flecs.h:1496
const char * name_prefix
Value set by ecs_set_name_prefix().
Definition flecs.h:1504
int64_t event_count
Enqueued custom events.
Definition flecs.h:1498
int64_t add_count
Add commands processed.
Definition flecs.h:1490
int64_t remove_count
Remove commands processed.
Definition flecs.h:1491