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 0
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
65// #define FLECS_LEGACY
66
72// #define FLECS_ACCURATE_COUNTERS
73
74/* Make sure provided configuration is valid */
75#if defined(FLECS_DEBUG) && defined(FLECS_NDEBUG)
76#error "invalid configuration: cannot both define FLECS_DEBUG and FLECS_NDEBUG"
77#endif
78#if defined(FLECS_DEBUG) && defined(NDEBUG)
79#error "invalid configuration: cannot both define FLECS_DEBUG and NDEBUG"
80#endif
81
86#if !defined(FLECS_DEBUG) && !defined(FLECS_NDEBUG)
87#if defined(NDEBUG)
88#define FLECS_NDEBUG
89#else
90#define FLECS_DEBUG
91#endif
92#endif
93
98#ifdef FLECS_SANITIZE
99#ifndef FLECS_DEBUG
100#define FLECS_DEBUG /* If sanitized mode is enabled, so is debug mode */
101#endif
102#endif
103
104/* Tip: if you see weird behavior that you think might be a bug, make sure to
105 * test with the FLECS_DEBUG or FLECS_SANITIZE flags enabled. There's a good
106 * chance that this gives you more information about the issue! */
107
121// #define FLECS_SOFT_ASSERT
122
128// #define FLECS_KEEP_ASSERT
129
138// #define FLECS_CPP_NO_AUTO_REGISTRATION
139
167// #define FLECS_CUSTOM_BUILD
168
177// #define FLECS_CPP_NO_AUTO_REGISTRATION
178
179#ifndef FLECS_CUSTOM_BUILD
180// #define FLECS_C /**< C API convenience macros, always enabled */
181#define FLECS_CPP
182#define FLECS_MODULE
183#define FLECS_SCRIPT
184#define FLECS_STATS
185#define FLECS_METRICS
186#define FLECS_ALERTS
187#define FLECS_SYSTEM
188#define FLECS_PIPELINE
189#define FLECS_TIMER
190#define FLECS_META
191#define FLECS_UNITS
192#define FLECS_JSON
193#define FLECS_DOC
194#define FLECS_LOG
195#define FLECS_APP
196#define FLECS_OS_API_IMPL
197#define FLECS_HTTP
198#define FLECS_REST
199// #define FLECS_JOURNAL /**< Journaling addon (disabled by default) */
200#endif // ifndef FLECS_CUSTOM_BUILD
201
205// #define FLECS_LOW_FOOTPRINT
206#ifdef FLECS_LOW_FOOTPRINT
207#define FLECS_HI_COMPONENT_ID (16)
208#define FLECS_HI_ID_RECORD_ID (16)
209#define FLECS_SPARSE_PAGE_BITS (6)
210#define FLECS_ENTITY_PAGE_BITS (6)
211#define FLECS_USE_OS_ALLOC
212#endif
213
224#ifndef FLECS_HI_COMPONENT_ID
225#define FLECS_HI_COMPONENT_ID (256)
226#endif
227
234#ifndef FLECS_HI_ID_RECORD_ID
235#define FLECS_HI_ID_RECORD_ID (1024)
236#endif
237
243#ifndef FLECS_SPARSE_PAGE_BITS
244#define FLECS_SPARSE_PAGE_BITS (12)
245#endif
246
249#ifndef FLECS_ENTITY_PAGE_BITS
250#define FLECS_ENTITY_PAGE_BITS (12)
251#endif
252
257// #define FLECS_USE_OS_ALLOC
258
261#ifndef FLECS_ID_DESC_MAX
262#define FLECS_ID_DESC_MAX (32)
263#endif
264
267#ifndef FLECS_EVENT_DESC_MAX
268#define FLECS_EVENT_DESC_MAX (8)
269#endif
270
273#define FLECS_VARIABLE_COUNT_MAX (64)
274
277#ifndef FLECS_TERM_COUNT_MAX
278#define FLECS_TERM_COUNT_MAX 32
279#endif
280
283#ifndef FLECS_TERM_ARG_COUNT_MAX
284#define FLECS_TERM_ARG_COUNT_MAX (16)
285#endif
286
289#ifndef FLECS_QUERY_VARIABLE_COUNT_MAX
290#define FLECS_QUERY_VARIABLE_COUNT_MAX (64)
291#endif
292
295#ifndef FLECS_QUERY_SCOPE_NESTING_MAX
296#define FLECS_QUERY_SCOPE_NESTING_MAX (8)
297#endif
298
301#include "flecs/private/api_defines.h"
302#include "flecs/datastructures/vec.h" /* Vector datatype */
303#include "flecs/datastructures/sparse.h" /* Sparse set */
304#include "flecs/datastructures/block_allocator.h" /* Block allocator */
305#include "flecs/datastructures/stack_allocator.h" /* Stack allocator */
306#include "flecs/datastructures/map.h" /* Map */
307#include "flecs/datastructures/switch_list.h" /* Switch list */
308#include "flecs/datastructures/allocator.h" /* Allocator */
309#include "flecs/datastructures/strbuf.h" /* String builder */
310#include "flecs/os_api.h" /* Abstraction for operating system functions */
311
312#ifdef __cplusplus
313extern "C" {
314#endif
315
332typedef uint64_t ecs_id_t;
333
340
356typedef struct {
358 int32_t count;
359} ecs_type_t;
360
384
387
390
392typedef struct ecs_term_t ecs_term_t;
393
396
415
420
425typedef struct ecs_iter_t ecs_iter_t;
426
435typedef struct ecs_ref_t ecs_ref_t;
436
441
446
449
452
472typedef void ecs_poly_t;
473
476
484
492
494typedef struct ecs_table_cache_hdr_t {
495 struct ecs_table_cache_t *cache;
498 bool empty;
500
511
530typedef void (*ecs_run_action_t)(
531 ecs_iter_t *it);
532
539typedef void (*ecs_iter_action_t)(
540 ecs_iter_t *it);
541
550 ecs_iter_t *it);
551
558 ecs_iter_t *it);
559
562 ecs_entity_t e1,
563 const void *ptr1,
564 ecs_entity_t e2,
565 const void *ptr2);
566
569 ecs_world_t* world,
570 ecs_table_t* table,
571 ecs_entity_t* entities,
572 void* ptr,
573 int32_t size,
574 int32_t lo,
575 int32_t hi,
576 ecs_order_by_action_t order_by);
577
579typedef uint64_t (*ecs_group_by_action_t)(
580 ecs_world_t *world,
581 ecs_table_t *table,
582 ecs_id_t group_id,
583 void *ctx);
584
586typedef void* (*ecs_group_create_action_t)(
587 ecs_world_t *world,
588 uint64_t group_id,
589 void *group_by_ctx); /* from ecs_query_desc_t */
590
593 ecs_world_t *world,
594 uint64_t group_id,
595 void *group_ctx, /* return value from ecs_group_create_action_t */
596 void *group_by_ctx); /* from ecs_query_desc_t */
597
599typedef void (*ecs_module_action_t)(
600 ecs_world_t *world);
601
603typedef void (*ecs_fini_action_t)(
604 ecs_world_t *world,
605 void *ctx);
606
608typedef void (*ecs_ctx_free_t)(
609 void *ctx);
610
612typedef int (*ecs_compare_action_t)(
613 const void *ptr1,
614 const void *ptr2);
615
617typedef uint64_t (*ecs_hash_value_action_t)(
618 const void *ptr);
619
621typedef void (*ecs_xtor_t)(
622 void *ptr,
623 int32_t count,
624 const ecs_type_info_t *type_info);
625
627typedef void (*ecs_copy_t)(
628 void *dst_ptr,
629 const void *src_ptr,
630 int32_t count,
631 const ecs_type_info_t *type_info);
632
634typedef void (*ecs_move_t)(
635 void *dst_ptr,
636 void *src_ptr,
637 int32_t count,
638 const ecs_type_info_t *type_info);
639
641typedef void (*flecs_poly_dtor_t)(
642 ecs_poly_t *poly);
643
662
673
681
682/* Term id flags */
683
688#define EcsSelf (1llu << 63)
689
694#define EcsUp (1llu << 62)
695
700#define EcsTrav (1llu << 61)
701
706#define EcsCascade (1llu << 60)
707
712#define EcsDesc (1llu << 59)
713
718#define EcsIsVariable (1llu << 58)
719
724#define EcsIsEntity (1llu << 57)
725
730#define EcsIsName (1llu << 56)
731
736#define EcsTraverseFlags (EcsSelf|EcsUp|EcsTrav|EcsCascade|EcsDesc)
737
742#define EcsTermRefFlags (EcsTraverseFlags|EcsIsVariable|EcsIsEntity|EcsIsName)
743
758
780
791 ecs_flags32_t flags;
792 int8_t var_count;
793 int8_t term_count;
794 int8_t field_count;
796 /* Bitmasks for quick field information lookups */
797 ecs_termset_t fixed_fields;
798 ecs_termset_t static_id_fields;
799 ecs_termset_t data_fields;
800 ecs_termset_t write_fields;
801 ecs_termset_t read_fields;
802 ecs_termset_t row_fields;
804 ecs_termset_t set_fields;
808 char **vars;
810 void *ctx;
817 int32_t eval_count;
818};
819
848
899
911
912#include "flecs/private/api_types.h" /* Supporting API types */
913#include "flecs/private/api_support.h" /* Supporting API functions */
914#include "flecs/datastructures/hashmap.h" /* Hashmap */
915
921
926typedef struct ecs_entity_desc_t {
927 int32_t _canary;
933 const char *name;
938 const char *sep;
942 const char *root_sep;
944 const char *symbol;
959 const ecs_id_t *add;
960
963
965 const char *add_expr;
967
997
1011
1051 /* World */
1055 /* Matched data */
1057 const ecs_size_t *sizes;
1061 ecs_var_t *variables;
1064 ecs_flags64_t constrained_vars;
1065 uint64_t group_id;
1066 ecs_termset_t set_fields;
1067 ecs_termset_t ref_fields;
1068 ecs_termset_t row_fields;
1069 ecs_termset_t up_fields;
1071 /* Input information */
1075 int32_t event_cur;
1077 /* Query information */
1079 int8_t term_index;
1086 /* Context */
1087 void *param;
1088 void *ctx;
1091 void *run_ctx;
1093 /* Time */
1097 /* Iterator counters */
1099 int32_t offset;
1100 int32_t count;
1102 /* Misc */
1103 ecs_flags32_t flags;
1105 ecs_iter_private_t priv_;
1107 /* Chained iterators */
1112};
1113
1114
1119#define EcsQueryMatchPrefab (1u << 1u)
1120
1125#define EcsQueryMatchDisabled (1u << 2u)
1126
1131#define EcsQueryMatchEmptyTables (1u << 3u)
1132
1137#define EcsQueryAllowUnresolvedByName (1u << 6u)
1138
1143#define EcsQueryTableOnly (1u << 7u)
1144
1145
1219
1281
1286typedef struct ecs_event_desc_t {
1289
1294
1297
1301
1303 int32_t offset;
1304
1308 int32_t count;
1309
1312
1317 void *param;
1318
1322 const void *const_param;
1323
1326
1328 ecs_flags32_t flags;
1330
1331
1340typedef struct ecs_build_info_t {
1341 const char *compiler;
1342 const char **addons;
1343 const char *version;
1347 bool debug;
1351
1410
1417
1428typedef struct EcsIdentifier {
1429 char *value;
1430 ecs_size_t length;
1431 uint64_t hash;
1432 uint64_t index_hash;
1433 ecs_hashmap_t *index;
1435
1437typedef struct EcsComponent {
1438 ecs_size_t size;
1439 ecs_size_t alignment;
1441
1446
1455
1459/* Only include deprecated definitions if deprecated addon is required */
1460#ifdef FLECS_DEPRECATED
1462#endif
1463
1479FLECS_API extern const ecs_id_t ECS_PAIR;
1480
1482FLECS_API extern const ecs_id_t ECS_AUTO_OVERRIDE;
1483
1485FLECS_API extern const ecs_id_t ECS_TOGGLE;
1486
1494/* Builtin component ids */
1495
1497FLECS_API extern const ecs_entity_t ecs_id(EcsComponent);
1498
1500FLECS_API extern const ecs_entity_t ecs_id(EcsIdentifier);
1501
1503FLECS_API extern const ecs_entity_t ecs_id(EcsPoly);
1504
1506FLECS_API extern const ecs_entity_t ecs_id(EcsDefaultChildComponent);
1507
1509FLECS_API extern const ecs_entity_t EcsQuery;
1510
1512FLECS_API extern const ecs_entity_t EcsObserver;
1513
1515FLECS_API extern const ecs_entity_t EcsSystem;
1516
1518FLECS_API extern const ecs_entity_t ecs_id(EcsTickSource);
1519
1521FLECS_API extern const ecs_entity_t ecs_id(EcsPipelineQuery);
1522
1524FLECS_API extern const ecs_entity_t ecs_id(EcsTimer);
1525
1527FLECS_API extern const ecs_entity_t ecs_id(EcsRateFilter);
1528
1530FLECS_API extern const ecs_entity_t EcsFlecs;
1531
1533FLECS_API extern const ecs_entity_t EcsFlecsCore;
1534
1536FLECS_API extern const ecs_entity_t EcsWorld;
1537
1539FLECS_API extern const ecs_entity_t EcsWildcard;
1540
1542FLECS_API extern const ecs_entity_t EcsAny;
1543
1545FLECS_API extern const ecs_entity_t EcsThis;
1546
1548FLECS_API extern const ecs_entity_t EcsVariable;
1549
1551#define EcsSingleton EcsVariable
1552
1560FLECS_API extern const ecs_entity_t EcsTransitive;
1561
1569FLECS_API extern const ecs_entity_t EcsReflexive;
1570
1581FLECS_API extern const ecs_entity_t EcsFinal;
1582
1584FLECS_API extern const ecs_entity_t EcsOnInstantiate;
1585
1589FLECS_API extern const ecs_entity_t EcsOverride;
1590
1594FLECS_API extern const ecs_entity_t EcsInherit;
1595
1600FLECS_API extern const ecs_entity_t EcsDontInherit;
1601
1609FLECS_API extern const ecs_entity_t EcsSymmetric;
1610
1620FLECS_API extern const ecs_entity_t EcsExclusive;
1621
1623FLECS_API extern const ecs_entity_t EcsAcyclic;
1624
1627FLECS_API extern const ecs_entity_t EcsTraversable;
1628
1638FLECS_API extern const ecs_entity_t EcsWith;
1639
1649FLECS_API extern const ecs_entity_t EcsOneOf;
1650
1652FLECS_API extern const ecs_entity_t EcsCanToggle;
1653
1657FLECS_API extern const ecs_entity_t EcsTrait;
1658
1668FLECS_API extern const ecs_entity_t EcsRelationship;
1669
1679FLECS_API extern const ecs_entity_t EcsTarget;
1680
1683FLECS_API extern const ecs_entity_t EcsPairIsTag;
1684
1686FLECS_API extern const ecs_entity_t EcsName;
1687
1689FLECS_API extern const ecs_entity_t EcsSymbol;
1690
1692FLECS_API extern const ecs_entity_t EcsAlias;
1693
1695FLECS_API extern const ecs_entity_t EcsChildOf;
1696
1698FLECS_API extern const ecs_entity_t EcsIsA;
1699
1701FLECS_API extern const ecs_entity_t EcsDependsOn;
1702
1704FLECS_API extern const ecs_entity_t EcsSlotOf;
1705
1707FLECS_API extern const ecs_entity_t EcsModule;
1708
1710FLECS_API extern const ecs_entity_t EcsPrivate;
1711
1714FLECS_API extern const ecs_entity_t EcsPrefab;
1715
1718FLECS_API extern const ecs_entity_t EcsDisabled;
1719
1723FLECS_API extern const ecs_entity_t EcsNotQueryable;
1724
1726FLECS_API extern const ecs_entity_t EcsOnAdd;
1727
1729FLECS_API extern const ecs_entity_t EcsOnRemove;
1730
1732FLECS_API extern const ecs_entity_t EcsOnSet;
1733
1735FLECS_API extern const ecs_entity_t EcsMonitor;
1736
1738FLECS_API extern const ecs_entity_t EcsOnTableCreate;
1739
1741FLECS_API extern const ecs_entity_t EcsOnTableDelete;
1742
1744FLECS_API extern const ecs_entity_t EcsOnTableEmpty;
1745
1747FLECS_API extern const ecs_entity_t EcsOnTableFill;
1748
1750FLECS_API extern const ecs_entity_t EcsOnDelete;
1751
1754FLECS_API extern const ecs_entity_t EcsOnDeleteTarget;
1755
1758FLECS_API extern const ecs_entity_t EcsRemove;
1759
1762FLECS_API extern const ecs_entity_t EcsDelete;
1763
1766FLECS_API extern const ecs_entity_t EcsPanic;
1767
1769FLECS_API extern const ecs_entity_t EcsSparse;
1770
1772FLECS_API extern const ecs_entity_t EcsUnion;
1773
1775FLECS_API extern const ecs_entity_t EcsPredEq;
1776
1778FLECS_API extern const ecs_entity_t EcsPredMatch;
1779
1781FLECS_API extern const ecs_entity_t EcsPredLookup;
1782
1784FLECS_API extern const ecs_entity_t EcsScopeOpen;
1785
1787FLECS_API extern const ecs_entity_t EcsScopeClose;
1788
1793FLECS_API extern const ecs_entity_t EcsEmpty;
1794
1795FLECS_API extern const ecs_entity_t ecs_id(EcsPipeline);
1796FLECS_API extern const ecs_entity_t EcsOnStart;
1797FLECS_API extern const ecs_entity_t EcsPreFrame;
1798FLECS_API extern const ecs_entity_t EcsOnLoad;
1799FLECS_API extern const ecs_entity_t EcsPostLoad;
1800FLECS_API extern const ecs_entity_t EcsPreUpdate;
1801FLECS_API extern const ecs_entity_t EcsOnUpdate;
1802FLECS_API extern const ecs_entity_t EcsOnValidate;
1803FLECS_API extern const ecs_entity_t EcsPostUpdate;
1804FLECS_API extern const ecs_entity_t EcsPreStore;
1805FLECS_API extern const ecs_entity_t EcsOnStore;
1806FLECS_API extern const ecs_entity_t EcsPostFrame;
1807FLECS_API extern const ecs_entity_t EcsPhase;
1811#define EcsLastInternalComponentId (ecs_id(EcsPoly))
1812
1815#define EcsFirstUserComponentId (8)
1816
1819#define EcsFirstUserEntityId (FLECS_HI_COMPONENT_ID + 128)
1820
1821/* When visualized the reserved id ranges look like this:
1822 * - [1..8]: Builtin components
1823 * - [9..FLECS_HI_COMPONENT_ID]: Low ids reserved for application components
1824 * - [FLECS_HI_COMPONENT_ID + 1..EcsFirstUserEntityId]: Builtin entities
1825 */
1826
1848FLECS_API
1850
1857FLECS_API
1859
1867FLECS_API
1869 int argc,
1870 char *argv[]);
1871
1878FLECS_API
1880 ecs_world_t *world);
1881
1889FLECS_API
1891 const ecs_world_t *world);
1892
1900FLECS_API
1902 ecs_world_t *world,
1903 ecs_fini_action_t action,
1904 void *ctx);
1905
1912
1939FLECS_API
1941 const ecs_world_t *world);
1942
1968FLECS_API
1970 ecs_world_t *world,
1971 ecs_ftime_t delta_time);
1972
1979FLECS_API
1981 ecs_world_t *world);
1982
1990FLECS_API
1992 ecs_world_t *world,
1993 ecs_fini_action_t action,
1994 void *ctx);
1995
2002FLECS_API
2004 ecs_world_t *world);
2005
2012FLECS_API
2014 const ecs_world_t *world);
2015
2028 ecs_world_t *world,
2029 bool enable);
2030
2042 ecs_world_t *world,
2043 bool enable);
2044
2060FLECS_API
2062 ecs_world_t *world,
2063 ecs_ftime_t fps);
2064
2078FLECS_API
2080 ecs_world_t *world,
2081 ecs_flags32_t flags);
2082
2159FLECS_API
2161 ecs_world_t *world,
2162 bool multi_threaded);
2163
2171FLECS_API
2173 ecs_world_t *world);
2174
2185FLECS_API
2187 ecs_world_t *world);
2188
2204FLECS_API
2206 ecs_world_t *world);
2207
2218FLECS_API
2220 const ecs_world_t *world);
2221
2235FLECS_API
2237 ecs_world_t *world);
2238
2253FLECS_API
2255 ecs_world_t *world);
2256
2267FLECS_API
2269 ecs_world_t *world);
2270
2284FLECS_API
2286 ecs_world_t *world,
2287 int32_t stages);
2288
2295FLECS_API
2297 const ecs_world_t *world);
2298
2314FLECS_API
2316 const ecs_world_t *world,
2317 int32_t stage_id);
2318
2326FLECS_API
2328 const ecs_world_t *world);
2329
2337FLECS_API
2339 ecs_world_t *world);
2340
2345FLECS_API
2347 ecs_world_t *stage);
2348
2356FLECS_API
2358 const ecs_world_t *world);
2359
2375FLECS_API
2377 ecs_world_t *world,
2378 void *ctx,
2379 ecs_ctx_free_t ctx_free);
2380
2389FLECS_API
2391 ecs_world_t *world,
2392 void *ctx,
2393 ecs_ctx_free_t ctx_free);
2394
2402FLECS_API
2404 const ecs_world_t *world);
2405
2413FLECS_API
2415 const ecs_world_t *world);
2416
2422FLECS_API
2424
2430FLECS_API
2432 const ecs_world_t *world);
2433
2442FLECS_API
2444 ecs_world_t *world,
2445 int32_t entity_count);
2446
2462FLECS_API
2464 ecs_world_t *world,
2465 ecs_entity_t id_start,
2466 ecs_entity_t id_end);
2467
2478FLECS_API
2480 ecs_world_t *world,
2481 bool enable);
2482
2488FLECS_API
2490 const ecs_world_t *world);
2491
2505FLECS_API
2507 ecs_world_t *world,
2508 ecs_flags32_t flags);
2509
2543FLECS_API
2545 ecs_world_t *world,
2546 ecs_id_t id,
2547 uint16_t clear_generation,
2548 uint16_t delete_generation,
2549 int32_t min_id_count,
2550 double time_budget_seconds);
2551
2557FLECS_API
2559 const ecs_poly_t *poly);
2560
2566FLECS_API
2568 const ecs_poly_t *poly);
2569
2583FLECS_API
2585 const ecs_poly_t *object,
2586 int32_t type);
2587
2591#define flecs_poly_is(object, type)\
2592 flecs_poly_is_(object, type##_magic)
2593
2602FLECS_API
2604 ecs_entity_t first,
2605 ecs_entity_t second);
2606
2633FLECS_API
2635 ecs_world_t *world);
2636
2654FLECS_API
2656 ecs_world_t *world);
2657
2666FLECS_API
2668 ecs_world_t *world,
2669 ecs_id_t id);
2670
2678FLECS_API
2680 ecs_world_t *world,
2681 ecs_table_t *table);
2682
2701FLECS_API
2703 ecs_world_t *world,
2704 const ecs_entity_desc_t *desc);
2705
2732FLECS_API
2734 ecs_world_t *world,
2735 const ecs_bulk_desc_t *desc);
2736
2746FLECS_API
2748 ecs_world_t *world,
2749 ecs_id_t id,
2750 int32_t count);
2751
2767FLECS_API
2769 ecs_world_t *world,
2770 ecs_entity_t dst,
2771 ecs_entity_t src,
2772 bool copy_value);
2773
2782FLECS_API
2784 ecs_world_t *world,
2785 ecs_entity_t entity);
2786
2794FLECS_API
2796 ecs_world_t *world,
2797 ecs_id_t id);
2798
2816FLECS_API
2818 ecs_world_t *world,
2819 ecs_entity_t entity,
2820 ecs_id_t id);
2821
2830FLECS_API
2832 ecs_world_t *world,
2833 ecs_entity_t entity,
2834 ecs_id_t id);
2835
2887FLECS_API
2889 ecs_world_t *world,
2890 ecs_entity_t entity,
2891 ecs_id_t id);
2892
2899FLECS_API
2901 ecs_world_t *world,
2902 ecs_entity_t entity);
2903
2911FLECS_API
2913 ecs_world_t *world,
2914 ecs_id_t id);
2915
2923FLECS_API
2925 ecs_world_t *world,
2926 ecs_id_t id);
2927
2934FLECS_API
2936 const ecs_world_t *world);
2937
2956FLECS_API
2958 ecs_world_t *world,
2959 ecs_entity_t entity,
2960 bool enabled);
2961
2975FLECS_API
2977 ecs_world_t *world,
2978 ecs_entity_t entity,
2979 ecs_id_t id,
2980 bool enable);
2981
2992FLECS_API
2994 const ecs_world_t *world,
2995 ecs_entity_t entity,
2996 ecs_id_t id);
2997
3021FLECS_API
3022const void* ecs_get_id(
3023 const ecs_world_t *world,
3024 ecs_entity_t entity,
3025 ecs_id_t id);
3026
3038FLECS_API
3040 const ecs_world_t *world,
3041 ecs_entity_t entity,
3042 ecs_id_t id);
3043
3061FLECS_API
3063 ecs_world_t *world,
3064 ecs_entity_t entity,
3065 ecs_id_t id);
3066
3078FLECS_API
3080 ecs_world_t *world,
3081 ecs_entity_t entity,
3082 ecs_id_t id);
3083
3094FLECS_API
3096 const ecs_world_t *world,
3097 ecs_entity_t entity,
3098 ecs_id_t id);
3099
3108FLECS_API
3110 const ecs_world_t *world,
3111 ecs_ref_t *ref,
3112 ecs_id_t id);
3113
3121FLECS_API
3123 const ecs_world_t *world,
3124 ecs_ref_t *ref);
3125
3133FLECS_API
3135 const ecs_world_t *world,
3136 ecs_entity_t entity);
3137
3156FLECS_API
3158 ecs_world_t *world,
3159 ecs_entity_t entity);
3160
3167FLECS_API
3169 ecs_record_t *record);
3170
3190FLECS_API
3192 ecs_world_t *world,
3193 ecs_entity_t entity);
3194
3200FLECS_API
3202 const ecs_record_t *record);
3203
3210FLECS_API
3212 const ecs_record_t *record);
3213
3229FLECS_API
3231 const ecs_world_t *world,
3232 const ecs_record_t *record,
3233 ecs_id_t id);
3234
3243FLECS_API
3245 ecs_world_t *world,
3246 ecs_record_t *record,
3247 ecs_id_t id);
3248
3256FLECS_API
3258 ecs_world_t *world,
3259 const ecs_record_t *record,
3260 ecs_id_t id);
3261
3278FLECS_API
3280 const ecs_record_t *record,
3281 int32_t column,
3282 size_t size);
3283
3303FLECS_API
3305 ecs_world_t *world,
3306 ecs_entity_t entity,
3307 ecs_id_t id,
3308 bool *is_new);
3309
3319FLECS_API
3321 ecs_world_t *world,
3322 ecs_entity_t entity,
3323 ecs_id_t id);
3324
3340FLECS_API
3342 ecs_world_t *world,
3343 ecs_entity_t entity,
3344 ecs_id_t id,
3345 size_t size,
3346 const void *ptr);
3347
3375FLECS_API
3377 const ecs_world_t *world,
3378 ecs_entity_t e);
3379
3405FLECS_API
3407 const ecs_world_t *world,
3408 ecs_entity_t e);
3409
3415FLECS_API
3417 ecs_entity_t e);
3418
3435FLECS_API
3437 const ecs_world_t *world,
3438 ecs_entity_t e);
3439
3462FLECS_API
3464 ecs_world_t *world,
3465 ecs_entity_t entity);
3466
3485FLECS_API
3487 ecs_world_t *world,
3488 ecs_id_t id);
3489
3497FLECS_API
3499 const ecs_world_t *world,
3500 ecs_entity_t entity);
3501
3516FLECS_API
3518 ecs_world_t *world,
3519 ecs_entity_t entity);
3520
3536FLECS_API
3538 const ecs_world_t *world,
3539 ecs_entity_t entity);
3540
3547FLECS_API
3549 const ecs_world_t *world,
3550 ecs_entity_t entity);
3551
3559FLECS_API
3561 const ecs_world_t *world,
3562 const ecs_type_t* type);
3563
3575FLECS_API
3577 const ecs_world_t *world,
3578 const ecs_table_t *table);
3579
3594FLECS_API
3596 const ecs_world_t *world,
3597 ecs_entity_t entity);
3598
3609FLECS_API
3611 const ecs_world_t *world,
3612 ecs_entity_t entity,
3613 ecs_id_t id);
3614
3625FLECS_API
3627 const ecs_world_t *world,
3628 ecs_entity_t entity,
3629 ecs_id_t id);
3630
3645FLECS_API
3647 const ecs_world_t *world,
3648 ecs_entity_t entity,
3649 ecs_entity_t rel,
3650 int32_t index);
3651
3665FLECS_API
3667 const ecs_world_t *world,
3668 ecs_entity_t entity);
3669
3690FLECS_API
3692 const ecs_world_t *world,
3693 ecs_entity_t entity,
3694 ecs_entity_t rel,
3695 ecs_id_t id);
3696
3707FLECS_API
3709 const ecs_world_t *world,
3710 ecs_entity_t entity,
3711 ecs_entity_t rel);
3712
3720FLECS_API
3722 const ecs_world_t *world,
3723 ecs_id_t entity);
3724
3744FLECS_API
3745const char* ecs_get_name(
3746 const ecs_world_t *world,
3747 ecs_entity_t entity);
3748
3758FLECS_API
3759const char* ecs_get_symbol(
3760 const ecs_world_t *world,
3761 ecs_entity_t entity);
3762
3776FLECS_API
3778 ecs_world_t *world,
3779 ecs_entity_t entity,
3780 const char *name);
3781
3795FLECS_API
3797 ecs_world_t *world,
3798 ecs_entity_t entity,
3799 const char *symbol);
3800
3812FLECS_API
3814 ecs_world_t *world,
3815 ecs_entity_t entity,
3816 const char *alias);
3817
3833FLECS_API
3835 const ecs_world_t *world,
3836 const char *path);
3837
3852FLECS_API
3854 const ecs_world_t *world,
3855 ecs_entity_t parent,
3856 const char *name);
3857
3880FLECS_API
3882 const ecs_world_t *world,
3883 ecs_entity_t parent,
3884 const char *path,
3885 const char *sep,
3886 const char *prefix,
3887 bool recursive);
3888
3906FLECS_API
3908 const ecs_world_t *world,
3909 const char *symbol,
3910 bool lookup_as_path,
3911 bool recursive);
3912
3934FLECS_API
3936 const ecs_world_t *world,
3937 ecs_entity_t parent,
3938 ecs_entity_t child,
3939 const char *sep,
3940 const char *prefix);
3941
3955 const ecs_world_t *world,
3956 ecs_entity_t parent,
3957 ecs_entity_t child,
3958 const char *sep,
3959 const char *prefix,
3960 ecs_strbuf_t *buf);
3961
3977FLECS_API
3979 ecs_world_t *world,
3980 ecs_entity_t parent,
3981 const char *path,
3982 const char *sep,
3983 const char *prefix);
3984
3999FLECS_API
4001 ecs_world_t *world,
4002 ecs_entity_t entity,
4003 ecs_entity_t parent,
4004 const char *path,
4005 const char *sep,
4006 const char *prefix);
4007
4021FLECS_API
4023 ecs_world_t *world,
4024 ecs_entity_t scope);
4025
4033FLECS_API
4035 const ecs_world_t *world);
4036
4046FLECS_API
4048 ecs_world_t *world,
4049 const char *prefix);
4050
4077FLECS_API
4079 ecs_world_t *world,
4080 const ecs_entity_t *lookup_path);
4081
4088FLECS_API
4090 const ecs_world_t *world);
4091
4116FLECS_API
4118 ecs_world_t *world,
4119 const ecs_component_desc_t *desc);
4120
4130FLECS_API
4132 const ecs_world_t *world,
4133 ecs_id_t id);
4134
4146FLECS_API
4148 ecs_world_t *world,
4149 ecs_entity_t id,
4150 const ecs_type_hooks_t *hooks);
4151
4158FLECS_API
4160 const ecs_world_t *world,
4161 ecs_entity_t id);
4162
4186FLECS_API
4188 const ecs_world_t *world,
4189 ecs_id_t id);
4190
4199FLECS_API
4201 const ecs_world_t *world,
4202 ecs_id_t id);
4203
4223FLECS_API
4225 const ecs_world_t *world,
4226 ecs_id_t id);
4227
4236FLECS_API
4238 ecs_id_t id,
4239 ecs_id_t pattern);
4240
4246FLECS_API
4248 ecs_id_t id);
4249
4255FLECS_API
4257 ecs_id_t id);
4258
4272FLECS_API
4274 const ecs_world_t *world,
4275 ecs_id_t id);
4276
4285FLECS_API
4286ecs_flags32_t ecs_id_get_flags(
4287 const ecs_world_t *world,
4288 ecs_id_t id);
4289
4296FLECS_API
4298 ecs_id_t id_flags);
4299
4307FLECS_API
4309 const ecs_world_t *world,
4310 ecs_id_t id);
4311
4319FLECS_API
4321 const ecs_world_t *world,
4322 ecs_id_t id,
4323 ecs_strbuf_t *buf);
4324
4338FLECS_API
4340 const ecs_term_ref_t *id);
4341
4353FLECS_API
4355 const ecs_term_t *term);
4356
4371FLECS_API
4373 const ecs_term_t *term);
4374
4387FLECS_API
4389 const ecs_term_t *term);
4390
4399FLECS_API
4401 const ecs_world_t *world,
4402 const ecs_term_t *term);
4403
4411FLECS_API
4413 const ecs_query_t *query);
4414
4455FLECS_API
4457 const ecs_world_t *world,
4458 ecs_id_t id);
4459
4465FLECS_API
4467 ecs_iter_t *it);
4468
4481FLECS_API
4483 const ecs_world_t *world,
4484 ecs_entity_t parent);
4485
4491FLECS_API
4493 ecs_iter_t *it);
4494
4510FLECS_API
4512 ecs_world_t *world,
4513 const ecs_query_desc_t *desc);
4514
4519FLECS_API
4521 ecs_query_t *query);
4522
4531FLECS_API
4533 const ecs_query_t *query,
4534 const char *name);
4535
4543FLECS_API
4545 const ecs_query_t *query,
4546 int32_t var_id);
4547
4558FLECS_API
4560 const ecs_query_t *query,
4561 int32_t var_id);
4562
4631FLECS_API
4633 const ecs_world_t *world,
4634 const ecs_query_t *query);
4635
4643FLECS_API
4645 ecs_iter_t *it);
4646
4665FLECS_API
4667 ecs_query_t *query,
4668 ecs_entity_t entity,
4669 ecs_iter_t *it);
4670
4689FLECS_API
4691 ecs_query_t *query,
4692 ecs_table_t *table,
4693 ecs_iter_t *it);
4694
4721FLECS_API
4723 ecs_query_t *query,
4724 ecs_table_range_t *range,
4725 ecs_iter_t *it);
4726
4734FLECS_API
4736 const ecs_query_t *query);
4737
4747FLECS_API
4749 const ecs_query_t *query);
4750
4765FLECS_API
4767 const ecs_query_t *query,
4768 const ecs_iter_t *it);
4769
4787FLECS_API
4789 ecs_query_t *query,
4790 ecs_iter_t *it,
4791 const char *expr);
4792
4820FLECS_API
4822 ecs_query_t *query);
4823
4834FLECS_API
4836 ecs_iter_t *it);
4837
4860FLECS_API
4862 ecs_iter_t *it,
4863 uint64_t group_id);
4864
4873FLECS_API
4875 const ecs_query_t *query,
4876 uint64_t group_id);
4877
4886FLECS_API
4888 const ecs_query_t *query,
4889 uint64_t group_id);
4890
4898
4905FLECS_API
4907 const ecs_query_t *query);
4908
4914FLECS_API
4916 const ecs_query_t *query);
4917
4946FLECS_API
4948 ecs_world_t *world,
4949 ecs_event_desc_t *desc);
4950
4961FLECS_API
4963 ecs_world_t *world,
4964 ecs_event_desc_t *desc);
4965
4976FLECS_API
4978 ecs_world_t *world,
4979 const ecs_observer_desc_t *desc);
4980
4989FLECS_API
4991 const ecs_world_t *world,
4992 ecs_entity_t observer);
4993
5016FLECS_API
5018 ecs_iter_t *it);
5019
5029FLECS_API
5031 ecs_iter_t *it);
5032
5044FLECS_API
5046 ecs_iter_t *it);
5047
5060FLECS_API
5062 ecs_iter_t *it);
5063
5071FLECS_API
5073 ecs_iter_t *it);
5074
5113FLECS_API
5115 ecs_iter_t *it,
5116 int32_t var_id,
5117 ecs_entity_t entity);
5118
5129FLECS_API
5131 ecs_iter_t *it,
5132 int32_t var_id,
5133 const ecs_table_t *table);
5134
5145FLECS_API
5147 ecs_iter_t *it,
5148 int32_t var_id,
5149 const ecs_table_range_t *range);
5150
5163FLECS_API
5165 ecs_iter_t *it,
5166 int32_t var_id);
5167
5181FLECS_API
5183 ecs_iter_t *it,
5184 int32_t var_id);
5185
5199FLECS_API
5201 ecs_iter_t *it,
5202 int32_t var_id);
5203
5215FLECS_API
5217 ecs_iter_t *it,
5218 int32_t var_id);
5219
5231FLECS_API
5233 ecs_iter_t *it);
5234
5246FLECS_API
5248 const ecs_iter_t *it);
5249
5265FLECS_API
5267 const ecs_iter_t *it,
5268 int32_t offset,
5269 int32_t limit);
5270
5277FLECS_API
5279 ecs_iter_t *it);
5280
5301FLECS_API
5303 const ecs_iter_t *it,
5304 int32_t index,
5305 int32_t count);
5306
5313FLECS_API
5315 ecs_iter_t *it);
5316
5358FLECS_API
5360 const ecs_iter_t *it,
5361 size_t size,
5362 int8_t index);
5363
5385FLECS_API
5387 const ecs_iter_t *it,
5388 size_t size,
5389 int8_t index,
5390 int32_t row);
5391
5400FLECS_API
5402 const ecs_iter_t *it,
5403 int8_t index);
5404
5415FLECS_API
5417 const ecs_iter_t *it,
5418 int8_t index);
5419
5426FLECS_API
5428 const ecs_iter_t *it,
5429 int8_t index);
5430
5437FLECS_API
5439 const ecs_iter_t *it,
5440 int8_t index);
5441
5450FLECS_API
5452 const ecs_iter_t *it,
5453 int8_t index);
5454
5462FLECS_API
5464 const ecs_iter_t *it,
5465 int8_t index);
5466
5474FLECS_API
5476 const ecs_iter_t *it,
5477 int8_t index);
5478
5492FLECS_API
5494 const ecs_iter_t *it,
5495 int8_t index);
5496
5512FLECS_API
5514 const ecs_table_t *table);
5515
5526FLECS_API
5528 const ecs_world_t *world,
5529 const ecs_table_t *table,
5530 ecs_id_t id);
5531
5541FLECS_API
5543 const ecs_world_t *world,
5544 const ecs_table_t *table,
5545 ecs_id_t id);
5546
5554FLECS_API
5556 const ecs_table_t *table);
5557
5571FLECS_API
5573 const ecs_table_t *table,
5574 int32_t index);
5575
5584FLECS_API
5586 const ecs_table_t *table,
5587 int32_t index);
5588
5597FLECS_API
5599 const ecs_table_t *table,
5600 int32_t index,
5601 int32_t offset);
5602
5612FLECS_API
5614 const ecs_world_t *world,
5615 const ecs_table_t *table,
5616 ecs_id_t id,
5617 int32_t offset);
5618
5626FLECS_API
5628 const ecs_table_t *table,
5629 int32_t index);
5630
5637FLECS_API
5639 const ecs_table_t *table);
5640
5648FLECS_API
5650 const ecs_table_t *table);
5651
5658FLECS_API
5660 const ecs_table_t *table);
5661
5672FLECS_API
5674 const ecs_world_t *world,
5675 const ecs_table_t *table,
5676 ecs_id_t id);
5677
5688FLECS_API
5690 const ecs_world_t *world,
5691 const ecs_table_t *table,
5692 ecs_entity_t rel);
5693
5703FLECS_API
5705 ecs_world_t *world,
5706 ecs_table_t *table,
5707 ecs_id_t id);
5708
5719FLECS_API
5721 ecs_world_t *world,
5722 const ecs_id_t *ids,
5723 int32_t id_count);
5724
5734FLECS_API
5736 ecs_world_t *world,
5737 ecs_table_t *table,
5738 ecs_id_t id);
5739
5755FLECS_API
5757 ecs_world_t *world,
5758 ecs_table_t *table);
5759
5766FLECS_API
5768 ecs_world_t *world,
5769 ecs_table_t *table);
5770
5780FLECS_API
5782 ecs_table_t *table,
5783 ecs_flags32_t flags);
5784
5792FLECS_API
5794 ecs_world_t* world,
5795 ecs_table_t* table,
5796 int32_t row_1,
5797 int32_t row_2);
5798
5821FLECS_API
5823 ecs_world_t *world,
5824 ecs_entity_t entity,
5825 ecs_record_t *record,
5826 ecs_table_t *table,
5827 const ecs_type_t *added,
5828 const ecs_type_t *removed);
5829
5830
5849FLECS_API
5851 const ecs_world_t *world,
5852 const ecs_table_t *table,
5853 ecs_id_t id,
5854 ecs_id_t *id_out);
5855
5891FLECS_API
5893 const ecs_world_t *world,
5894 const ecs_table_t *table,
5895 int32_t offset,
5896 ecs_id_t id,
5897 ecs_id_t *id_out);
5898
5940FLECS_API
5942 const ecs_world_t *world,
5943 const ecs_table_t *table,
5944 int32_t offset,
5945 ecs_id_t id,
5946 ecs_entity_t rel,
5947 ecs_flags64_t flags, /* EcsSelf and/or EcsUp */
5948 ecs_entity_t *subject_out,
5949 ecs_id_t *id_out,
5950 struct ecs_table_record_t **tr_out);
5951
5968FLECS_API
5970 const ecs_world_t *world,
5971 ecs_entity_t type,
5972 void *ptr);
5973
5981FLECS_API
5983 const ecs_world_t *world,
5984 const ecs_type_info_t *ti,
5985 void *ptr);
5986
5993FLECS_API
5995 ecs_world_t *world,
5996 ecs_entity_t type);
5997
6005 ecs_world_t *world,
6006 const ecs_type_info_t *ti);
6007
6016 const ecs_world_t *world,
6017 const ecs_type_info_t *ti,
6018 void *ptr);
6019
6027FLECS_API
6029 const ecs_world_t *world,
6030 ecs_entity_t type,
6031 void* ptr);
6032
6040FLECS_API
6042 ecs_world_t *world,
6043 ecs_entity_t type,
6044 void* ptr);
6045
6054FLECS_API
6056 const ecs_world_t *world,
6057 const ecs_type_info_t *ti,
6058 void* dst,
6059 const void *src);
6060
6069FLECS_API
6071 const ecs_world_t *world,
6072 ecs_entity_t type,
6073 void* dst,
6074 const void *src);
6075
6085 const ecs_world_t *world,
6086 const ecs_type_info_t *ti,
6087 void* dst,
6088 void *src);
6089
6099 const ecs_world_t *world,
6100 ecs_entity_t type,
6101 void* dst,
6102 void *src);
6103
6113 const ecs_world_t *world,
6114 const ecs_type_info_t *ti,
6115 void* dst,
6116 void *src);
6117
6127 const ecs_world_t *world,
6128 ecs_entity_t type,
6129 void* dst,
6130 void *src);
6131
6145#include "flecs/addons/flecs_c.h"
6146
6147#ifdef __cplusplus
6148}
6149#endif
6150
6151#include "flecs/private/addons.h"
6152
6153#endif
The deprecated addon contains deprecated operations.
Extends the core API with convenience macros for C applications.
ecs_entity_t ecs_set_with(ecs_world_t *world, ecs_id_t id)
Set current with id.
void ecs_add_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Add a (component) id to an entity.
void ecs_remove_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Remove a (component) id from an entity.
void ecs_clear(ecs_world_t *world, ecs_entity_t entity)
Clear all components.
ecs_id_t ecs_get_with(const ecs_world_t *world)
Get current with id.
void ecs_remove_all(ecs_world_t *world, ecs_id_t id)
Remove all instances of the specified (component) id.
void ecs_auto_override_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Add auto override for (component) id.
struct ecs_value_t ecs_value_t
Utility to hold a value of a dynamic type.
struct EcsIdentifier EcsIdentifier
A (string) identifier.
struct EcsPoly EcsPoly
Component for storing a poly object.
struct EcsDefaultChildComponent EcsDefaultChildComponent
When added to an entity this informs serialization formats which component to use when a value is ass...
struct EcsComponent EcsComponent
Component information.
const ecs_entity_t EcsScopeClose
Marker used to indicate the end of a scope (}) in queries.
const ecs_entity_t EcsOnRemove
Event that triggers when an id is removed from an entity.
const ecs_entity_t EcsThis
This entity.
const ecs_entity_t EcsWildcard
Wildcard entity ("*").
const ecs_entity_t EcsName
Tag to indicate name identifier.
const ecs_entity_t EcsAcyclic
Marks a relationship as acyclic.
const ecs_entity_t EcsSymmetric
Marks relationship as commutative.
const ecs_entity_t EcsAlias
Tag to indicate alias identifier.
const ecs_entity_t EcsOnSet
Event that triggers when a component is set for an entity.
const ecs_entity_t EcsReflexive
Marks a relationship as reflexive.
const ecs_entity_t EcsTrait
Can be added to components to indicate it is a trait.
const ecs_entity_t EcsEmpty
Tag used to indicate query is empty.
const ecs_entity_t EcsOneOf
Ensure that relationship target is child of specified entity.
const ecs_entity_t EcsOnTableDelete
Event that triggers when a table is deleted.
const ecs_entity_t EcsOnTableCreate
Event that triggers when a table is created.
const ecs_entity_t EcsObserver
Tag added to observers.
const ecs_entity_t EcsQuery
Tag added to queries.
const ecs_entity_t EcsRelationship
Ensure that an entity is always used in pair as relationship.
const ecs_entity_t EcsOnStart
OnStart pipeline phase.
const ecs_entity_t EcsNotQueryable
Trait added to entities that should never be returned by queries.
const ecs_entity_t EcsOnStore
OnStore pipeline phase.
const ecs_entity_t 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 EcsOnTableFill
Event that triggers when a table becomes non-empty.
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 EcsOnTableEmpty
Event that triggers when a table becomes empty (doesn't emit on creation).
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 EcsUnion
Mark relationship as union.
const ecs_entity_t EcsPostFrame
PostFrame pipeline phase.
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 ("$").
FLECS_API const ecs_entity_t ecs_id(EcsDocDescription)
Component id for EcsDocDescription.
ecs_world_t * ecs_stage_new(ecs_world_t *world)
Create unmanaged stage.
bool ecs_defer_end(ecs_world_t *world)
End block of operations to defer.
bool ecs_readonly_begin(ecs_world_t *world, bool multi_threaded)
Begin readonly mode.
void ecs_defer_resume(ecs_world_t *world)
Resume deferring.
bool ecs_defer_begin(ecs_world_t *world)
Defer operations until end of frame.
void ecs_defer_suspend(ecs_world_t *world)
Suspend deferring but do not flush queue.
bool ecs_is_deferred(const ecs_world_t *world)
Test if deferring is enabled for current stage.
void ecs_stage_free(ecs_world_t *stage)
Free unmanaged stage.
void ecs_merge(ecs_world_t *world)
Merge world or stage.
int32_t ecs_stage_get_id(const ecs_world_t *world)
Get stage id.
bool ecs_stage_is_readonly(const ecs_world_t *world)
Test whether the current world is readonly.
int32_t ecs_get_stage_count(const ecs_world_t *world)
Get number of configured stages.
ecs_world_t * ecs_get_stage(const ecs_world_t *world, int32_t stage_id)
Get stage-specific world pointer.
void ecs_set_stage_count(ecs_world_t *world, int32_t stages)
Configure world to have N stages.
void ecs_readonly_end(ecs_world_t *world)
End readonly mode.
ecs_entity_t ecs_component_init(ecs_world_t *world, const ecs_component_desc_t *desc)
Find or create a component.
void ecs_set_hooks_id(ecs_world_t *world, ecs_entity_t id, const ecs_type_hooks_t *hooks)
Register hooks for component.
struct ecs_component_desc_t ecs_component_desc_t
Used with ecs_component_init().
const ecs_type_info_t * ecs_get_type_info(const ecs_world_t *world, ecs_id_t id)
Get the type for an id.
const ecs_type_hooks_t * ecs_get_hooks_id(const ecs_world_t *world, ecs_entity_t id)
Get hooks for component.
struct ecs_header_t ecs_header_t
Header for ecs_poly_t objects.
struct ecs_stage_t ecs_stage_t
A stage enables modification while iterating and from multiple threads.
Definition flecs.h:386
struct ecs_ref_t ecs_ref_t
A ref is a fast way to fetch a component for a specific entity.
Definition flecs.h:435
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:339
struct ecs_table_record_t ecs_table_record_t
Metadata describing where a component id is stored in a table.
struct ecs_id_record_t ecs_id_record_t
Information about a (component) id, such as type info and tables with the id.
Definition flecs.h:451
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition flecs.h:383
struct ecs_mixins_t ecs_mixins_t
Type that stores poly mixins.
Definition flecs.h:475
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
Definition flecs.h:332
struct ecs_observable_t ecs_observable_t
An observable produces events that can be listened for by an observer.
Definition flecs.h:419
struct ecs_table_t ecs_table_t
A table stores entities and components for a specific type.
Definition flecs.h:389
void ecs_poly_t
A poly object.
Definition flecs.h:472
struct ecs_table_cache_hdr_t ecs_table_cache_hdr_t
Header for table cache elements.
ecs_entity_t ecs_new_low_id(ecs_world_t *world)
Create new low id.
ecs_entity_t ecs_new_w_id(ecs_world_t *world, ecs_id_t id)
Create new entity with (component) id.
const ecs_entity_t * ecs_bulk_init(ecs_world_t *world, const ecs_bulk_desc_t *desc)
Bulk create/populate new entities.
ecs_entity_t ecs_clone(ecs_world_t *world, ecs_entity_t dst, ecs_entity_t src, bool copy_value)
Clone an entity This operation clones the components of one entity into another entity.
const ecs_entity_t * ecs_bulk_new_w_id(ecs_world_t *world, ecs_id_t id, int32_t count)
Create N new entities.
ecs_entity_t ecs_new(ecs_world_t *world)
Create new entity id.
ecs_entity_t ecs_entity_init(ecs_world_t *world, const ecs_entity_desc_t *desc)
Find or create an entity.
void ecs_delete_with(ecs_world_t *world, ecs_id_t id)
Delete all entities with the specified id.
void ecs_delete(ecs_world_t *world, ecs_entity_t entity)
Delete an entity.
ecs_entity_t ecs_new_w_table(ecs_world_t *world, ecs_table_t *table)
Create new entity in table.
bool ecs_children_next(ecs_iter_t *it)
Progress an iterator created with ecs_children().
bool ecs_each_next(ecs_iter_t *it)
Progress an iterator created with ecs_each_id().
ecs_iter_t ecs_children(const ecs_world_t *world, ecs_entity_t parent)
Iterate children of parent.
ecs_iter_t ecs_each_id(const ecs_world_t *world, ecs_id_t id)
Iterate all entities with specified (component id).
bool ecs_is_enabled_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Test if component is enabled.
void ecs_enable_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id, bool enable)
Enable or disable component.
void ecs_enable(ecs_world_t *world, ecs_entity_t entity, bool enabled)
Enable or disable entity.
struct ecs_bulk_desc_t ecs_bulk_desc_t
Used with ecs_bulk_init().
struct ecs_entity_desc_t ecs_entity_desc_t
Used with ecs_entity_init().
char * ecs_entity_str(const ecs_world_t *world, ecs_entity_t entity)
Convert entity to string.
ecs_entity_t ecs_get_target(const ecs_world_t *world, ecs_entity_t entity, ecs_entity_t rel, int32_t index)
Get the target of a relationship.
ecs_entity_t ecs_get_parent(const ecs_world_t *world, ecs_entity_t entity)
Get parent (target of ChildOf relationship) for entity.
const ecs_type_t * ecs_get_type(const ecs_world_t *world, ecs_entity_t entity)
Get the type of an entity.
bool ecs_has_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Test if an entity has an id.
char * ecs_type_str(const ecs_world_t *world, const ecs_type_t *type)
Convert type to string.
char * ecs_table_str(const ecs_world_t *world, const ecs_table_t *table)
Convert table to string.
int32_t ecs_count_id(const ecs_world_t *world, ecs_id_t entity)
Count entities that have the specified id.
bool ecs_owns_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Test if an entity owns an id.
int32_t ecs_get_depth(const ecs_world_t *world, ecs_entity_t entity, ecs_entity_t rel)
Return depth for entity in tree for the specified relationship.
ecs_entity_t ecs_get_target_for_id(const ecs_world_t *world, ecs_entity_t entity, ecs_entity_t rel, ecs_id_t id)
Get the target of a relationship for a given id.
ecs_table_t * ecs_get_table(const ecs_world_t *world, ecs_entity_t entity)
Get the table of an entity.
void(* ecs_module_action_t)(ecs_world_t *world)
Initialization action for modules.
Definition flecs.h:599
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:579
uint64_t(* ecs_hash_value_action_t)(const void *ptr)
Callback used for hashing values.
Definition flecs.h:617
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:592
void(* ecs_iter_fini_action_t)(ecs_iter_t *it)
Function prototype for freeing an iterator.
Definition flecs.h:557
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:586
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:568
bool(* ecs_iter_next_action_t)(ecs_iter_t *it)
Function prototype for iterating an iterator.
Definition flecs.h:549
void(* ecs_iter_action_t)(ecs_iter_t *it)
Function prototype for iterables.
Definition flecs.h:539
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:627
int(* ecs_compare_action_t)(const void *ptr1, const void *ptr2)
Callback used for sorting values.
Definition flecs.h:612
void(* ecs_fini_action_t)(ecs_world_t *world, void *ctx)
Action callback on world exit.
Definition flecs.h:603
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:634
void(* flecs_poly_dtor_t)(ecs_poly_t *poly)
Destructor function for poly objects.
Definition flecs.h:641
void(* ecs_run_action_t)(ecs_iter_t *it)
Function prototype for runnables (systems, observers).
Definition flecs.h:530
void(* ecs_ctx_free_t)(void *ctx)
Function to cleanup context data.
Definition flecs.h:608
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:561
void(* ecs_xtor_t)(void *ptr, int32_t count, const ecs_type_info_t *type_info)
Constructor/destructor callback.
Definition flecs.h:621
void * ecs_get_mut_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Get a mutable pointer to a component.
ecs_ref_t ecs_ref_init_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Create a component ref.
ecs_entity_t ecs_record_get_entity(const ecs_record_t *record)
Get entity corresponding with record.
void ecs_ref_update(const ecs_world_t *world, ecs_ref_t *ref)
Update ref.
const void * ecs_record_get_id(const ecs_world_t *world, const ecs_record_t *record, ecs_id_t id)
Get component from entity record.
void * ecs_record_get_by_column(const ecs_record_t *record, int32_t column, size_t size)
Get component pointer from column/record.
void ecs_read_end(const ecs_record_t *record)
End read access to entity.
void * ecs_emplace_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id, bool *is_new)
Emplace a component.
void * ecs_ensure_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Get a mutable pointer to a component.
void ecs_write_end(ecs_record_t *record)
End exclusive write access to entity.
void ecs_set_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id, size_t size, const void *ptr)
Set the value of a component.
void * ecs_ensure_modified_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Combines ensure + modified in single operation.
void * ecs_ref_get_id(const ecs_world_t *world, ecs_ref_t *ref, ecs_id_t id)
Get component from ref.
bool ecs_record_has_id(ecs_world_t *world, const ecs_record_t *record, ecs_id_t id)
Test if entity for record has a (component) id.
void * ecs_record_ensure_id(ecs_world_t *world, ecs_record_t *record, ecs_id_t id)
Same as ecs_record_get_id(), but returns a mutable pointer.
const void * ecs_get_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Get an immutable pointer to a component.
ecs_record_t * ecs_write_begin(ecs_world_t *world, ecs_entity_t entity)
Begin exclusive write access to entity.
void ecs_modified_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Signal that a component has been modified.
ecs_record_t * ecs_record_find(const ecs_world_t *world, ecs_entity_t entity)
Find record for entity.
const ecs_record_t * ecs_read_begin(ecs_world_t *world, ecs_entity_t entity)
Begin read access to entity.
const ecs_id_t ECS_PAIR
Indicates that the id is a pair.
const ecs_id_t ECS_AUTO_OVERRIDE
Automatically override component when it is inherited.
const ecs_id_t ECS_TOGGLE
Adds bitset to storage which allows component to be enabled/disabled.
bool ecs_id_is_valid(const ecs_world_t *world, ecs_id_t id)
Utility to check if id is valid.
bool ecs_id_is_pair(ecs_id_t id)
Utility to check if id is a pair.
ecs_entity_t ecs_get_typeid(const ecs_world_t *world, ecs_id_t id)
Get the type for an id.
bool ecs_id_match(ecs_id_t id, ecs_id_t pattern)
Utility to match an id with a pattern.
const char * ecs_id_flag_str(ecs_id_t id_flags)
Convert id flag to string.
bool ecs_id_in_use(const ecs_world_t *world, ecs_id_t id)
Returns whether specified id is in use.
bool ecs_id_is_tag(const ecs_world_t *world, ecs_id_t id)
Returns whether specified id a tag.
void ecs_id_str_buf(const ecs_world_t *world, ecs_id_t id, ecs_strbuf_t *buf)
Write id string to buffer.
char * ecs_id_str(const ecs_world_t *world, ecs_id_t id)
Convert id to string.
bool ecs_id_is_wildcard(ecs_id_t id)
Utility to check if id is a wildcard.
ecs_flags32_t ecs_id_get_flags(const ecs_world_t *world, ecs_id_t id)
Get flags associated with id.
ecs_entity_t ecs_field_src(const ecs_iter_t *it, int8_t index)
Return field source.
bool ecs_iter_changed(ecs_iter_t *it)
Returns whether current iterator result has changed.
bool ecs_field_is_writeonly(const ecs_iter_t *it, int8_t index)
Test whether the field is writeonly.
bool ecs_field_is_readonly(const ecs_iter_t *it, int8_t index)
Test whether the field is readonly.
ecs_iter_t ecs_worker_iter(const ecs_iter_t *it, int32_t index, int32_t count)
Create a worker iterator.
bool ecs_iter_is_true(ecs_iter_t *it)
Test if iterator is true.
void ecs_iter_fini(ecs_iter_t *it)
Cleanup iterator resources.
char * ecs_iter_str(const ecs_iter_t *it)
Convert iterator to string.
bool ecs_iter_var_is_constrained(ecs_iter_t *it, int32_t var_id)
Returns whether variable is constrained.
ecs_iter_t ecs_page_iter(const ecs_iter_t *it, int32_t offset, int32_t limit)
Create a paged iterator.
void * ecs_field_at_w_size(const ecs_iter_t *it, size_t size, int8_t index, int32_t row)
Get data for field at specified row.
ecs_id_t ecs_field_id(const ecs_iter_t *it, int8_t index)
Return id matched for field.
bool ecs_field_is_set(const ecs_iter_t *it, int8_t index)
Test whether field is set.
void ecs_iter_set_var(ecs_iter_t *it, int32_t var_id, ecs_entity_t entity)
Set value for iterator variable.
bool ecs_field_is_self(const ecs_iter_t *it, int8_t index)
Test whether the field is matched on self.
bool ecs_iter_next(ecs_iter_t *it)
Progress any iterator.
ecs_entity_t ecs_iter_get_var(ecs_iter_t *it, int32_t var_id)
Get value of iterator variable as entity.
bool ecs_worker_next(ecs_iter_t *it)
Progress a worker iterator.
ecs_entity_t ecs_iter_first(ecs_iter_t *it)
Get first matching entity from iterator.
int32_t ecs_field_column(const ecs_iter_t *it, int8_t index)
Return index of matched table column.
void ecs_iter_set_var_as_table(ecs_iter_t *it, int32_t var_id, const ecs_table_t *table)
Same as ecs_iter_set_var(), but for a table.
ecs_table_t * ecs_iter_get_var_as_table(ecs_iter_t *it, int32_t var_id)
Get value of iterator variable as table.
void * ecs_field_w_size(const ecs_iter_t *it, size_t size, int8_t index)
Get data for field.
int32_t ecs_iter_count(ecs_iter_t *it)
Count number of matched entities in query.
bool ecs_page_next(ecs_iter_t *it)
Progress a paged iterator.
void ecs_iter_set_var_as_range(ecs_iter_t *it, int32_t var_id, const ecs_table_range_t *range)
Same as ecs_iter_set_var(), but for a range of entities This constrains the variable to a range of en...
size_t ecs_field_size(const ecs_iter_t *it, int8_t index)
Return field type size.
ecs_table_range_t ecs_iter_get_var_as_range(ecs_iter_t *it, int32_t var_id)
Get value of iterator variable as table range.
ecs_id_t ecs_strip_generation(ecs_entity_t e)
Remove generation from entity id.
bool ecs_is_valid(const ecs_world_t *world, ecs_entity_t e)
Test whether an entity is valid.
void ecs_make_alive(ecs_world_t *world, ecs_entity_t entity)
Ensure id is alive.
void ecs_make_alive_id(ecs_world_t *world, ecs_id_t id)
Same as ecs_make_alive(), but for (component) ids.
ecs_entity_t ecs_get_alive(const ecs_world_t *world, ecs_entity_t e)
Get alive identifier.
bool ecs_exists(const ecs_world_t *world, ecs_entity_t entity)
Test whether an entity exists.
bool ecs_is_alive(const ecs_world_t *world, ecs_entity_t e)
Test whether an entity is alive.
void ecs_set_version(ecs_world_t *world, ecs_entity_t entity)
Override the generation of an entity.
struct ecs_world_info_t ecs_world_info_t
Type that contains information about the world.
struct ecs_query_group_info_t ecs_query_group_info_t
Type that contains information about a query group.
struct ecs_build_info_t ecs_build_info_t
Type with information about the current Flecs build.
void ecs_emit(ecs_world_t *world, ecs_event_desc_t *desc)
Send event.
void ecs_enqueue(ecs_world_t *world, ecs_event_desc_t *desc)
Enqueue event.
ecs_entity_t ecs_observer_init(ecs_world_t *world, const ecs_observer_desc_t *desc)
Create observer.
const ecs_observer_t * ecs_observer_get(const ecs_world_t *world, ecs_entity_t observer)
Get observer object.
struct ecs_event_desc_t ecs_event_desc_t
Used with ecs_emit().
struct ecs_observer_desc_t ecs_observer_desc_t
Used with ecs_observer_init().
#define FLECS_EVENT_DESC_MAX
Maximum number of events in ecs_observer_desc_t.
Definition flecs.h:268
#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:262
#define FLECS_TERM_COUNT_MAX
Maximum number of terms in queries.
Definition flecs.h:278
char * ecs_get_path_w_sep(const ecs_world_t *world, ecs_entity_t parent, ecs_entity_t child, const char *sep, const char *prefix)
Get a path identifier for an entity.
ecs_entity_t ecs_new_from_path_w_sep(ecs_world_t *world, ecs_entity_t parent, const char *path, const char *sep, const char *prefix)
Find or create entity from path.
ecs_entity_t ecs_lookup_symbol(const ecs_world_t *world, const char *symbol, bool lookup_as_path, bool recursive)
Lookup an entity by its symbol name.
void ecs_set_alias(ecs_world_t *world, ecs_entity_t entity, const char *alias)
Set alias for entity.
ecs_entity_t ecs_lookup(const ecs_world_t *world, const char *path)
Lookup an entity by it's path.
void ecs_get_path_w_sep_buf(const ecs_world_t *world, ecs_entity_t parent, ecs_entity_t child, const char *sep, const char *prefix, ecs_strbuf_t *buf)
Write path identifier to buffer.
ecs_entity_t ecs_get_scope(const ecs_world_t *world)
Get the current scope.
ecs_entity_t * ecs_set_lookup_path(ecs_world_t *world, const ecs_entity_t *lookup_path)
Set search path for lookup operations.
ecs_entity_t ecs_set_name(ecs_world_t *world, ecs_entity_t entity, const char *name)
Set the name of an entity.
const char * ecs_get_symbol(const ecs_world_t *world, ecs_entity_t entity)
Get the symbol of an entity.
ecs_entity_t ecs_lookup_path_w_sep(const ecs_world_t *world, ecs_entity_t parent, const char *path, const char *sep, const char *prefix, bool recursive)
Lookup an entity from a path.
ecs_entity_t ecs_set_symbol(ecs_world_t *world, ecs_entity_t entity, const char *symbol)
Set the symbol of an entity.
ecs_entity_t ecs_lookup_child(const ecs_world_t *world, ecs_entity_t parent, const char *name)
Lookup a child entity by name.
const char * ecs_get_name(const ecs_world_t *world, ecs_entity_t entity)
Get the name of an entity.
ecs_entity_t ecs_add_path_w_sep(ecs_world_t *world, ecs_entity_t entity, ecs_entity_t parent, const char *path, const char *sep, const char *prefix)
Add specified path to entity.
ecs_entity_t * ecs_get_lookup_path(const ecs_world_t *world)
Get current lookup path.
ecs_entity_t ecs_set_scope(ecs_world_t *world, ecs_entity_t scope)
Set the current scope.
const char * ecs_set_name_prefix(ecs_world_t *world, const char *prefix)
Set a name prefix for newly created entities.
void ecs_iter_skip(ecs_iter_t *it)
Skip a table while iterating.
void ecs_iter_set_group(ecs_iter_t *it, uint64_t group_id)
Set group to iterate for query iterator.
bool ecs_query_next(ecs_iter_t *it)
Progress query iterator.
const ecs_query_group_info_t * ecs_query_get_group_info(const ecs_query_t *query, uint64_t group_id)
Get information about query group.
bool ecs_query_has(ecs_query_t *query, ecs_entity_t entity, ecs_iter_t *it)
Match entity with query.
bool ecs_query_is_true(const ecs_query_t *query)
Does query return one or more results.
char * ecs_term_str(const ecs_world_t *world, const ecs_term_t *term)
Convert term to string expression.
int32_t ecs_query_find_var(const ecs_query_t *query, const char *name)
Find variable index.
void ecs_query_fini(ecs_query_t *query)
Delete a query.
char * ecs_query_plan_w_profile(const ecs_query_t *query, const ecs_iter_t *it)
Convert query to string with profile.
struct ecs_query_desc_t ecs_query_desc_t
Used with ecs_query_init().
const char * ecs_query_args_parse(ecs_query_t *query, ecs_iter_t *it, const char *expr)
Populate variables from key-value string.
int32_t ecs_query_match_count(const ecs_query_t *query)
Returns how often a match event happened for a cached query.
char * ecs_query_plan(const ecs_query_t *query)
Convert query to a string.
ecs_iter_t ecs_query_iter(const ecs_world_t *world, const ecs_query_t *query)
Create a query iterator.
char * ecs_query_str(const ecs_query_t *query)
Convert query to string expression.
bool ecs_query_var_is_entity(const ecs_query_t *query, int32_t var_id)
Test if variable is an entity.
ecs_query_t * ecs_query_init(ecs_world_t *world, const ecs_query_desc_t *desc)
Create a query.
bool ecs_query_changed(ecs_query_t *query)
Returns whether the query data changed since the last iteration.
bool ecs_query_has_range(ecs_query_t *query, ecs_table_range_t *range, ecs_iter_t *it)
Match range with query.
const char * ecs_query_var_name(const ecs_query_t *query, int32_t var_id)
Get variable name.
bool ecs_term_match_this(const ecs_term_t *term)
Is term matched on $this variable.
bool ecs_query_has_table(ecs_query_t *query, ecs_table_t *table, ecs_iter_t *it)
Match table with query.
void * ecs_query_get_group_ctx(const ecs_query_t *query, uint64_t group_id)
Get context of query group.
ecs_query_count_t ecs_query_count(const ecs_query_t *query)
Returns number of entities and results the query matches with.
bool ecs_term_ref_is_set(const ecs_term_ref_t *id)
Test whether term id is set.
bool ecs_term_is_initialized(const ecs_term_t *term)
Test whether a term is set.
struct ecs_query_count_t ecs_query_count_t
Struct returned by ecs_query_count().
bool ecs_term_match_0(const ecs_term_t *term)
Is term matched on 0 source.
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:675
ecs_inout_kind_t
Specify read/write access for term.
Definition flecs.h:654
ecs_oper_kind_t
Specify operator for term.
Definition flecs.h:664
@ EcsQueryCacheAll
Require that all query terms can be cached.
Definition flecs.h:678
@ EcsQueryCacheDefault
Behavior determined by query creation context.
Definition flecs.h:676
@ EcsQueryCacheNone
No caching.
Definition flecs.h:679
@ EcsQueryCacheAuto
Cache query terms that are cacheable.
Definition flecs.h:677
@ EcsOut
Term is only written.
Definition flecs.h:660
@ EcsInOut
Term is both read and written.
Definition flecs.h:658
@ EcsInOutFilter
Same as InOutNone + prevents term from triggering observers.
Definition flecs.h:657
@ EcsInOutDefault
InOut for regular terms, In for shared terms.
Definition flecs.h:655
@ EcsInOutNone
Term is neither read nor written.
Definition flecs.h:656
@ EcsIn
Term is only read.
Definition flecs.h:659
@ EcsNot
The term must not match.
Definition flecs.h:667
@ EcsOptional
The term may match.
Definition flecs.h:668
@ EcsOr
One of the terms in an or chain must match.
Definition flecs.h:666
@ EcsOrFrom
Term must match at least one component from term id.
Definition flecs.h:670
@ EcsAnd
The term must match.
Definition flecs.h:665
@ EcsNotFrom
Term must match none of the components from term id.
Definition flecs.h:671
@ EcsAndFrom
Term must match all components from term id.
Definition flecs.h:669
ecs_table_t * ecs_table_add_id(ecs_world_t *world, ecs_table_t *table, ecs_id_t id)
Get table that has all components of current table plus the specified id.
int32_t ecs_search(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t id, ecs_id_t *id_out)
Search for component id in table type.
const ecs_type_t * ecs_table_get_type(const ecs_table_t *table)
Get type for table.
int32_t ecs_search_offset(const ecs_world_t *world, const ecs_table_t *table, int32_t offset, ecs_id_t id, ecs_id_t *id_out)
Search for component id in table type starting from an offset.
int32_t ecs_table_size(const ecs_table_t *table)
Returns allocated size of table.
bool ecs_table_has_flags(ecs_table_t *table, ecs_flags32_t flags)
Test table for flags.
int32_t ecs_table_column_to_type_index(const ecs_table_t *table, int32_t index)
Convert column index to type index.
int32_t ecs_table_column_count(const ecs_table_t *table)
Return number of columns in table.
bool ecs_commit(ecs_world_t *world, ecs_entity_t entity, ecs_record_t *record, ecs_table_t *table, const ecs_type_t *added, const ecs_type_t *removed)
Commit (move) entity to a table.
void * ecs_table_get_column(const ecs_table_t *table, int32_t index, int32_t offset)
Get column from table by column index.
bool ecs_table_has_id(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t id)
Test if table has id.
ecs_table_t * ecs_table_remove_id(ecs_world_t *world, ecs_table_t *table, ecs_id_t id)
Get table that has all components of current table minus the specified id.
int32_t ecs_table_count(const ecs_table_t *table)
Returns the number of entities in the table.
const ecs_entity_t * ecs_table_entities(const ecs_table_t *table)
Returns array with entity ids for table.
void ecs_table_unlock(ecs_world_t *world, ecs_table_t *table)
Unlock a table.
int32_t ecs_table_get_depth(const ecs_world_t *world, const ecs_table_t *table, ecs_entity_t rel)
Return depth for table in tree for relationship rel.
void * ecs_table_get_id(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t id, int32_t offset)
Get column from table by component id.
void ecs_table_swap_rows(ecs_world_t *world, ecs_table_t *table, int32_t row_1, int32_t row_2)
Swaps two elements inside the table.
int32_t ecs_table_get_column_index(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t id)
Get column index for id.
void ecs_table_lock(ecs_world_t *world, ecs_table_t *table)
Lock a table.
ecs_table_t * ecs_table_find(ecs_world_t *world, const ecs_id_t *ids, int32_t id_count)
Find table from id array.
int32_t ecs_table_get_type_index(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t id)
Get type index for id.
size_t ecs_table_get_column_size(const ecs_table_t *table, int32_t index)
Get column size from table.
int32_t ecs_search_relation(const ecs_world_t *world, const ecs_table_t *table, int32_t offset, ecs_id_t id, ecs_entity_t rel, ecs_flags64_t flags, ecs_entity_t *subject_out, ecs_id_t *id_out, struct ecs_table_record_t **tr_out)
Search for component/relationship id in table type starting from an offset.
int32_t ecs_table_type_to_column_index(const ecs_table_t *table, int32_t index)
Convert type index to column index.
int ecs_value_fini_w_type_info(const ecs_world_t *world, const ecs_type_info_t *ti, void *ptr)
Destruct a value.
int ecs_value_fini(const ecs_world_t *world, ecs_entity_t type, void *ptr)
Destruct a value.
int ecs_value_copy(const ecs_world_t *world, ecs_entity_t type, void *dst, const void *src)
Copy value.
int ecs_value_move(const ecs_world_t *world, ecs_entity_t type, void *dst, void *src)
Move value.
int ecs_value_move_w_type_info(const ecs_world_t *world, const ecs_type_info_t *ti, void *dst, void *src)
Move value.
void * ecs_value_new_w_type_info(ecs_world_t *world, const ecs_type_info_t *ti)
Construct a value in new storage.
int ecs_value_move_ctor_w_type_info(const ecs_world_t *world, const ecs_type_info_t *ti, void *dst, void *src)
Move construct value.
int ecs_value_copy_w_type_info(const ecs_world_t *world, const ecs_type_info_t *ti, void *dst, const void *src)
Copy value.
int ecs_value_init_w_type_info(const ecs_world_t *world, const ecs_type_info_t *ti, void *ptr)
Construct a value in existing storage.
void * ecs_value_new(ecs_world_t *world, ecs_entity_t type)
Construct a value in new storage.
int ecs_value_free(ecs_world_t *world, ecs_entity_t type, void *ptr)
Destruct a value, free storage.
int ecs_value_move_ctor(const ecs_world_t *world, ecs_entity_t type, void *dst, void *src)
Move construct value.
int ecs_value_init(const ecs_world_t *world, ecs_entity_t type, void *ptr)
Construct a value in existing storage.
struct ecs_entities_t ecs_entities_t
Type returned by ecs_get_entities().
void ecs_atfini(ecs_world_t *world, ecs_fini_action_t action, void *ctx)
Register action to be executed when world is destroyed.
bool ecs_is_fini(const ecs_world_t *world)
Returns whether the world is being deleted.
int ecs_fini(ecs_world_t *world)
Delete a world.
ecs_world_t * ecs_mini(void)
Create a new world with just the core module.
ecs_world_t * ecs_init(void)
Create a new world.
ecs_world_t * ecs_init_w_args(int argc, char *argv[])
Create a new world with arguments.
ecs_entities_t ecs_get_entities(const ecs_world_t *world)
Return entity identifiers in world.
void ecs_set_target_fps(ecs_world_t *world, float fps)
Set target frames per second (FPS) for application.
void ecs_measure_system_time(ecs_world_t *world, bool enable)
Measure system time.
float ecs_frame_begin(ecs_world_t *world, float delta_time)
Begin frame.
void ecs_run_post_frame(ecs_world_t *world, ecs_fini_action_t action, void *ctx)
Register action to be executed once after frame.
bool ecs_should_quit(const ecs_world_t *world)
Return whether a quit has been requested.
void ecs_set_default_query_flags(ecs_world_t *world, ecs_flags32_t flags)
Set default query flags.
void ecs_quit(ecs_world_t *world)
Signal exit This operation signals that the application should quit.
void ecs_measure_frame_time(ecs_world_t *world, bool enable)
Measure frame time.
void ecs_frame_end(ecs_world_t *world)
End frame.
ecs_entity_t ecs_get_entity(const ecs_poly_t *poly)
Get entity from poly.
ecs_id_t ecs_make_pair(ecs_entity_t first, ecs_entity_t second)
Make a pair id.
const ecs_build_info_t * ecs_get_build_info(void)
Get build info.
bool flecs_poly_is_(const ecs_poly_t *object, int32_t type)
Test if pointer is of specified type.
ecs_entity_t ecs_get_max_id(const ecs_world_t *world)
Get the largest issued entity id (not counting generation).
void ecs_run_aperiodic(ecs_world_t *world, ecs_flags32_t flags)
Force aperiodic actions.
void * ecs_get_binding_ctx(const ecs_world_t *world)
Get the world binding context.
void ecs_dim(ecs_world_t *world, int32_t entity_count)
Dimension the world for a specified number of entities.
void ecs_set_entity_range(ecs_world_t *world, ecs_entity_t id_start, ecs_entity_t id_end)
Set a range for issuing new entity ids.
const ecs_world_info_t * ecs_get_world_info(const ecs_world_t *world)
Get world info.
const ecs_world_t * ecs_get_world(const ecs_poly_t *poly)
Get world from poly.
void ecs_set_ctx(ecs_world_t *world, void *ctx, ecs_ctx_free_t ctx_free)
Set a world context.
int32_t ecs_delete_empty_tables(ecs_world_t *world, ecs_id_t id, uint16_t clear_generation, uint16_t delete_generation, int32_t min_id_count, double time_budget_seconds)
Cleanup empty tables.
void ecs_set_binding_ctx(ecs_world_t *world, void *ctx, ecs_ctx_free_t ctx_free)
Set a world binding context.
bool ecs_enable_range_check(ecs_world_t *world, bool enable)
Enable/disable range limits.
void * ecs_get_ctx(const ecs_world_t *world)
Get the world context.
Operating system abstraction API.
Component information.
Definition flecs.h:1437
ecs_size_t size
Component size.
Definition flecs.h:1438
ecs_size_t alignment
Component alignment.
Definition flecs.h:1439
When added to an entity this informs serialization formats which component to use when a value is ass...
Definition flecs.h:1452
ecs_id_t component
Default component id.
Definition flecs.h:1453
A (string) identifier.
Definition flecs.h:1428
ecs_size_t length
Length of identifier.
Definition flecs.h:1430
char * value
Identifier string.
Definition flecs.h:1429
ecs_hashmap_t * index
Current index.
Definition flecs.h:1433
uint64_t hash
Hash of current value.
Definition flecs.h:1431
uint64_t index_hash
Hash of existing record in current index.
Definition flecs.h:1432
Component for storing a poly object.
Definition flecs.h:1443
ecs_poly_t * poly
Pointer to poly object.
Definition flecs.h:1444
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:1340
int16_t version_major
Major flecs version.
Definition flecs.h:1344
const char ** addons
Addons included in build.
Definition flecs.h:1342
const char * version
Stringified version.
Definition flecs.h:1343
const char * compiler
Compiler used to compile flecs.
Definition flecs.h:1341
bool sanitize
Is this a sanitize build.
Definition flecs.h:1348
bool perf_trace
Is this a perf tracing build.
Definition flecs.h:1349
int16_t version_minor
Minor flecs version.
Definition flecs.h:1345
bool debug
Is this a debug build.
Definition flecs.h:1347
int16_t version_patch
Patch flecs version.
Definition flecs.h:1346
Used with ecs_bulk_init().
Definition flecs.h:972
void ** data
Array with component data to insert.
Definition flecs.h:984
ecs_id_t ids[(32)]
Ids to create the entities with.
Definition flecs.h:982
int32_t count
Number of entities to create/populate.
Definition flecs.h:980
int32_t _canary
Used for validity testing.
Definition flecs.h:973
ecs_entity_t * entities
Entities to bulk insert.
Definition flecs.h:975
ecs_table_t * table
Table to insert the entities into.
Definition flecs.h:991
Used with ecs_component_init().
Definition flecs.h:1002
int32_t _canary
Used for validity testing.
Definition flecs.h:1003
ecs_type_info_t type
Parameters for type (size, hooks, ...)
Definition flecs.h:1009
ecs_entity_t entity
Existing entity to associate with observer (optional)
Definition flecs.h:1006
Type returned by ecs_get_entities().
Definition flecs.h:1907
int32_t alive_count
Number of alive entity ids.
Definition flecs.h:1910
int32_t count
Total number of entity ids.
Definition flecs.h:1909
const ecs_entity_t * ids
Array with all entity ids in the world.
Definition flecs.h:1908
Used with ecs_entity_init().
Definition flecs.h:926
const char * sep
Optional custom separator for hierarchical names.
Definition flecs.h:938
const char * root_sep
Optional, used for identifiers relative to root.
Definition flecs.h:942
const char * name
Name of the entity.
Definition flecs.h:933
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:954
const char * symbol
Optional entity symbol.
Definition flecs.h:944
int32_t _canary
Used for validity testing.
Definition flecs.h:927
const ecs_id_t * add
0-terminated array of ids to add to the entity.
Definition flecs.h:959
const char * add_expr
String expression with components to add.
Definition flecs.h:965
const ecs_value_t * set
0-terminated array of values to set on the entity.
Definition flecs.h:962
ecs_entity_t id
Set to modify existing entity (optional)
Definition flecs.h:929
ecs_entity_t parent
Parent entity.
Definition flecs.h:931
Used with ecs_emit().
Definition flecs.h:1286
ecs_entity_t entity
Single-entity alternative to setting table / offset / count.
Definition flecs.h:1311
const void * const_param
Same as param, but with the guarantee that the value won't be modified.
Definition flecs.h:1322
ecs_table_t * table
The table for which to notify.
Definition flecs.h:1296
int32_t count
Limit number of notified entities to count.
Definition flecs.h:1308
ecs_table_t * other_table
Optional 2nd table to notify.
Definition flecs.h:1300
int32_t offset
Limit notified entities to ones starting from offset (row) in table.
Definition flecs.h:1303
const ecs_type_t * ids
Component ids.
Definition flecs.h:1293
ecs_poly_t * observable
Observable (usually the world)
Definition flecs.h:1325
ecs_entity_t event
The event id.
Definition flecs.h:1288
ecs_flags32_t flags
Event flags.
Definition flecs.h:1328
void * param
Optional context.
Definition flecs.h:1317
Header for ecs_poly_t objects.
Definition flecs.h:478
int32_t magic
Magic number verifying it's a flecs object.
Definition flecs.h:479
int32_t type
Magic number indicating which type of flecs object.
Definition flecs.h:480
int32_t refcount
Refcount, to enable RAII handles.
Definition flecs.h:481
ecs_mixins_t * mixins
Table with offsets to (optional) mixins.
Definition flecs.h:482
Iterator.
Definition flecs.h:1050
ecs_world_t * real_world
Actual world.
Definition flecs.h:1053
void * param
Param passed to ecs_run.
Definition flecs.h:1087
ecs_entity_t event
The event (if applicable)
Definition flecs.h:1073
int32_t frame_offset
Offset relative to start of iteration.
Definition flecs.h:1098
char ** variable_names
Names of variables (if any)
Definition flecs.h:1084
ecs_flags32_t ref_fields
Bitset with fields that aren't component arrays.
Definition flecs.h:1067
int8_t variable_count
Number of variables for query.
Definition flecs.h:1082
ecs_entity_t interrupted_by
When set, system execution is interrupted.
Definition flecs.h:1104
ecs_flags32_t flags
Iterator flags.
Definition flecs.h:1103
ecs_iter_t * chain_it
Optional, allows for creating iterator chains.
Definition flecs.h:1111
void * ctx
System context.
Definition flecs.h:1088
void * run_ctx
Run language binding context.
Definition flecs.h:1091
ecs_table_t * table
Current table.
Definition flecs.h:1058
int32_t offset
Offset relative to current table.
Definition flecs.h:1099
ecs_id_t event_id
The (component) id for the event.
Definition flecs.h:1074
ecs_iter_fini_action_t fini
Function to cleanup iterator resources.
Definition flecs.h:1110
ecs_var_t * variables
Values of variables (if any)
Definition flecs.h:1061
ecs_iter_private_t priv_
Private data.
Definition flecs.h:1105
ecs_world_t * world
The world.
Definition flecs.h:1052
void * callback_ctx
Callback language binding context.
Definition flecs.h:1090
ecs_entity_t * sources
Entity on which the id was matched (0 if same as entities)
Definition flecs.h:1063
void * binding_ctx
System binding context.
Definition flecs.h:1089
ecs_flags32_t row_fields
Fields that must be obtained with field_at.
Definition flecs.h:1068
float delta_system_time
Time elapsed since last system invocation.
Definition flecs.h:1095
const ecs_query_t * query
Query being evaluated.
Definition flecs.h:1083
int8_t term_index
Index of term that emitted an event.
Definition flecs.h:1079
ecs_entity_t system
The system (if applicable)
Definition flecs.h:1072
ecs_flags32_t set_fields
Fields that are set.
Definition flecs.h:1066
const ecs_size_t * sizes
Component sizes.
Definition flecs.h:1057
float delta_time
Time elapsed since last frame.
Definition flecs.h:1094
ecs_flags32_t up_fields
Bitset with fields matched through up traversal.
Definition flecs.h:1069
ecs_iter_action_t callback
Callback of system or observer.
Definition flecs.h:1109
int8_t field_count
Number of fields in iterator.
Definition flecs.h:1078
ecs_table_t * other_table
Prev or next table when adding/removing.
Definition flecs.h:1059
int32_t event_cur
Unique event id.
Definition flecs.h:1075
const ecs_table_record_t ** trs
Info on where to find field in table.
Definition flecs.h:1062
int32_t count
Number of entities to iterate.
Definition flecs.h:1100
uint64_t group_id
Group id for table, if group_by is used.
Definition flecs.h:1065
ecs_iter_next_action_t next
Function to progress iterator.
Definition flecs.h:1108
const ecs_entity_t * entities
Entity identifiers.
Definition flecs.h:1056
ecs_id_t * ids
(Component) ids
Definition flecs.h:1060
ecs_flags64_t constrained_vars
Bitset that marks constrained variables.
Definition flecs.h:1064
Used with ecs_observer_init().
Definition flecs.h:1224
ecs_ctx_free_t run_ctx_free
Callback to free run ctx.
Definition flecs.h:1268
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:1256
void * run_ctx
Context associated with run (for language bindings).
Definition flecs.h:1265
ecs_entity_t entity
Existing entity to associate with observer (optional)
Definition flecs.h:1229
ecs_entity_t events[(8)]
Events to observe (OnAdd, OnRemove, OnSet)
Definition flecs.h:1235
int32_t * last_event_id
Optional shared last event id for multiple observers.
Definition flecs.h:1275
void * callback_ctx
Context associated with callback (for language bindings).
Definition flecs.h:1259
void * ctx
User context to pass to callback.
Definition flecs.h:1253
ecs_query_desc_t query
Query for observer.
Definition flecs.h:1232
ecs_poly_t * observable
Observable with which to register the observer.
Definition flecs.h:1271
ecs_ctx_free_t callback_ctx_free
Callback to free callback ctx.
Definition flecs.h:1262
int8_t term_index_
Used for internal purposes.
Definition flecs.h:1278
ecs_iter_action_t callback
Callback to invoke on an event, invoked when the observer matches.
Definition flecs.h:1242
bool yield_existing
When observer is created, generate events from existing data.
Definition flecs.h:1239
ecs_run_action_t run
Callback invoked on an event.
Definition flecs.h:1250
int32_t _canary
Used for validity testing.
Definition flecs.h:1226
An observer reacts to events matching a query.
Definition flecs.h:823
int32_t event_count
Number of events.
Definition flecs.h:830
ecs_iter_action_t callback
See ecs_observer_desc_t::callback.
Definition flecs.h:832
ecs_entity_t entity
Entity associated with observer.
Definition flecs.h:846
ecs_observable_t * observable
Observable for observer.
Definition flecs.h:843
ecs_run_action_t run
See ecs_observer_desc_t::run.
Definition flecs.h:833
ecs_header_t hdr
Object header.
Definition flecs.h:824
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:839
void * run_ctx
Run language binding context.
Definition flecs.h:837
ecs_world_t * world
The world.
Definition flecs.h:845
ecs_ctx_free_t run_ctx_free
Callback to free run_ctx.
Definition flecs.h:841
void * callback_ctx
Callback language binding context.
Definition flecs.h:836
void * ctx
Observer context.
Definition flecs.h:835
ecs_entity_t events[(8)]
Observer events.
Definition flecs.h:829
ecs_ctx_free_t callback_ctx_free
Callback to free callback_ctx.
Definition flecs.h:840
ecs_query_t * query
Observer query.
Definition flecs.h:826
Struct returned by ecs_query_count().
Definition flecs.h:4892
int32_t empty_tables
Number of empty tables returned by query.
Definition flecs.h:4896
int32_t entities
Number of entities returned by query.
Definition flecs.h:4894
int32_t results
Number of results returned by query.
Definition flecs.h:4893
int32_t tables
Number of tables returned by query.
Definition flecs.h:4895
Used with ecs_query_init().
Definition flecs.h:1150
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:1211
ecs_id_t group_by
Component id to be used for grouping.
Definition flecs.h:1181
ecs_term_t terms[32]
Query terms.
Definition flecs.h:1155
int32_t _canary
Used for validity testing.
Definition flecs.h:1152
void * ctx
User context to pass to callback.
Definition flecs.h:1205
ecs_ctx_free_t group_by_ctx_free
Function to free group_by_ctx.
Definition flecs.h:1202
void * group_by_ctx
Context to pass to group_by.
Definition flecs.h:1199
void * binding_ctx
Context to be used for language bindings.
Definition flecs.h:1208
ecs_entity_t order_by
Component to sort on, used together with order_by_callback or order_by_table_callback.
Definition flecs.h:1177
ecs_order_by_action_t order_by_callback
Callback used for ordering query results.
Definition flecs.h:1169
ecs_group_create_action_t on_group_create
Callback that is invoked when a new group is created.
Definition flecs.h:1192
ecs_entity_t entity
Entity associated with query (optional)
Definition flecs.h:1217
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:1214
ecs_group_by_action_t group_by_callback
Callback used for grouping results.
Definition flecs.h:1188
ecs_group_delete_action_t on_group_delete
Callback that is invoked when an existing group is deleted.
Definition flecs.h:1196
ecs_sort_table_action_t order_by_table_callback
Callback used for ordering query results.
Definition flecs.h:1173
ecs_flags32_t flags
Flags for enabling query features.
Definition flecs.h:1164
ecs_query_cache_kind_t cache_kind
Caching policy of query.
Definition flecs.h:1161
const char * expr
Query DSL expression (optional)
Definition flecs.h:1158
Type that contains information about a query group.
Definition flecs.h:1412
int32_t table_count
Number of tables in group.
Definition flecs.h:1414
void * ctx
Group context, returned by on_group_create.
Definition flecs.h:1415
int32_t match_count
How often tables have been matched/unmatched.
Definition flecs.h:1413
Queries are lists of constraints (terms) that match entities.
Definition flecs.h:784
ecs_flags32_t row_fields
Fields that must be acquired with field_at.
Definition flecs.h:802
ecs_flags32_t data_fields
Fields that have data.
Definition flecs.h:799
ecs_flags32_t read_fields
Fields that read data.
Definition flecs.h:801
ecs_header_t hdr
Object header.
Definition flecs.h:785
ecs_term_t terms[32]
Query terms.
Definition flecs.h:787
int8_t var_count
Number of query variables.
Definition flecs.h:792
ecs_flags32_t fixed_fields
Fields with a fixed source.
Definition flecs.h:797
ecs_flags32_t write_fields
Fields that write data.
Definition flecs.h:800
int32_t sizes[32]
Component sizes.
Definition flecs.h:788
int32_t eval_count
Number of times query is evaluated.
Definition flecs.h:817
ecs_world_t * world
World or stage query was created with.
Definition flecs.h:815
ecs_flags32_t static_id_fields
Fields with a static (component) id.
Definition flecs.h:798
ecs_world_t * real_world
Actual world.
Definition flecs.h:814
ecs_flags32_t set_fields
Fields that will be set.
Definition flecs.h:804
ecs_entity_t entity
Entity associated with query (optional)
Definition flecs.h:813
void * ctx
User context to pass to callback.
Definition flecs.h:810
ecs_flags32_t shared_readonly_fields
Fields that don't write shared data.
Definition flecs.h:803
ecs_id_t ids[32]
Component ids.
Definition flecs.h:789
ecs_query_cache_kind_t cache_kind
Caching policy of query.
Definition flecs.h:806
int8_t term_count
Number of query terms.
Definition flecs.h:793
char ** vars
Array with variable names for iterator.
Definition flecs.h:808
int8_t field_count
Number of fields returned by query.
Definition flecs.h:794
ecs_flags32_t flags
Query flags.
Definition flecs.h:791
void * binding_ctx
Context to be used for language bindings.
Definition flecs.h:811
Record for entity index.
Definition flecs.h:486
ecs_table_t * table
Identifies a type (and table) in world.
Definition flecs.h:488
uint32_t row
Table row of the entity.
Definition flecs.h:489
ecs_id_record_t * idr
Id record to (*, entity) for target entities.
Definition flecs.h:487
int32_t dense
Index in dense array of entity index.
Definition flecs.h:490
Header for table cache elements.
Definition flecs.h:494
bool empty
Whether element is in empty list.
Definition flecs.h:498
struct ecs_table_cache_hdr_t * next
Next/previous elements for id in table cache.
Definition flecs.h:497
struct ecs_table_cache_t * cache
Table cache of element.
Definition flecs.h:495
ecs_table_t * table
Table associated with element.
Definition flecs.h:496
Metadata describing where a component id is stored in a table.
Definition flecs.h:505
ecs_table_cache_hdr_t hdr
Table cache header.
Definition flecs.h:506
int16_t index
First type index where id occurs in table.
Definition flecs.h:507
int16_t column
First column index where id occurs.
Definition flecs.h:509
int16_t count
Number of times id occurs in table.
Definition flecs.h:508
Type that describes a reference to an entity or variable in a term.
Definition flecs.h:745
const char * name
Name.
Definition flecs.h:752
ecs_entity_t id
Entity id.
Definition flecs.h:746
Type that describes a term (single element in a query).
Definition flecs.h:760
ecs_term_ref_t src
Source of term.
Definition flecs.h:766
int8_t field_index
Index of field for term in iterator.
Definition flecs.h:777
ecs_id_t id
Component id to be matched by term.
Definition flecs.h:761
int16_t oper
Operator of term.
Definition flecs.h:775
ecs_term_ref_t second
Second element of pair.
Definition flecs.h:768
ecs_flags16_t flags_
Flags that help eval, set by ecs_query_init()
Definition flecs.h:778
ecs_entity_t trav
Relationship to traverse when looking for the component.
Definition flecs.h:770
int16_t inout
Access to contents matched by term.
Definition flecs.h:774
ecs_term_ref_t first
Component or first element of pair.
Definition flecs.h:767
Type that contains component lifecycle callbacks.
Definition flecs.h:855
ecs_copy_t copy_ctor
Ctor + copy.
Definition flecs.h:862
void * ctx
User defined context.
Definition flecs.h:893
ecs_iter_action_t on_remove
Callback that is invoked when an instance of the component is removed.
Definition flecs.h:891
void * binding_ctx
Language binding context.
Definition flecs.h:894
ecs_move_t move_dtor
Move + dtor.
Definition flecs.h:877
ecs_copy_t copy
copy assignment
Definition flecs.h:858
ecs_iter_action_t on_set
Callback that is invoked when an instance of the component is set.
Definition flecs.h:886
ecs_move_t move
move assignment
Definition flecs.h:859
ecs_xtor_t ctor
ctor
Definition flecs.h:856
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:896
ecs_iter_action_t on_add
Callback that is invoked when an instance of a component is added.
Definition flecs.h:881
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:897
ecs_move_t move_ctor
Ctor + move.
Definition flecs.h:865
ecs_move_t ctor_move_dtor
Ctor + move + dtor (or move_ctor + dtor).
Definition flecs.h:871
ecs_xtor_t dtor
dtor
Definition flecs.h:857
Type that contains component information (passed to ctors/dtors/...)
Definition flecs.h:904
ecs_size_t alignment
Alignment of type.
Definition flecs.h:906
ecs_size_t size
Size of type.
Definition flecs.h:905
const char * name
Type name.
Definition flecs.h:909
ecs_entity_t component
Handle to component (do not set)
Definition flecs.h:908
ecs_type_hooks_t hooks
Type hooks.
Definition flecs.h:907
A type is a list of (component) ids.
Definition flecs.h:356
ecs_id_t * array
Array with ids.
Definition flecs.h:357
int32_t count
Number of elements in array.
Definition flecs.h:358
Utility to hold a value of a dynamic type.
Definition flecs.h:917
void * ptr
Pointer to value.
Definition flecs.h:919
ecs_entity_t type
Type of value.
Definition flecs.h:918
Type that contains information about the world.
Definition flecs.h:1353
float delta_time
Time passed to or computed by ecs_progress()
Definition flecs.h:1359
ecs_entity_t min_id
First allowed entity id.
Definition flecs.h:1355
int64_t set_count
Set commands processed.
Definition flecs.h:1395
double world_time_total
Time elapsed in simulation.
Definition flecs.h:1367
int32_t tag_id_count
Number of tag (no data) ids in the world.
Definition flecs.h:1382
int32_t component_id_count
Number of component (data) ids in the world.
Definition flecs.h:1383
int64_t pipeline_build_count_total
Total number of pipeline builds.
Definition flecs.h:1378
int32_t table_count
Number of tables.
Definition flecs.h:1386
float delta_time_raw
Raw delta time (no time scaling)
Definition flecs.h:1358
float frame_time_total
Total time spent processing a frame.
Definition flecs.h:1362
int64_t table_create_total
Total number of times a table was created.
Definition flecs.h:1376
int64_t observers_ran_frame
Total number of times observer was invoked.
Definition flecs.h:1380
float system_time_total
Total time spent in systems.
Definition flecs.h:1363
int64_t id_delete_total
Total number of times an id was deleted.
Definition flecs.h:1375
int64_t systems_ran_frame
Total number of systems ran in last frame.
Definition flecs.h:1379
float merge_time_total
Total time spent in merges.
Definition flecs.h:1365
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:1398
int64_t clear_count
Clear commands processed.
Definition flecs.h:1394
ecs_entity_t last_component_id
Last issued component entity id.
Definition flecs.h:1354
int32_t empty_table_count
Number of tables without entities.
Definition flecs.h:1387
int64_t frame_count_total
Total number of frames.
Definition flecs.h:1370
ecs_entity_t max_id
Last allowed entity id.
Definition flecs.h:1356
int64_t merge_count_total
Total number of merges.
Definition flecs.h:1371
int64_t other_count
Other commands processed.
Definition flecs.h:1400
int64_t batched_command_count
Commands batched.
Definition flecs.h:1402
int64_t table_delete_total
Total number of times a table was deleted.
Definition flecs.h:1377
int64_t delete_count
Selete commands processed.
Definition flecs.h:1393
int64_t rematch_count_total
Total number of rematches.
Definition flecs.h:1372
int64_t id_create_total
Total number of times a new id was created.
Definition flecs.h:1374
int64_t batched_entity_count
Entities for which commands were batched.
Definition flecs.h:1401
float time_scale
Time scale applied to delta_time.
Definition flecs.h:1360
int32_t pair_id_count
Number of pair ids in the world.
Definition flecs.h:1384
float rematch_time_total
Time spent on query rematching.
Definition flecs.h:1366
int64_t ensure_count
Ensure/emplace commands processed.
Definition flecs.h:1396
float target_fps
Target fps.
Definition flecs.h:1361
double world_time_total_raw
Time elapsed in simulation (no scaling)
Definition flecs.h:1368
float emit_time_total
Total time spent notifying observers.
Definition flecs.h:1364
int64_t modified_count
Modified commands processed.
Definition flecs.h:1397
const char * name_prefix
Value set by ecs_set_name_prefix().
Definition flecs.h:1405
int64_t event_count
Enqueued custom events.
Definition flecs.h:1399
int64_t add_count
Add commands processed.
Definition flecs.h:1391
int64_t remove_count
Remove commands processed.
Definition flecs.h:1392