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
79// #define FLECS_DISABLE_COUNTERS
80
81/* Make sure provided configuration is valid */
82#if defined(FLECS_DEBUG) && defined(FLECS_NDEBUG)
83#error "invalid configuration: cannot both define FLECS_DEBUG and FLECS_NDEBUG"
84#endif
85#if defined(FLECS_DEBUG) && defined(NDEBUG)
86#error "invalid configuration: cannot both define FLECS_DEBUG and NDEBUG"
87#endif
88
93#if !defined(FLECS_DEBUG) && !defined(FLECS_NDEBUG)
94#if defined(NDEBUG)
95#define FLECS_NDEBUG
96#else
97#define FLECS_DEBUG
98#endif
99#endif
100
105#ifdef FLECS_SANITIZE
106#ifndef FLECS_DEBUG
107#define FLECS_DEBUG /* If sanitized mode is enabled, so is debug mode */
108#endif
109#endif
110
111/* Tip: if you see weird behavior that you think might be a bug, make sure to
112 * test with the FLECS_DEBUG or FLECS_SANITIZE flags enabled. There's a good
113 * chance that this gives you more information about the issue! */
114
128// #define FLECS_SOFT_ASSERT
129
135// #define FLECS_KEEP_ASSERT
136
145// #define FLECS_CPP_NO_AUTO_REGISTRATION
146
174// #define FLECS_CUSTOM_BUILD
175
184// #define FLECS_CPP_NO_AUTO_REGISTRATION
185
186#ifndef FLECS_CUSTOM_BUILD
187// #define FLECS_C /**< C API convenience macros, always enabled */
188#define FLECS_CPP
189#define FLECS_MODULE
190#define FLECS_SCRIPT
191#define FLECS_STATS
192#define FLECS_METRICS
193#define FLECS_ALERTS
194#define FLECS_SYSTEM
195#define FLECS_PIPELINE
196#define FLECS_TIMER
197#define FLECS_META
198#define FLECS_UNITS
199#define FLECS_JSON
200#define FLECS_DOC
201#define FLECS_LOG
202#define FLECS_APP
203#define FLECS_OS_API_IMPL
204#define FLECS_HTTP
205#define FLECS_REST
206// #define FLECS_JOURNAL /**< Journaling addon (disabled by default) */
207// #define FLECS_PERF_TRACE /**< Enable performance tracing (disabled by default) */
208#endif // ifndef FLECS_CUSTOM_BUILD
209
213// #define FLECS_LOW_FOOTPRINT
214#ifdef FLECS_LOW_FOOTPRINT
215#define FLECS_HI_COMPONENT_ID (16)
216#define FLECS_HI_ID_RECORD_ID (16)
217#define FLECS_SPARSE_PAGE_BITS (6)
218#define FLECS_ENTITY_PAGE_BITS (6)
219#define FLECS_USE_OS_ALLOC
220#endif
221
232#ifndef FLECS_HI_COMPONENT_ID
233#define FLECS_HI_COMPONENT_ID (256)
234#endif
235
242#ifndef FLECS_HI_ID_RECORD_ID
243#define FLECS_HI_ID_RECORD_ID (1024)
244#endif
245
251#ifndef FLECS_SPARSE_PAGE_BITS
252#define FLECS_SPARSE_PAGE_BITS (12)
253#endif
254
257#ifndef FLECS_ENTITY_PAGE_BITS
258#define FLECS_ENTITY_PAGE_BITS (12)
259#endif
260
265// #define FLECS_USE_OS_ALLOC
266
269#ifndef FLECS_ID_DESC_MAX
270#define FLECS_ID_DESC_MAX (32)
271#endif
272
275#ifndef FLECS_EVENT_DESC_MAX
276#define FLECS_EVENT_DESC_MAX (8)
277#endif
278
281#define FLECS_VARIABLE_COUNT_MAX (64)
282
285#ifndef FLECS_TERM_COUNT_MAX
286#define FLECS_TERM_COUNT_MAX 32
287#endif
288
291#ifndef FLECS_TERM_ARG_COUNT_MAX
292#define FLECS_TERM_ARG_COUNT_MAX (16)
293#endif
294
297#ifndef FLECS_QUERY_VARIABLE_COUNT_MAX
298#define FLECS_QUERY_VARIABLE_COUNT_MAX (64)
299#endif
300
303#ifndef FLECS_QUERY_SCOPE_NESTING_MAX
304#define FLECS_QUERY_SCOPE_NESTING_MAX (8)
305#endif
306
309#include "flecs/private/api_defines.h"
310#include "flecs/datastructures/vec.h" /* Vector datatype */
311#include "flecs/datastructures/sparse.h" /* Sparse set */
312#include "flecs/datastructures/block_allocator.h" /* Block allocator */
313#include "flecs/datastructures/stack_allocator.h" /* Stack allocator */
314#include "flecs/datastructures/map.h" /* Map */
315#include "flecs/datastructures/switch_list.h" /* Switch list */
316#include "flecs/datastructures/allocator.h" /* Allocator */
317#include "flecs/datastructures/strbuf.h" /* String builder */
318#include "flecs/os_api.h" /* Abstraction for operating system functions */
319
320#ifdef __cplusplus
321extern "C" {
322#endif
323
340typedef uint64_t ecs_id_t;
341
348
364typedef struct {
366 int32_t count;
367} ecs_type_t;
368
392
395
398
400typedef struct ecs_term_t ecs_term_t;
401
404
423
428
433typedef struct ecs_iter_t ecs_iter_t;
434
443typedef struct ecs_ref_t ecs_ref_t;
444
449
454
457
460
480typedef void ecs_poly_t;
481
484
492
500
502typedef struct ecs_table_cache_hdr_t {
503 struct ecs_table_cache_t *cache;
506 bool empty;
508
519
538typedef void (*ecs_run_action_t)(
539 ecs_iter_t *it);
540
547typedef void (*ecs_iter_action_t)(
548 ecs_iter_t *it);
549
558 ecs_iter_t *it);
559
566 ecs_iter_t *it);
567
570 ecs_entity_t e1,
571 const void *ptr1,
572 ecs_entity_t e2,
573 const void *ptr2);
574
577 ecs_world_t* world,
578 ecs_table_t* table,
579 ecs_entity_t* entities,
580 void* ptr,
581 int32_t size,
582 int32_t lo,
583 int32_t hi,
584 ecs_order_by_action_t order_by);
585
587typedef uint64_t (*ecs_group_by_action_t)(
588 ecs_world_t *world,
589 ecs_table_t *table,
590 ecs_id_t group_id,
591 void *ctx);
592
594typedef void* (*ecs_group_create_action_t)(
595 ecs_world_t *world,
596 uint64_t group_id,
597 void *group_by_ctx); /* from ecs_query_desc_t */
598
601 ecs_world_t *world,
602 uint64_t group_id,
603 void *group_ctx, /* return value from ecs_group_create_action_t */
604 void *group_by_ctx); /* from ecs_query_desc_t */
605
607typedef void (*ecs_module_action_t)(
608 ecs_world_t *world);
609
611typedef void (*ecs_fini_action_t)(
612 ecs_world_t *world,
613 void *ctx);
614
616typedef void (*ecs_ctx_free_t)(
617 void *ctx);
618
620typedef int (*ecs_compare_action_t)(
621 const void *ptr1,
622 const void *ptr2);
623
625typedef uint64_t (*ecs_hash_value_action_t)(
626 const void *ptr);
627
629typedef void (*ecs_xtor_t)(
630 void *ptr,
631 int32_t count,
632 const ecs_type_info_t *type_info);
633
635typedef void (*ecs_copy_t)(
636 void *dst_ptr,
637 const void *src_ptr,
638 int32_t count,
639 const ecs_type_info_t *type_info);
640
642typedef void (*ecs_move_t)(
643 void *dst_ptr,
644 void *src_ptr,
645 int32_t count,
646 const ecs_type_info_t *type_info);
647
649typedef void (*flecs_poly_dtor_t)(
650 ecs_poly_t *poly);
651
670
681
689
690/* Term id flags */
691
696#define EcsSelf (1llu << 63)
697
702#define EcsUp (1llu << 62)
703
708#define EcsTrav (1llu << 61)
709
714#define EcsCascade (1llu << 60)
715
720#define EcsDesc (1llu << 59)
721
726#define EcsIsVariable (1llu << 58)
727
732#define EcsIsEntity (1llu << 57)
733
738#define EcsIsName (1llu << 56)
739
744#define EcsTraverseFlags (EcsSelf|EcsUp|EcsTrav|EcsCascade|EcsDesc)
745
750#define EcsTermRefFlags (EcsTraverseFlags|EcsIsVariable|EcsIsEntity|EcsIsName)
751
766
788
799 ecs_flags32_t flags;
800 int8_t var_count;
801 int8_t term_count;
802 int8_t field_count;
804 /* Bitmasks for quick field information lookups */
805 ecs_termset_t fixed_fields;
806 ecs_termset_t var_fields;
807 ecs_termset_t static_id_fields;
808 ecs_termset_t data_fields;
809 ecs_termset_t write_fields;
810 ecs_termset_t read_fields;
811 ecs_termset_t row_fields;
813 ecs_termset_t set_fields;
817 char **vars;
819 void *ctx;
826 int32_t eval_count;
827};
828
857
911
923
924#include "flecs/private/api_types.h" /* Supporting API types */
925#include "flecs/private/api_support.h" /* Supporting API functions */
926#include "flecs/datastructures/hashmap.h" /* Hashmap */
927
933
938typedef struct ecs_entity_desc_t {
939 int32_t _canary;
945 const char *name;
950 const char *sep;
954 const char *root_sep;
956 const char *symbol;
971 const ecs_id_t *add;
972
975
977 const char *add_expr;
979
1009
1023
1063 /* World */
1067 /* Matched data */
1069 const ecs_size_t *sizes;
1073 ecs_var_t *variables;
1076 ecs_flags64_t constrained_vars;
1077 uint64_t group_id;
1078 ecs_termset_t set_fields;
1079 ecs_termset_t ref_fields;
1080 ecs_termset_t row_fields;
1081 ecs_termset_t up_fields;
1083 /* Input information */
1087 int32_t event_cur;
1089 /* Query information */
1091 int8_t term_index;
1098 /* Context */
1099 void *param;
1100 void *ctx;
1103 void *run_ctx;
1105 /* Time */
1109 /* Iterator counters */
1111 int32_t offset;
1112 int32_t count;
1114 /* Misc */
1115 ecs_flags32_t flags;
1117 ecs_iter_private_t priv_;
1119 /* Chained iterators */
1124};
1125
1126
1131#define EcsQueryMatchPrefab (1u << 1u)
1132
1137#define EcsQueryMatchDisabled (1u << 2u)
1138
1143#define EcsQueryMatchEmptyTables (1u << 3u)
1144
1149#define EcsQueryAllowUnresolvedByName (1u << 6u)
1150
1155#define EcsQueryTableOnly (1u << 7u)
1156
1157
1231
1293
1298typedef struct ecs_event_desc_t {
1301
1306
1309
1313
1315 int32_t offset;
1316
1320 int32_t count;
1321
1324
1329 void *param;
1330
1334 const void *const_param;
1335
1338
1340 ecs_flags32_t flags;
1342
1343
1352typedef struct ecs_build_info_t {
1353 const char *compiler;
1354 const char **addons;
1355 const char *version;
1359 bool debug;
1363
1423
1430
1441typedef struct EcsIdentifier {
1442 char *value;
1443 ecs_size_t length;
1444 uint64_t hash;
1445 uint64_t index_hash;
1446 ecs_hashmap_t *index;
1448
1450typedef struct EcsComponent {
1451 ecs_size_t size;
1452 ecs_size_t alignment;
1454
1459
1468
1472/* Only include deprecated definitions if deprecated addon is required */
1473#ifdef FLECS_DEPRECATED
1475#endif
1476
1492FLECS_API extern const ecs_id_t ECS_PAIR;
1493
1495FLECS_API extern const ecs_id_t ECS_AUTO_OVERRIDE;
1496
1498FLECS_API extern const ecs_id_t ECS_TOGGLE;
1499
1507/* Builtin component ids */
1508
1510FLECS_API extern const ecs_entity_t ecs_id(EcsComponent);
1511
1513FLECS_API extern const ecs_entity_t ecs_id(EcsIdentifier);
1514
1516FLECS_API extern const ecs_entity_t ecs_id(EcsPoly);
1517
1519FLECS_API extern const ecs_entity_t ecs_id(EcsDefaultChildComponent);
1520
1522FLECS_API extern const ecs_entity_t EcsQuery;
1523
1525FLECS_API extern const ecs_entity_t EcsObserver;
1526
1528FLECS_API extern const ecs_entity_t EcsSystem;
1529
1531FLECS_API extern const ecs_entity_t ecs_id(EcsTickSource);
1532
1534FLECS_API extern const ecs_entity_t ecs_id(EcsPipelineQuery);
1535
1537FLECS_API extern const ecs_entity_t ecs_id(EcsTimer);
1538
1540FLECS_API extern const ecs_entity_t ecs_id(EcsRateFilter);
1541
1543FLECS_API extern const ecs_entity_t EcsFlecs;
1544
1546FLECS_API extern const ecs_entity_t EcsFlecsCore;
1547
1549FLECS_API extern const ecs_entity_t EcsWorld;
1550
1552FLECS_API extern const ecs_entity_t EcsWildcard;
1553
1555FLECS_API extern const ecs_entity_t EcsAny;
1556
1558FLECS_API extern const ecs_entity_t EcsThis;
1559
1561FLECS_API extern const ecs_entity_t EcsVariable;
1562
1564#define EcsSingleton EcsVariable
1565
1573FLECS_API extern const ecs_entity_t EcsTransitive;
1574
1582FLECS_API extern const ecs_entity_t EcsReflexive;
1583
1594FLECS_API extern const ecs_entity_t EcsFinal;
1595
1597FLECS_API extern const ecs_entity_t EcsOnInstantiate;
1598
1602FLECS_API extern const ecs_entity_t EcsOverride;
1603
1607FLECS_API extern const ecs_entity_t EcsInherit;
1608
1613FLECS_API extern const ecs_entity_t EcsDontInherit;
1614
1622FLECS_API extern const ecs_entity_t EcsSymmetric;
1623
1633FLECS_API extern const ecs_entity_t EcsExclusive;
1634
1636FLECS_API extern const ecs_entity_t EcsAcyclic;
1637
1640FLECS_API extern const ecs_entity_t EcsTraversable;
1641
1651FLECS_API extern const ecs_entity_t EcsWith;
1652
1662FLECS_API extern const ecs_entity_t EcsOneOf;
1663
1665FLECS_API extern const ecs_entity_t EcsCanToggle;
1666
1670FLECS_API extern const ecs_entity_t EcsTrait;
1671
1681FLECS_API extern const ecs_entity_t EcsRelationship;
1682
1692FLECS_API extern const ecs_entity_t EcsTarget;
1693
1696FLECS_API extern const ecs_entity_t EcsPairIsTag;
1697
1699FLECS_API extern const ecs_entity_t EcsName;
1700
1702FLECS_API extern const ecs_entity_t EcsSymbol;
1703
1705FLECS_API extern const ecs_entity_t EcsAlias;
1706
1708FLECS_API extern const ecs_entity_t EcsChildOf;
1709
1711FLECS_API extern const ecs_entity_t EcsIsA;
1712
1714FLECS_API extern const ecs_entity_t EcsDependsOn;
1715
1717FLECS_API extern const ecs_entity_t EcsSlotOf;
1718
1720FLECS_API extern const ecs_entity_t EcsModule;
1721
1723FLECS_API extern const ecs_entity_t EcsPrivate;
1724
1727FLECS_API extern const ecs_entity_t EcsPrefab;
1728
1731FLECS_API extern const ecs_entity_t EcsDisabled;
1732
1736FLECS_API extern const ecs_entity_t EcsNotQueryable;
1737
1739FLECS_API extern const ecs_entity_t EcsOnAdd;
1740
1742FLECS_API extern const ecs_entity_t EcsOnRemove;
1743
1745FLECS_API extern const ecs_entity_t EcsOnSet;
1746
1748FLECS_API extern const ecs_entity_t EcsMonitor;
1749
1751FLECS_API extern const ecs_entity_t EcsOnTableCreate;
1752
1754FLECS_API extern const ecs_entity_t EcsOnTableDelete;
1755
1757FLECS_API extern const ecs_entity_t EcsOnTableEmpty;
1758
1760FLECS_API extern const ecs_entity_t EcsOnTableFill;
1761
1763FLECS_API extern const ecs_entity_t EcsOnDelete;
1764
1767FLECS_API extern const ecs_entity_t EcsOnDeleteTarget;
1768
1771FLECS_API extern const ecs_entity_t EcsRemove;
1772
1775FLECS_API extern const ecs_entity_t EcsDelete;
1776
1779FLECS_API extern const ecs_entity_t EcsPanic;
1780
1782FLECS_API extern const ecs_entity_t EcsSparse;
1783
1785FLECS_API extern const ecs_entity_t EcsUnion;
1786
1788FLECS_API extern const ecs_entity_t EcsPredEq;
1789
1791FLECS_API extern const ecs_entity_t EcsPredMatch;
1792
1794FLECS_API extern const ecs_entity_t EcsPredLookup;
1795
1797FLECS_API extern const ecs_entity_t EcsScopeOpen;
1798
1800FLECS_API extern const ecs_entity_t EcsScopeClose;
1801
1806FLECS_API extern const ecs_entity_t EcsEmpty;
1807
1808FLECS_API extern const ecs_entity_t ecs_id(EcsPipeline);
1809FLECS_API extern const ecs_entity_t EcsOnStart;
1810FLECS_API extern const ecs_entity_t EcsPreFrame;
1811FLECS_API extern const ecs_entity_t EcsOnLoad;
1812FLECS_API extern const ecs_entity_t EcsPostLoad;
1813FLECS_API extern const ecs_entity_t EcsPreUpdate;
1814FLECS_API extern const ecs_entity_t EcsOnUpdate;
1815FLECS_API extern const ecs_entity_t EcsOnValidate;
1816FLECS_API extern const ecs_entity_t EcsPostUpdate;
1817FLECS_API extern const ecs_entity_t EcsPreStore;
1818FLECS_API extern const ecs_entity_t EcsOnStore;
1819FLECS_API extern const ecs_entity_t EcsPostFrame;
1820FLECS_API extern const ecs_entity_t EcsPhase;
1824#define EcsLastInternalComponentId (ecs_id(EcsPoly))
1825
1828#define EcsFirstUserComponentId (8)
1829
1832#define EcsFirstUserEntityId (FLECS_HI_COMPONENT_ID + 128)
1833
1834/* When visualized the reserved id ranges look like this:
1835 * - [1..8]: Builtin components
1836 * - [9..FLECS_HI_COMPONENT_ID]: Low ids reserved for application components
1837 * - [FLECS_HI_COMPONENT_ID + 1..EcsFirstUserEntityId]: Builtin entities
1838 */
1839
1861FLECS_API
1863
1870FLECS_API
1872
1880FLECS_API
1882 int argc,
1883 char *argv[]);
1884
1891FLECS_API
1893 ecs_world_t *world);
1894
1902FLECS_API
1904 const ecs_world_t *world);
1905
1913FLECS_API
1915 ecs_world_t *world,
1916 ecs_fini_action_t action,
1917 void *ctx);
1918
1925
1952FLECS_API
1954 const ecs_world_t *world);
1955
1981FLECS_API
1983 ecs_world_t *world,
1984 ecs_ftime_t delta_time);
1985
1992FLECS_API
1994 ecs_world_t *world);
1995
2003FLECS_API
2005 ecs_world_t *world,
2006 ecs_fini_action_t action,
2007 void *ctx);
2008
2015FLECS_API
2017 ecs_world_t *world);
2018
2025FLECS_API
2027 const ecs_world_t *world);
2028
2041 ecs_world_t *world,
2042 bool enable);
2043
2055 ecs_world_t *world,
2056 bool enable);
2057
2073FLECS_API
2075 ecs_world_t *world,
2076 ecs_ftime_t fps);
2077
2091FLECS_API
2093 ecs_world_t *world,
2094 ecs_flags32_t flags);
2095
2172FLECS_API
2174 ecs_world_t *world,
2175 bool multi_threaded);
2176
2184FLECS_API
2186 ecs_world_t *world);
2187
2198FLECS_API
2200 ecs_world_t *world);
2201
2217FLECS_API
2219 ecs_world_t *world);
2220
2231FLECS_API
2233 const ecs_world_t *world);
2234
2248FLECS_API
2250 ecs_world_t *world);
2251
2266FLECS_API
2268 ecs_world_t *world);
2269
2280FLECS_API
2282 ecs_world_t *world);
2283
2297FLECS_API
2299 ecs_world_t *world,
2300 int32_t stages);
2301
2308FLECS_API
2310 const ecs_world_t *world);
2311
2327FLECS_API
2329 const ecs_world_t *world,
2330 int32_t stage_id);
2331
2339FLECS_API
2341 const ecs_world_t *world);
2342
2350FLECS_API
2352 ecs_world_t *world);
2353
2358FLECS_API
2360 ecs_world_t *stage);
2361
2369FLECS_API
2371 const ecs_world_t *world);
2372
2388FLECS_API
2390 ecs_world_t *world,
2391 void *ctx,
2392 ecs_ctx_free_t ctx_free);
2393
2402FLECS_API
2404 ecs_world_t *world,
2405 void *ctx,
2406 ecs_ctx_free_t ctx_free);
2407
2415FLECS_API
2417 const ecs_world_t *world);
2418
2426FLECS_API
2428 const ecs_world_t *world);
2429
2435FLECS_API
2437
2443FLECS_API
2445 const ecs_world_t *world);
2446
2455FLECS_API
2457 ecs_world_t *world,
2458 int32_t entity_count);
2459
2475FLECS_API
2477 ecs_world_t *world,
2478 ecs_entity_t id_start,
2479 ecs_entity_t id_end);
2480
2491FLECS_API
2493 ecs_world_t *world,
2494 bool enable);
2495
2501FLECS_API
2503 const ecs_world_t *world);
2504
2518FLECS_API
2520 ecs_world_t *world,
2521 ecs_flags32_t flags);
2522
2556FLECS_API
2558 ecs_world_t *world,
2559 ecs_id_t id,
2560 uint16_t clear_generation,
2561 uint16_t delete_generation,
2562 int32_t min_id_count,
2563 double time_budget_seconds);
2564
2570FLECS_API
2572 const ecs_poly_t *poly);
2573
2579FLECS_API
2581 const ecs_poly_t *poly);
2582
2596FLECS_API
2598 const ecs_poly_t *object,
2599 int32_t type);
2600
2604#define flecs_poly_is(object, type)\
2605 flecs_poly_is_(object, type##_magic)
2606
2615FLECS_API
2617 ecs_entity_t first,
2618 ecs_entity_t second);
2619
2646FLECS_API
2648 ecs_world_t *world);
2649
2667FLECS_API
2669 ecs_world_t *world);
2670
2679FLECS_API
2681 ecs_world_t *world,
2682 ecs_id_t id);
2683
2691FLECS_API
2693 ecs_world_t *world,
2694 ecs_table_t *table);
2695
2714FLECS_API
2716 ecs_world_t *world,
2717 const ecs_entity_desc_t *desc);
2718
2745FLECS_API
2747 ecs_world_t *world,
2748 const ecs_bulk_desc_t *desc);
2749
2759FLECS_API
2761 ecs_world_t *world,
2762 ecs_id_t id,
2763 int32_t count);
2764
2780FLECS_API
2782 ecs_world_t *world,
2783 ecs_entity_t dst,
2784 ecs_entity_t src,
2785 bool copy_value);
2786
2795FLECS_API
2797 ecs_world_t *world,
2798 ecs_entity_t entity);
2799
2807FLECS_API
2809 ecs_world_t *world,
2810 ecs_id_t id);
2811
2829FLECS_API
2831 ecs_world_t *world,
2832 ecs_entity_t entity,
2833 ecs_id_t id);
2834
2843FLECS_API
2845 ecs_world_t *world,
2846 ecs_entity_t entity,
2847 ecs_id_t id);
2848
2900FLECS_API
2902 ecs_world_t *world,
2903 ecs_entity_t entity,
2904 ecs_id_t id);
2905
2912FLECS_API
2914 ecs_world_t *world,
2915 ecs_entity_t entity);
2916
2924FLECS_API
2926 ecs_world_t *world,
2927 ecs_id_t id);
2928
2936FLECS_API
2938 ecs_world_t *world,
2939 ecs_id_t id);
2940
2947FLECS_API
2949 const ecs_world_t *world);
2950
2969FLECS_API
2971 ecs_world_t *world,
2972 ecs_entity_t entity,
2973 bool enabled);
2974
2988FLECS_API
2990 ecs_world_t *world,
2991 ecs_entity_t entity,
2992 ecs_id_t id,
2993 bool enable);
2994
3005FLECS_API
3007 const ecs_world_t *world,
3008 ecs_entity_t entity,
3009 ecs_id_t id);
3010
3034FLECS_API
3035const void* ecs_get_id(
3036 const ecs_world_t *world,
3037 ecs_entity_t entity,
3038 ecs_id_t id);
3039
3051FLECS_API
3053 const ecs_world_t *world,
3054 ecs_entity_t entity,
3055 ecs_id_t id);
3056
3074FLECS_API
3076 ecs_world_t *world,
3077 ecs_entity_t entity,
3078 ecs_id_t id);
3079
3091FLECS_API
3093 ecs_world_t *world,
3094 ecs_entity_t entity,
3095 ecs_id_t id);
3096
3107FLECS_API
3109 const ecs_world_t *world,
3110 ecs_entity_t entity,
3111 ecs_id_t id);
3112
3121FLECS_API
3123 const ecs_world_t *world,
3124 ecs_ref_t *ref,
3125 ecs_id_t id);
3126
3134FLECS_API
3136 const ecs_world_t *world,
3137 ecs_ref_t *ref);
3138
3146FLECS_API
3148 const ecs_world_t *world,
3149 ecs_entity_t entity);
3150
3169FLECS_API
3171 ecs_world_t *world,
3172 ecs_entity_t entity);
3173
3180FLECS_API
3182 ecs_record_t *record);
3183
3203FLECS_API
3205 ecs_world_t *world,
3206 ecs_entity_t entity);
3207
3213FLECS_API
3215 const ecs_record_t *record);
3216
3223FLECS_API
3225 const ecs_record_t *record);
3226
3242FLECS_API
3244 const ecs_world_t *world,
3245 const ecs_record_t *record,
3246 ecs_id_t id);
3247
3256FLECS_API
3258 ecs_world_t *world,
3259 ecs_record_t *record,
3260 ecs_id_t id);
3261
3269FLECS_API
3271 ecs_world_t *world,
3272 const ecs_record_t *record,
3273 ecs_id_t id);
3274
3291FLECS_API
3293 const ecs_record_t *record,
3294 int32_t column,
3295 size_t size);
3296
3316FLECS_API
3318 ecs_world_t *world,
3319 ecs_entity_t entity,
3320 ecs_id_t id,
3321 bool *is_new);
3322
3332FLECS_API
3334 ecs_world_t *world,
3335 ecs_entity_t entity,
3336 ecs_id_t id);
3337
3353FLECS_API
3355 ecs_world_t *world,
3356 ecs_entity_t entity,
3357 ecs_id_t id,
3358 size_t size,
3359 const void *ptr);
3360
3388FLECS_API
3390 const ecs_world_t *world,
3391 ecs_entity_t e);
3392
3418FLECS_API
3420 const ecs_world_t *world,
3421 ecs_entity_t e);
3422
3428FLECS_API
3430 ecs_entity_t e);
3431
3448FLECS_API
3450 const ecs_world_t *world,
3451 ecs_entity_t e);
3452
3475FLECS_API
3477 ecs_world_t *world,
3478 ecs_entity_t entity);
3479
3498FLECS_API
3500 ecs_world_t *world,
3501 ecs_id_t id);
3502
3510FLECS_API
3512 const ecs_world_t *world,
3513 ecs_entity_t entity);
3514
3529FLECS_API
3531 ecs_world_t *world,
3532 ecs_entity_t entity);
3533
3549FLECS_API
3551 const ecs_world_t *world,
3552 ecs_entity_t entity);
3553
3560FLECS_API
3562 const ecs_world_t *world,
3563 ecs_entity_t entity);
3564
3572FLECS_API
3574 const ecs_world_t *world,
3575 const ecs_type_t* type);
3576
3588FLECS_API
3590 const ecs_world_t *world,
3591 const ecs_table_t *table);
3592
3607FLECS_API
3609 const ecs_world_t *world,
3610 ecs_entity_t entity);
3611
3622FLECS_API
3624 const ecs_world_t *world,
3625 ecs_entity_t entity,
3626 ecs_id_t id);
3627
3638FLECS_API
3640 const ecs_world_t *world,
3641 ecs_entity_t entity,
3642 ecs_id_t id);
3643
3658FLECS_API
3660 const ecs_world_t *world,
3661 ecs_entity_t entity,
3662 ecs_entity_t rel,
3663 int32_t index);
3664
3678FLECS_API
3680 const ecs_world_t *world,
3681 ecs_entity_t entity);
3682
3703FLECS_API
3705 const ecs_world_t *world,
3706 ecs_entity_t entity,
3707 ecs_entity_t rel,
3708 ecs_id_t id);
3709
3720FLECS_API
3722 const ecs_world_t *world,
3723 ecs_entity_t entity,
3724 ecs_entity_t rel);
3725
3733FLECS_API
3735 const ecs_world_t *world,
3736 ecs_id_t entity);
3737
3757FLECS_API
3758const char* ecs_get_name(
3759 const ecs_world_t *world,
3760 ecs_entity_t entity);
3761
3771FLECS_API
3772const char* ecs_get_symbol(
3773 const ecs_world_t *world,
3774 ecs_entity_t entity);
3775
3789FLECS_API
3791 ecs_world_t *world,
3792 ecs_entity_t entity,
3793 const char *name);
3794
3808FLECS_API
3810 ecs_world_t *world,
3811 ecs_entity_t entity,
3812 const char *symbol);
3813
3825FLECS_API
3827 ecs_world_t *world,
3828 ecs_entity_t entity,
3829 const char *alias);
3830
3846FLECS_API
3848 const ecs_world_t *world,
3849 const char *path);
3850
3865FLECS_API
3867 const ecs_world_t *world,
3868 ecs_entity_t parent,
3869 const char *name);
3870
3893FLECS_API
3895 const ecs_world_t *world,
3896 ecs_entity_t parent,
3897 const char *path,
3898 const char *sep,
3899 const char *prefix,
3900 bool recursive);
3901
3919FLECS_API
3921 const ecs_world_t *world,
3922 const char *symbol,
3923 bool lookup_as_path,
3924 bool recursive);
3925
3947FLECS_API
3949 const ecs_world_t *world,
3950 ecs_entity_t parent,
3951 ecs_entity_t child,
3952 const char *sep,
3953 const char *prefix);
3954
3968 const ecs_world_t *world,
3969 ecs_entity_t parent,
3970 ecs_entity_t child,
3971 const char *sep,
3972 const char *prefix,
3973 ecs_strbuf_t *buf);
3974
3990FLECS_API
3992 ecs_world_t *world,
3993 ecs_entity_t parent,
3994 const char *path,
3995 const char *sep,
3996 const char *prefix);
3997
4012FLECS_API
4014 ecs_world_t *world,
4015 ecs_entity_t entity,
4016 ecs_entity_t parent,
4017 const char *path,
4018 const char *sep,
4019 const char *prefix);
4020
4034FLECS_API
4036 ecs_world_t *world,
4037 ecs_entity_t scope);
4038
4046FLECS_API
4048 const ecs_world_t *world);
4049
4059FLECS_API
4061 ecs_world_t *world,
4062 const char *prefix);
4063
4090FLECS_API
4092 ecs_world_t *world,
4093 const ecs_entity_t *lookup_path);
4094
4101FLECS_API
4103 const ecs_world_t *world);
4104
4129FLECS_API
4131 ecs_world_t *world,
4132 const ecs_component_desc_t *desc);
4133
4143FLECS_API
4145 const ecs_world_t *world,
4146 ecs_id_t id);
4147
4159FLECS_API
4161 ecs_world_t *world,
4162 ecs_entity_t id,
4163 const ecs_type_hooks_t *hooks);
4164
4171FLECS_API
4173 const ecs_world_t *world,
4174 ecs_entity_t id);
4175
4199FLECS_API
4201 const ecs_world_t *world,
4202 ecs_id_t id);
4203
4212FLECS_API
4214 const ecs_world_t *world,
4215 ecs_id_t id);
4216
4236FLECS_API
4238 const ecs_world_t *world,
4239 ecs_id_t id);
4240
4249FLECS_API
4251 ecs_id_t id,
4252 ecs_id_t pattern);
4253
4259FLECS_API
4261 ecs_id_t id);
4262
4268FLECS_API
4270 ecs_id_t id);
4271
4285FLECS_API
4287 const ecs_world_t *world,
4288 ecs_id_t id);
4289
4298FLECS_API
4299ecs_flags32_t ecs_id_get_flags(
4300 const ecs_world_t *world,
4301 ecs_id_t id);
4302
4309FLECS_API
4311 ecs_id_t id_flags);
4312
4320FLECS_API
4322 const ecs_world_t *world,
4323 ecs_id_t id);
4324
4332FLECS_API
4334 const ecs_world_t *world,
4335 ecs_id_t id,
4336 ecs_strbuf_t *buf);
4337
4345FLECS_API
4347 const ecs_world_t *world,
4348 const char *expr);
4349
4363FLECS_API
4365 const ecs_term_ref_t *id);
4366
4378FLECS_API
4380 const ecs_term_t *term);
4381
4396FLECS_API
4398 const ecs_term_t *term);
4399
4412FLECS_API
4414 const ecs_term_t *term);
4415
4424FLECS_API
4426 const ecs_world_t *world,
4427 const ecs_term_t *term);
4428
4436FLECS_API
4438 const ecs_query_t *query);
4439
4480FLECS_API
4482 const ecs_world_t *world,
4483 ecs_id_t id);
4484
4490FLECS_API
4492 ecs_iter_t *it);
4493
4506FLECS_API
4508 const ecs_world_t *world,
4509 ecs_entity_t parent);
4510
4516FLECS_API
4518 ecs_iter_t *it);
4519
4535FLECS_API
4537 ecs_world_t *world,
4538 const ecs_query_desc_t *desc);
4539
4544FLECS_API
4546 ecs_query_t *query);
4547
4556FLECS_API
4558 const ecs_query_t *query,
4559 const char *name);
4560
4568FLECS_API
4570 const ecs_query_t *query,
4571 int32_t var_id);
4572
4583FLECS_API
4585 const ecs_query_t *query,
4586 int32_t var_id);
4587
4656FLECS_API
4658 const ecs_world_t *world,
4659 const ecs_query_t *query);
4660
4668FLECS_API
4670 ecs_iter_t *it);
4671
4690FLECS_API
4692 ecs_query_t *query,
4693 ecs_entity_t entity,
4694 ecs_iter_t *it);
4695
4714FLECS_API
4716 ecs_query_t *query,
4717 ecs_table_t *table,
4718 ecs_iter_t *it);
4719
4746FLECS_API
4748 ecs_query_t *query,
4749 ecs_table_range_t *range,
4750 ecs_iter_t *it);
4751
4759FLECS_API
4761 const ecs_query_t *query);
4762
4772FLECS_API
4774 const ecs_query_t *query);
4775
4790FLECS_API
4792 const ecs_query_t *query,
4793 const ecs_iter_t *it);
4794
4812FLECS_API
4814 ecs_query_t *query,
4815 ecs_iter_t *it,
4816 const char *expr);
4817
4845FLECS_API
4847 ecs_query_t *query);
4848
4859FLECS_API
4861 ecs_iter_t *it);
4862
4885FLECS_API
4887 ecs_iter_t *it,
4888 uint64_t group_id);
4889
4898FLECS_API
4900 const ecs_query_t *query,
4901 uint64_t group_id);
4902
4911FLECS_API
4913 const ecs_query_t *query,
4914 uint64_t group_id);
4915
4923
4930FLECS_API
4932 const ecs_query_t *query);
4933
4939FLECS_API
4941 const ecs_query_t *query);
4942
4971FLECS_API
4973 ecs_world_t *world,
4974 ecs_event_desc_t *desc);
4975
4986FLECS_API
4988 ecs_world_t *world,
4989 ecs_event_desc_t *desc);
4990
5001FLECS_API
5003 ecs_world_t *world,
5004 const ecs_observer_desc_t *desc);
5005
5014FLECS_API
5016 const ecs_world_t *world,
5017 ecs_entity_t observer);
5018
5041FLECS_API
5043 ecs_iter_t *it);
5044
5054FLECS_API
5056 ecs_iter_t *it);
5057
5069FLECS_API
5071 ecs_iter_t *it);
5072
5085FLECS_API
5087 ecs_iter_t *it);
5088
5096FLECS_API
5098 ecs_iter_t *it);
5099
5138FLECS_API
5140 ecs_iter_t *it,
5141 int32_t var_id,
5142 ecs_entity_t entity);
5143
5154FLECS_API
5156 ecs_iter_t *it,
5157 int32_t var_id,
5158 const ecs_table_t *table);
5159
5170FLECS_API
5172 ecs_iter_t *it,
5173 int32_t var_id,
5174 const ecs_table_range_t *range);
5175
5188FLECS_API
5190 ecs_iter_t *it,
5191 int32_t var_id);
5192
5206FLECS_API
5208 ecs_iter_t *it,
5209 int32_t var_id);
5210
5224FLECS_API
5226 ecs_iter_t *it,
5227 int32_t var_id);
5228
5240FLECS_API
5242 ecs_iter_t *it,
5243 int32_t var_id);
5244
5256FLECS_API
5258 ecs_iter_t *it);
5259
5271FLECS_API
5273 const ecs_iter_t *it);
5274
5290FLECS_API
5292 const ecs_iter_t *it,
5293 int32_t offset,
5294 int32_t limit);
5295
5302FLECS_API
5304 ecs_iter_t *it);
5305
5326FLECS_API
5328 const ecs_iter_t *it,
5329 int32_t index,
5330 int32_t count);
5331
5338FLECS_API
5340 ecs_iter_t *it);
5341
5383FLECS_API
5385 const ecs_iter_t *it,
5386 size_t size,
5387 int8_t index);
5388
5410FLECS_API
5412 const ecs_iter_t *it,
5413 size_t size,
5414 int8_t index,
5415 int32_t row);
5416
5425FLECS_API
5427 const ecs_iter_t *it,
5428 int8_t index);
5429
5440FLECS_API
5442 const ecs_iter_t *it,
5443 int8_t index);
5444
5451FLECS_API
5453 const ecs_iter_t *it,
5454 int8_t index);
5455
5462FLECS_API
5464 const ecs_iter_t *it,
5465 int8_t index);
5466
5475FLECS_API
5477 const ecs_iter_t *it,
5478 int8_t index);
5479
5487FLECS_API
5489 const ecs_iter_t *it,
5490 int8_t index);
5491
5499FLECS_API
5501 const ecs_iter_t *it,
5502 int8_t index);
5503
5517FLECS_API
5519 const ecs_iter_t *it,
5520 int8_t index);
5521
5537FLECS_API
5539 const ecs_table_t *table);
5540
5551FLECS_API
5553 const ecs_world_t *world,
5554 const ecs_table_t *table,
5555 ecs_id_t id);
5556
5566FLECS_API
5568 const ecs_world_t *world,
5569 const ecs_table_t *table,
5570 ecs_id_t id);
5571
5579FLECS_API
5581 const ecs_table_t *table);
5582
5596FLECS_API
5598 const ecs_table_t *table,
5599 int32_t index);
5600
5609FLECS_API
5611 const ecs_table_t *table,
5612 int32_t index);
5613
5622FLECS_API
5624 const ecs_table_t *table,
5625 int32_t index,
5626 int32_t offset);
5627
5637FLECS_API
5639 const ecs_world_t *world,
5640 const ecs_table_t *table,
5641 ecs_id_t id,
5642 int32_t offset);
5643
5651FLECS_API
5653 const ecs_table_t *table,
5654 int32_t index);
5655
5662FLECS_API
5664 const ecs_table_t *table);
5665
5673FLECS_API
5675 const ecs_table_t *table);
5676
5683FLECS_API
5685 const ecs_table_t *table);
5686
5697FLECS_API
5699 const ecs_world_t *world,
5700 const ecs_table_t *table,
5701 ecs_id_t id);
5702
5713FLECS_API
5715 const ecs_world_t *world,
5716 const ecs_table_t *table,
5717 ecs_entity_t rel);
5718
5728FLECS_API
5730 ecs_world_t *world,
5731 ecs_table_t *table,
5732 ecs_id_t id);
5733
5744FLECS_API
5746 ecs_world_t *world,
5747 const ecs_id_t *ids,
5748 int32_t id_count);
5749
5759FLECS_API
5761 ecs_world_t *world,
5762 ecs_table_t *table,
5763 ecs_id_t id);
5764
5780FLECS_API
5782 ecs_world_t *world,
5783 ecs_table_t *table);
5784
5791FLECS_API
5793 ecs_world_t *world,
5794 ecs_table_t *table);
5795
5805FLECS_API
5807 ecs_table_t *table,
5808 ecs_flags32_t flags);
5809
5817FLECS_API
5819 ecs_world_t* world,
5820 ecs_table_t* table,
5821 int32_t row_1,
5822 int32_t row_2);
5823
5846FLECS_API
5848 ecs_world_t *world,
5849 ecs_entity_t entity,
5850 ecs_record_t *record,
5851 ecs_table_t *table,
5852 const ecs_type_t *added,
5853 const ecs_type_t *removed);
5854
5855
5874FLECS_API
5876 const ecs_world_t *world,
5877 const ecs_table_t *table,
5878 ecs_id_t id,
5879 ecs_id_t *id_out);
5880
5916FLECS_API
5918 const ecs_world_t *world,
5919 const ecs_table_t *table,
5920 int32_t offset,
5921 ecs_id_t id,
5922 ecs_id_t *id_out);
5923
5965FLECS_API
5967 const ecs_world_t *world,
5968 const ecs_table_t *table,
5969 int32_t offset,
5970 ecs_id_t id,
5971 ecs_entity_t rel,
5972 ecs_flags64_t flags, /* EcsSelf and/or EcsUp */
5973 ecs_entity_t *subject_out,
5974 ecs_id_t *id_out,
5975 struct ecs_table_record_t **tr_out);
5976
5993FLECS_API
5995 const ecs_world_t *world,
5996 ecs_entity_t type,
5997 void *ptr);
5998
6006FLECS_API
6008 const ecs_world_t *world,
6009 const ecs_type_info_t *ti,
6010 void *ptr);
6011
6018FLECS_API
6020 ecs_world_t *world,
6021 ecs_entity_t type);
6022
6030 ecs_world_t *world,
6031 const ecs_type_info_t *ti);
6032
6041 const ecs_world_t *world,
6042 const ecs_type_info_t *ti,
6043 void *ptr);
6044
6052FLECS_API
6054 const ecs_world_t *world,
6055 ecs_entity_t type,
6056 void* ptr);
6057
6065FLECS_API
6067 ecs_world_t *world,
6068 ecs_entity_t type,
6069 void* ptr);
6070
6079FLECS_API
6081 const ecs_world_t *world,
6082 const ecs_type_info_t *ti,
6083 void* dst,
6084 const void *src);
6085
6094FLECS_API
6096 const ecs_world_t *world,
6097 ecs_entity_t type,
6098 void* dst,
6099 const void *src);
6100
6110 const ecs_world_t *world,
6111 const ecs_type_info_t *ti,
6112 void* dst,
6113 void *src);
6114
6124 const ecs_world_t *world,
6125 ecs_entity_t type,
6126 void* dst,
6127 void *src);
6128
6138 const ecs_world_t *world,
6139 const ecs_type_info_t *ti,
6140 void* dst,
6141 void *src);
6142
6152 const ecs_world_t *world,
6153 ecs_entity_t type,
6154 void* dst,
6155 void *src);
6156
6170#include "flecs/addons/flecs_c.h"
6171
6172#ifdef __cplusplus
6173}
6174#endif
6175
6176#include "flecs/private/addons.h"
6177
6178#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:394
struct ecs_ref_t ecs_ref_t
A ref is a fast way to fetch a component for a specific entity.
Definition flecs.h:443
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:347
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:459
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition flecs.h:391
struct ecs_mixins_t ecs_mixins_t
Type that stores poly mixins.
Definition flecs.h:483
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
Definition flecs.h:340
struct ecs_observable_t ecs_observable_t
An observable produces events that can be listened for by an observer.
Definition flecs.h:427
struct ecs_table_t ecs_table_t
A table stores entities and components for a specific type.
Definition flecs.h:397
void ecs_poly_t
A poly object.
Definition flecs.h:480
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:607
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:587
uint64_t(* ecs_hash_value_action_t)(const void *ptr)
Callback used for hashing values.
Definition flecs.h:625
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:600
void(* ecs_iter_fini_action_t)(ecs_iter_t *it)
Function prototype for freeing an iterator.
Definition flecs.h:565
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:594
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:576
bool(* ecs_iter_next_action_t)(ecs_iter_t *it)
Function prototype for iterating an iterator.
Definition flecs.h:557
void(* ecs_iter_action_t)(ecs_iter_t *it)
Function prototype for iterables.
Definition flecs.h:547
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:635
int(* ecs_compare_action_t)(const void *ptr1, const void *ptr2)
Callback used for sorting values.
Definition flecs.h:620
void(* ecs_fini_action_t)(ecs_world_t *world, void *ctx)
Action callback on world exit.
Definition flecs.h:611
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:642
void(* flecs_poly_dtor_t)(ecs_poly_t *poly)
Destructor function for poly objects.
Definition flecs.h:649
void(* ecs_run_action_t)(ecs_iter_t *it)
Function prototype for runnables (systems, observers).
Definition flecs.h:538
void(* ecs_ctx_free_t)(void *ctx)
Function to cleanup context data.
Definition flecs.h:616
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:569
void(* ecs_xtor_t)(void *ptr, int32_t count, const ecs_type_info_t *type_info)
Constructor/destructor callback.
Definition flecs.h:629
void * ecs_get_mut_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Get a mutable pointer to a component.
ecs_ref_t ecs_ref_init_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Create a component ref.
ecs_entity_t ecs_record_get_entity(const ecs_record_t *record)
Get entity corresponding with record.
void ecs_ref_update(const ecs_world_t *world, ecs_ref_t *ref)
Update ref.
const void * ecs_record_get_id(const ecs_world_t *world, const ecs_record_t *record, ecs_id_t id)
Get component from entity record.
void * ecs_record_get_by_column(const ecs_record_t *record, int32_t column, size_t size)
Get component pointer from column/record.
void ecs_read_end(const ecs_record_t *record)
End read access to entity.
void * ecs_emplace_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id, bool *is_new)
Emplace a component.
void * ecs_ensure_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Get a mutable pointer to a component.
void ecs_write_end(ecs_record_t *record)
End exclusive write access to entity.
void ecs_set_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id, size_t size, const void *ptr)
Set the value of a component.
void * ecs_ensure_modified_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Combines ensure + modified in single operation.
void * ecs_ref_get_id(const ecs_world_t *world, ecs_ref_t *ref, ecs_id_t id)
Get component from ref.
bool ecs_record_has_id(ecs_world_t *world, const ecs_record_t *record, ecs_id_t id)
Test if entity for record has a (component) id.
void * ecs_record_ensure_id(ecs_world_t *world, ecs_record_t *record, ecs_id_t id)
Same as ecs_record_get_id(), but returns a mutable pointer.
const void * ecs_get_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Get an immutable pointer to a component.
ecs_record_t * ecs_write_begin(ecs_world_t *world, ecs_entity_t entity)
Begin exclusive write access to entity.
void ecs_modified_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Signal that a component has been modified.
ecs_record_t * ecs_record_find(const ecs_world_t *world, ecs_entity_t entity)
Find record for entity.
const ecs_record_t * ecs_read_begin(ecs_world_t *world, ecs_entity_t entity)
Begin read access to entity.
const ecs_id_t ECS_PAIR
Indicates that the id is a pair.
const ecs_id_t ECS_AUTO_OVERRIDE
Automatically override component when it is inherited.
const ecs_id_t ECS_TOGGLE
Adds bitset to storage which allows component to be enabled/disabled.
bool ecs_id_is_valid(const ecs_world_t *world, ecs_id_t id)
Utility to check if id is valid.
bool ecs_id_is_pair(ecs_id_t id)
Utility to check if id is a pair.
ecs_entity_t ecs_get_typeid(const ecs_world_t *world, ecs_id_t id)
Get the type for an id.
bool ecs_id_match(ecs_id_t id, ecs_id_t pattern)
Utility to match an id with a pattern.
const char * ecs_id_flag_str(ecs_id_t id_flags)
Convert id flag to string.
bool ecs_id_in_use(const ecs_world_t *world, ecs_id_t id)
Returns whether specified id is in use.
bool ecs_id_is_tag(const ecs_world_t *world, ecs_id_t id)
Returns whether specified id a tag.
void ecs_id_str_buf(const ecs_world_t *world, ecs_id_t id, ecs_strbuf_t *buf)
Write (component) id string to buffer.
char * ecs_id_str(const ecs_world_t *world, ecs_id_t id)
Convert (component) id to string.
bool ecs_id_is_wildcard(ecs_id_t id)
Utility to check if id is a wildcard.
ecs_id_t ecs_id_from_str(const ecs_world_t *world, const char *expr)
Convert string to a (component) id.
ecs_flags32_t ecs_id_get_flags(const ecs_world_t *world, ecs_id_t id)
Get flags associated with id.
ecs_entity_t ecs_field_src(const ecs_iter_t *it, int8_t index)
Return field source.
bool ecs_iter_changed(ecs_iter_t *it)
Returns whether current iterator result has changed.
bool ecs_field_is_writeonly(const ecs_iter_t *it, int8_t index)
Test whether the field is writeonly.
bool ecs_field_is_readonly(const ecs_iter_t *it, int8_t index)
Test whether the field is readonly.
ecs_iter_t ecs_worker_iter(const ecs_iter_t *it, int32_t index, int32_t count)
Create a worker iterator.
bool ecs_iter_is_true(ecs_iter_t *it)
Test if iterator is true.
void ecs_iter_fini(ecs_iter_t *it)
Cleanup iterator resources.
char * ecs_iter_str(const ecs_iter_t *it)
Convert iterator to string.
bool ecs_iter_var_is_constrained(ecs_iter_t *it, int32_t var_id)
Returns whether variable is constrained.
ecs_iter_t ecs_page_iter(const ecs_iter_t *it, int32_t offset, int32_t limit)
Create a paged iterator.
void * ecs_field_at_w_size(const ecs_iter_t *it, size_t size, int8_t index, int32_t row)
Get data for field at specified row.
ecs_id_t ecs_field_id(const ecs_iter_t *it, int8_t index)
Return id matched for field.
bool ecs_field_is_set(const ecs_iter_t *it, int8_t index)
Test whether field is set.
void ecs_iter_set_var(ecs_iter_t *it, int32_t var_id, ecs_entity_t entity)
Set value for iterator variable.
bool ecs_field_is_self(const ecs_iter_t *it, int8_t index)
Test whether the field is matched on self.
bool ecs_iter_next(ecs_iter_t *it)
Progress any iterator.
ecs_entity_t ecs_iter_get_var(ecs_iter_t *it, int32_t var_id)
Get value of iterator variable as entity.
bool ecs_worker_next(ecs_iter_t *it)
Progress a worker iterator.
ecs_entity_t ecs_iter_first(ecs_iter_t *it)
Get first matching entity from iterator.
int32_t ecs_field_column(const ecs_iter_t *it, int8_t index)
Return index of matched table column.
void ecs_iter_set_var_as_table(ecs_iter_t *it, int32_t var_id, const ecs_table_t *table)
Same as ecs_iter_set_var(), but for a table.
ecs_table_t * ecs_iter_get_var_as_table(ecs_iter_t *it, int32_t var_id)
Get value of iterator variable as table.
void * ecs_field_w_size(const ecs_iter_t *it, size_t size, int8_t index)
Get data for field.
int32_t ecs_iter_count(ecs_iter_t *it)
Count number of matched entities in query.
bool ecs_page_next(ecs_iter_t *it)
Progress a paged iterator.
void ecs_iter_set_var_as_range(ecs_iter_t *it, int32_t var_id, const ecs_table_range_t *range)
Same as ecs_iter_set_var(), but for a range of entities This constrains the variable to a range of en...
size_t ecs_field_size(const ecs_iter_t *it, int8_t index)
Return field type size.
ecs_table_range_t ecs_iter_get_var_as_range(ecs_iter_t *it, int32_t var_id)
Get value of iterator variable as table range.
ecs_id_t ecs_strip_generation(ecs_entity_t e)
Remove generation from entity id.
bool ecs_is_valid(const ecs_world_t *world, ecs_entity_t e)
Test whether an entity is valid.
void ecs_make_alive(ecs_world_t *world, ecs_entity_t entity)
Ensure id is alive.
void ecs_make_alive_id(ecs_world_t *world, ecs_id_t id)
Same as ecs_make_alive(), but for (component) ids.
ecs_entity_t ecs_get_alive(const ecs_world_t *world, ecs_entity_t e)
Get alive identifier.
bool ecs_exists(const ecs_world_t *world, ecs_entity_t entity)
Test whether an entity exists.
bool ecs_is_alive(const ecs_world_t *world, ecs_entity_t e)
Test whether an entity is alive.
void ecs_set_version(ecs_world_t *world, ecs_entity_t entity)
Override the generation of an entity.
struct ecs_world_info_t ecs_world_info_t
Type that contains information about the world.
struct ecs_query_group_info_t ecs_query_group_info_t
Type that contains information about a query group.
struct ecs_build_info_t ecs_build_info_t
Type with information about the current Flecs build.
void ecs_emit(ecs_world_t *world, ecs_event_desc_t *desc)
Send event.
void ecs_enqueue(ecs_world_t *world, ecs_event_desc_t *desc)
Enqueue event.
ecs_entity_t ecs_observer_init(ecs_world_t *world, const ecs_observer_desc_t *desc)
Create observer.
const ecs_observer_t * ecs_observer_get(const ecs_world_t *world, ecs_entity_t observer)
Get observer object.
struct ecs_event_desc_t ecs_event_desc_t
Used with ecs_emit().
struct ecs_observer_desc_t ecs_observer_desc_t
Used with ecs_observer_init().
#define FLECS_EVENT_DESC_MAX
Maximum number of events in ecs_observer_desc_t.
Definition flecs.h:276
#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:270
#define FLECS_TERM_COUNT_MAX
Maximum number of terms in queries.
Definition flecs.h:286
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:683
ecs_inout_kind_t
Specify read/write access for term.
Definition flecs.h:662
ecs_oper_kind_t
Specify operator for term.
Definition flecs.h:672
@ EcsQueryCacheAll
Require that all query terms can be cached.
Definition flecs.h:686
@ EcsQueryCacheDefault
Behavior determined by query creation context.
Definition flecs.h:684
@ EcsQueryCacheNone
No caching.
Definition flecs.h:687
@ EcsQueryCacheAuto
Cache query terms that are cacheable.
Definition flecs.h:685
@ EcsOut
Term is only written.
Definition flecs.h:668
@ EcsInOut
Term is both read and written.
Definition flecs.h:666
@ EcsInOutFilter
Same as InOutNone + prevents term from triggering observers.
Definition flecs.h:665
@ EcsInOutDefault
InOut for regular terms, In for shared terms.
Definition flecs.h:663
@ EcsInOutNone
Term is neither read nor written.
Definition flecs.h:664
@ EcsIn
Term is only read.
Definition flecs.h:667
@ EcsNot
The term must not match.
Definition flecs.h:675
@ EcsOptional
The term may match.
Definition flecs.h:676
@ EcsOr
One of the terms in an or chain must match.
Definition flecs.h:674
@ EcsOrFrom
Term must match at least one component from term id.
Definition flecs.h:678
@ EcsAnd
The term must match.
Definition flecs.h:673
@ EcsNotFrom
Term must match none of the components from term id.
Definition flecs.h:679
@ EcsAndFrom
Term must match all components from term id.
Definition flecs.h:677
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:1450
ecs_size_t size
Component size.
Definition flecs.h:1451
ecs_size_t alignment
Component alignment.
Definition flecs.h:1452
When added to an entity this informs serialization formats which component to use when a value is ass...
Definition flecs.h:1465
ecs_id_t component
Default component id.
Definition flecs.h:1466
A (string) identifier.
Definition flecs.h:1441
ecs_size_t length
Length of identifier.
Definition flecs.h:1443
char * value
Identifier string.
Definition flecs.h:1442
ecs_hashmap_t * index
Current index.
Definition flecs.h:1446
uint64_t hash
Hash of current value.
Definition flecs.h:1444
uint64_t index_hash
Hash of existing record in current index.
Definition flecs.h:1445
Component for storing a poly object.
Definition flecs.h:1456
ecs_poly_t * poly
Pointer to poly object.
Definition flecs.h:1457
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:1352
int16_t version_major
Major flecs version.
Definition flecs.h:1356
const char ** addons
Addons included in build.
Definition flecs.h:1354
const char * version
Stringified version.
Definition flecs.h:1355
const char * compiler
Compiler used to compile flecs.
Definition flecs.h:1353
bool sanitize
Is this a sanitize build.
Definition flecs.h:1360
bool perf_trace
Is this a perf tracing build.
Definition flecs.h:1361
int16_t version_minor
Minor flecs version.
Definition flecs.h:1357
bool debug
Is this a debug build.
Definition flecs.h:1359
int16_t version_patch
Patch flecs version.
Definition flecs.h:1358
Used with ecs_bulk_init().
Definition flecs.h:984
void ** data
Array with component data to insert.
Definition flecs.h:996
ecs_id_t ids[(32)]
Ids to create the entities with.
Definition flecs.h:994
int32_t count
Number of entities to create/populate.
Definition flecs.h:992
int32_t _canary
Used for validity testing.
Definition flecs.h:985
ecs_entity_t * entities
Entities to bulk insert.
Definition flecs.h:987
ecs_table_t * table
Table to insert the entities into.
Definition flecs.h:1003
Used with ecs_component_init().
Definition flecs.h:1014
int32_t _canary
Used for validity testing.
Definition flecs.h:1015
ecs_type_info_t type
Parameters for type (size, hooks, ...)
Definition flecs.h:1021
ecs_entity_t entity
Existing entity to associate with observer (optional)
Definition flecs.h:1018
Type returned by ecs_get_entities().
Definition flecs.h:1920
int32_t alive_count
Number of alive entity ids.
Definition flecs.h:1923
int32_t count
Total number of entity ids.
Definition flecs.h:1922
const ecs_entity_t * ids
Array with all entity ids in the world.
Definition flecs.h:1921
Used with ecs_entity_init().
Definition flecs.h:938
const char * sep
Optional custom separator for hierarchical names.
Definition flecs.h:950
const char * root_sep
Optional, used for identifiers relative to root.
Definition flecs.h:954
const char * name
Name of the entity.
Definition flecs.h:945
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:966
const char * symbol
Optional entity symbol.
Definition flecs.h:956
int32_t _canary
Used for validity testing.
Definition flecs.h:939
const ecs_id_t * add
0-terminated array of ids to add to the entity.
Definition flecs.h:971
const char * add_expr
String expression with components to add.
Definition flecs.h:977
const ecs_value_t * set
0-terminated array of values to set on the entity.
Definition flecs.h:974
ecs_entity_t id
Set to modify existing entity (optional)
Definition flecs.h:941
ecs_entity_t parent
Parent entity.
Definition flecs.h:943
Used with ecs_emit().
Definition flecs.h:1298
ecs_entity_t entity
Single-entity alternative to setting table / offset / count.
Definition flecs.h:1323
const void * const_param
Same as param, but with the guarantee that the value won't be modified.
Definition flecs.h:1334
ecs_table_t * table
The table for which to notify.
Definition flecs.h:1308
int32_t count
Limit number of notified entities to count.
Definition flecs.h:1320
ecs_table_t * other_table
Optional 2nd table to notify.
Definition flecs.h:1312
int32_t offset
Limit notified entities to ones starting from offset (row) in table.
Definition flecs.h:1315
const ecs_type_t * ids
Component ids.
Definition flecs.h:1305
ecs_poly_t * observable
Observable (usually the world)
Definition flecs.h:1337
ecs_entity_t event
The event id.
Definition flecs.h:1300
ecs_flags32_t flags
Event flags.
Definition flecs.h:1340
void * param
Optional context.
Definition flecs.h:1329
Header for ecs_poly_t objects.
Definition flecs.h:486
int32_t magic
Magic number verifying it's a flecs object.
Definition flecs.h:487
int32_t type
Magic number indicating which type of flecs object.
Definition flecs.h:488
int32_t refcount
Refcount, to enable RAII handles.
Definition flecs.h:489
ecs_mixins_t * mixins
Table with offsets to (optional) mixins.
Definition flecs.h:490
Iterator.
Definition flecs.h:1062
ecs_world_t * real_world
Actual world.
Definition flecs.h:1065
void * param
Param passed to ecs_run.
Definition flecs.h:1099
ecs_entity_t event
The event (if applicable)
Definition flecs.h:1085
int32_t frame_offset
Offset relative to start of iteration.
Definition flecs.h:1110
char ** variable_names
Names of variables (if any)
Definition flecs.h:1096
ecs_flags32_t ref_fields
Bitset with fields that aren't component arrays.
Definition flecs.h:1079
int8_t variable_count
Number of variables for query.
Definition flecs.h:1094
ecs_entity_t interrupted_by
When set, system execution is interrupted.
Definition flecs.h:1116
ecs_flags32_t flags
Iterator flags.
Definition flecs.h:1115
ecs_iter_t * chain_it
Optional, allows for creating iterator chains.
Definition flecs.h:1123
void * ctx
System context.
Definition flecs.h:1100
void * run_ctx
Run language binding context.
Definition flecs.h:1103
ecs_table_t * table
Current table.
Definition flecs.h:1070
int32_t offset
Offset relative to current table.
Definition flecs.h:1111
ecs_id_t event_id
The (component) id for the event.
Definition flecs.h:1086
ecs_iter_fini_action_t fini
Function to cleanup iterator resources.
Definition flecs.h:1122
ecs_var_t * variables
Values of variables (if any)
Definition flecs.h:1073
ecs_iter_private_t priv_
Private data.
Definition flecs.h:1117
ecs_world_t * world
The world.
Definition flecs.h:1064
void * callback_ctx
Callback language binding context.
Definition flecs.h:1102
ecs_entity_t * sources
Entity on which the id was matched (0 if same as entities)
Definition flecs.h:1075
void * binding_ctx
System binding context.
Definition flecs.h:1101
ecs_flags32_t row_fields
Fields that must be obtained with field_at.
Definition flecs.h:1080
float delta_system_time
Time elapsed since last system invocation.
Definition flecs.h:1107
const ecs_query_t * query
Query being evaluated.
Definition flecs.h:1095
int8_t term_index
Index of term that emitted an event.
Definition flecs.h:1091
ecs_entity_t system
The system (if applicable)
Definition flecs.h:1084
ecs_flags32_t set_fields
Fields that are set.
Definition flecs.h:1078
const ecs_size_t * sizes
Component sizes.
Definition flecs.h:1069
float delta_time
Time elapsed since last frame.
Definition flecs.h:1106
ecs_flags32_t up_fields
Bitset with fields matched through up traversal.
Definition flecs.h:1081
ecs_iter_action_t callback
Callback of system or observer.
Definition flecs.h:1121
int8_t field_count
Number of fields in iterator.
Definition flecs.h:1090
ecs_table_t * other_table
Prev or next table when adding/removing.
Definition flecs.h:1071
int32_t event_cur
Unique event id.
Definition flecs.h:1087
const ecs_table_record_t ** trs
Info on where to find field in table.
Definition flecs.h:1074
int32_t count
Number of entities to iterate.
Definition flecs.h:1112
uint64_t group_id
Group id for table, if group_by is used.
Definition flecs.h:1077
ecs_iter_next_action_t next
Function to progress iterator.
Definition flecs.h:1120
const ecs_entity_t * entities
Entity identifiers.
Definition flecs.h:1068
ecs_id_t * ids
(Component) ids
Definition flecs.h:1072
ecs_flags64_t constrained_vars
Bitset that marks constrained variables.
Definition flecs.h:1076
Used with ecs_observer_init().
Definition flecs.h:1236
ecs_ctx_free_t run_ctx_free
Callback to free run ctx.
Definition flecs.h:1280
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:1268
void * run_ctx
Context associated with run (for language bindings).
Definition flecs.h:1277
ecs_entity_t entity
Existing entity to associate with observer (optional)
Definition flecs.h:1241
ecs_entity_t events[(8)]
Events to observe (OnAdd, OnRemove, OnSet)
Definition flecs.h:1247
int32_t * last_event_id
Optional shared last event id for multiple observers.
Definition flecs.h:1287
void * callback_ctx
Context associated with callback (for language bindings).
Definition flecs.h:1271
void * ctx
User context to pass to callback.
Definition flecs.h:1265
ecs_query_desc_t query
Query for observer.
Definition flecs.h:1244
ecs_poly_t * observable
Observable with which to register the observer.
Definition flecs.h:1283
ecs_ctx_free_t callback_ctx_free
Callback to free callback ctx.
Definition flecs.h:1274
int8_t term_index_
Used for internal purposes.
Definition flecs.h:1290
ecs_iter_action_t callback
Callback to invoke on an event, invoked when the observer matches.
Definition flecs.h:1254
bool yield_existing
When observer is created, generate events from existing data.
Definition flecs.h:1251
ecs_run_action_t run
Callback invoked on an event.
Definition flecs.h:1262
int32_t _canary
Used for validity testing.
Definition flecs.h:1238
An observer reacts to events matching a query.
Definition flecs.h:832
int32_t event_count
Number of events.
Definition flecs.h:839
ecs_iter_action_t callback
See ecs_observer_desc_t::callback.
Definition flecs.h:841
ecs_entity_t entity
Entity associated with observer.
Definition flecs.h:855
ecs_observable_t * observable
Observable for observer.
Definition flecs.h:852
ecs_run_action_t run
See ecs_observer_desc_t::run.
Definition flecs.h:842
ecs_header_t hdr
Object header.
Definition flecs.h:833
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:848
void * run_ctx
Run language binding context.
Definition flecs.h:846
ecs_world_t * world
The world.
Definition flecs.h:854
ecs_ctx_free_t run_ctx_free
Callback to free run_ctx.
Definition flecs.h:850
void * callback_ctx
Callback language binding context.
Definition flecs.h:845
void * ctx
Observer context.
Definition flecs.h:844
ecs_entity_t events[(8)]
Observer events.
Definition flecs.h:838
ecs_ctx_free_t callback_ctx_free
Callback to free callback_ctx.
Definition flecs.h:849
ecs_query_t * query
Observer query.
Definition flecs.h:835
Struct returned by ecs_query_count().
Definition flecs.h:4917
int32_t empty_tables
Number of empty tables returned by query.
Definition flecs.h:4921
int32_t entities
Number of entities returned by query.
Definition flecs.h:4919
int32_t results
Number of results returned by query.
Definition flecs.h:4918
int32_t tables
Number of tables returned by query.
Definition flecs.h:4920
Used with ecs_query_init().
Definition flecs.h:1162
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:1223
ecs_id_t group_by
Component id to be used for grouping.
Definition flecs.h:1193
ecs_term_t terms[32]
Query terms.
Definition flecs.h:1167
int32_t _canary
Used for validity testing.
Definition flecs.h:1164
void * ctx
User context to pass to callback.
Definition flecs.h:1217
ecs_ctx_free_t group_by_ctx_free
Function to free group_by_ctx.
Definition flecs.h:1214
void * group_by_ctx
Context to pass to group_by.
Definition flecs.h:1211
void * binding_ctx
Context to be used for language bindings.
Definition flecs.h:1220
ecs_entity_t order_by
Component to sort on, used together with order_by_callback or order_by_table_callback.
Definition flecs.h:1189
ecs_order_by_action_t order_by_callback
Callback used for ordering query results.
Definition flecs.h:1181
ecs_group_create_action_t on_group_create
Callback that is invoked when a new group is created.
Definition flecs.h:1204
ecs_entity_t entity
Entity associated with query (optional)
Definition flecs.h:1229
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:1226
ecs_group_by_action_t group_by_callback
Callback used for grouping results.
Definition flecs.h:1200
ecs_group_delete_action_t on_group_delete
Callback that is invoked when an existing group is deleted.
Definition flecs.h:1208
ecs_sort_table_action_t order_by_table_callback
Callback used for ordering query results.
Definition flecs.h:1185
ecs_flags32_t flags
Flags for enabling query features.
Definition flecs.h:1176
ecs_query_cache_kind_t cache_kind
Caching policy of query.
Definition flecs.h:1173
const char * expr
Query DSL expression (optional)
Definition flecs.h:1170
Type that contains information about a query group.
Definition flecs.h:1425
int32_t table_count
Number of tables in group.
Definition flecs.h:1427
void * ctx
Group context, returned by on_group_create.
Definition flecs.h:1428
int32_t match_count
How often tables have been matched/unmatched.
Definition flecs.h:1426
Queries are lists of constraints (terms) that match entities.
Definition flecs.h:792
ecs_flags32_t row_fields
Fields that must be acquired with field_at.
Definition flecs.h:811
ecs_flags32_t data_fields
Fields that have data.
Definition flecs.h:808
ecs_flags32_t read_fields
Fields that read data.
Definition flecs.h:810
ecs_header_t hdr
Object header.
Definition flecs.h:793
ecs_term_t terms[32]
Query terms.
Definition flecs.h:795
int8_t var_count
Number of query variables.
Definition flecs.h:800
ecs_flags32_t fixed_fields
Fields with a fixed source.
Definition flecs.h:805
ecs_flags32_t var_fields
Fields with non-$this variable source.
Definition flecs.h:806
ecs_flags32_t write_fields
Fields that write data.
Definition flecs.h:809
int32_t sizes[32]
Component sizes.
Definition flecs.h:796
int32_t eval_count
Number of times query is evaluated.
Definition flecs.h:826
ecs_world_t * world
World or stage query was created with.
Definition flecs.h:824
ecs_flags32_t static_id_fields
Fields with a static (component) id.
Definition flecs.h:807
ecs_world_t * real_world
Actual world.
Definition flecs.h:823
ecs_flags32_t set_fields
Fields that will be set.
Definition flecs.h:813
ecs_entity_t entity
Entity associated with query (optional)
Definition flecs.h:822
void * ctx
User context to pass to callback.
Definition flecs.h:819
ecs_flags32_t shared_readonly_fields
Fields that don't write shared data.
Definition flecs.h:812
ecs_id_t ids[32]
Component ids.
Definition flecs.h:797
ecs_query_cache_kind_t cache_kind
Caching policy of query.
Definition flecs.h:815
int8_t term_count
Number of query terms.
Definition flecs.h:801
char ** vars
Array with variable names for iterator.
Definition flecs.h:817
int8_t field_count
Number of fields returned by query.
Definition flecs.h:802
ecs_flags32_t flags
Query flags.
Definition flecs.h:799
void * binding_ctx
Context to be used for language bindings.
Definition flecs.h:820
Record for entity index.
Definition flecs.h:494
ecs_table_t * table
Identifies a type (and table) in world.
Definition flecs.h:496
uint32_t row
Table row of the entity.
Definition flecs.h:497
ecs_id_record_t * idr
Id record to (*, entity) for target entities.
Definition flecs.h:495
int32_t dense
Index in dense array of entity index.
Definition flecs.h:498
Header for table cache elements.
Definition flecs.h:502
bool empty
Whether element is in empty list.
Definition flecs.h:506
struct ecs_table_cache_hdr_t * next
Next/previous elements for id in table cache.
Definition flecs.h:505
struct ecs_table_cache_t * cache
Table cache of element.
Definition flecs.h:503
ecs_table_t * table
Table associated with element.
Definition flecs.h:504
Metadata describing where a component id is stored in a table.
Definition flecs.h:513
ecs_table_cache_hdr_t hdr
Table cache header.
Definition flecs.h:514
int16_t index
First type index where id occurs in table.
Definition flecs.h:515
int16_t column
First column index where id occurs.
Definition flecs.h:517
int16_t count
Number of times id occurs in table.
Definition flecs.h:516
Type that describes a reference to an entity or variable in a term.
Definition flecs.h:753
const char * name
Name.
Definition flecs.h:760
ecs_entity_t id
Entity id.
Definition flecs.h:754
Type that describes a term (single element in a query).
Definition flecs.h:768
ecs_term_ref_t src
Source of term.
Definition flecs.h:774
int8_t field_index
Index of field for term in iterator.
Definition flecs.h:785
ecs_id_t id
Component id to be matched by term.
Definition flecs.h:769
int16_t oper
Operator of term.
Definition flecs.h:783
ecs_term_ref_t second
Second element of pair.
Definition flecs.h:776
ecs_flags16_t flags_
Flags that help eval, set by ecs_query_init()
Definition flecs.h:786
ecs_entity_t trav
Relationship to traverse when looking for the component.
Definition flecs.h:778
int16_t inout
Access to contents matched by term.
Definition flecs.h:782
ecs_term_ref_t first
Component or first element of pair.
Definition flecs.h:775
Type that contains component lifecycle callbacks.
Definition flecs.h:864
ecs_copy_t copy_ctor
Ctor + copy.
Definition flecs.h:871
void * lifecycle_ctx
Component lifecycle context (see meta add-on)
Definition flecs.h:904
void * ctx
User defined context.
Definition flecs.h:902
ecs_iter_action_t on_remove
Callback that is invoked when an instance of the component is removed.
Definition flecs.h:900
void * binding_ctx
Language binding context.
Definition flecs.h:903
ecs_move_t move_dtor
Move + dtor.
Definition flecs.h:886
ecs_copy_t copy
copy assignment
Definition flecs.h:867
ecs_ctx_free_t lifecycle_ctx_free
Callback to free lifecycle_ctx.
Definition flecs.h:908
ecs_iter_action_t on_set
Callback that is invoked when an instance of the component is set.
Definition flecs.h:895
ecs_move_t move
move assignment
Definition flecs.h:868
ecs_xtor_t ctor
ctor
Definition flecs.h:865
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:906
ecs_iter_action_t on_add
Callback that is invoked when an instance of a component is added.
Definition flecs.h:890
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:907
ecs_move_t move_ctor
Ctor + move.
Definition flecs.h:874
ecs_move_t ctor_move_dtor
Ctor + move + dtor (or move_ctor + dtor).
Definition flecs.h:880
ecs_xtor_t dtor
dtor
Definition flecs.h:866
Type that contains component information (passed to ctors/dtors/...)
Definition flecs.h:916
ecs_size_t alignment
Alignment of type.
Definition flecs.h:918
ecs_size_t size
Size of type.
Definition flecs.h:917
const char * name
Type name.
Definition flecs.h:921
ecs_entity_t component
Handle to component (do not set)
Definition flecs.h:920
ecs_type_hooks_t hooks
Type hooks.
Definition flecs.h:919
A type is a list of (component) ids.
Definition flecs.h:364
ecs_id_t * array
Array with ids.
Definition flecs.h:365
int32_t count
Number of elements in array.
Definition flecs.h:366
Utility to hold a value of a dynamic type.
Definition flecs.h:929
void * ptr
Pointer to value.
Definition flecs.h:931
ecs_entity_t type
Type of value.
Definition flecs.h:930
Type that contains information about the world.
Definition flecs.h:1365
float delta_time
Time passed to or computed by ecs_progress()
Definition flecs.h:1371
ecs_entity_t min_id
First allowed entity id.
Definition flecs.h:1367
int64_t set_count
Set commands processed.
Definition flecs.h:1408
double world_time_total
Time elapsed in simulation.
Definition flecs.h:1379
int32_t tag_id_count
Number of tag (no data) ids in the world.
Definition flecs.h:1395
int32_t component_id_count
Number of component (data) ids in the world.
Definition flecs.h:1396
int64_t pipeline_build_count_total
Total number of pipeline builds.
Definition flecs.h:1391
int64_t eval_comp_monitors_total
Total number of monitor evaluations.
Definition flecs.h:1384
int32_t table_count
Number of tables.
Definition flecs.h:1399
float delta_time_raw
Raw delta time (no time scaling)
Definition flecs.h:1370
float frame_time_total
Total time spent processing a frame.
Definition flecs.h:1374
int64_t table_create_total
Total number of times a table was created.
Definition flecs.h:1389
int64_t observers_ran_frame
Total number of times observer was invoked.
Definition flecs.h:1393
float system_time_total
Total time spent in systems.
Definition flecs.h:1375
int64_t id_delete_total
Total number of times an id was deleted.
Definition flecs.h:1388
int64_t systems_ran_frame
Total number of systems ran in last frame.
Definition flecs.h:1392
float merge_time_total
Total time spent in merges.
Definition flecs.h:1377
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:1411
int64_t clear_count
Clear commands processed.
Definition flecs.h:1407
ecs_entity_t last_component_id
Last issued component entity id.
Definition flecs.h:1366
int32_t empty_table_count
Number of tables without entities.
Definition flecs.h:1400
int64_t frame_count_total
Total number of frames.
Definition flecs.h:1382
ecs_entity_t max_id
Last allowed entity id.
Definition flecs.h:1368
int64_t merge_count_total
Total number of merges.
Definition flecs.h:1383
int64_t other_count
Other commands processed.
Definition flecs.h:1413
int64_t batched_command_count
Commands batched.
Definition flecs.h:1415
int64_t table_delete_total
Total number of times a table was deleted.
Definition flecs.h:1390
int64_t delete_count
Selete commands processed.
Definition flecs.h:1406
int64_t rematch_count_total
Total number of rematches.
Definition flecs.h:1385
int64_t id_create_total
Total number of times a new id was created.
Definition flecs.h:1387
int64_t batched_entity_count
Entities for which commands were batched.
Definition flecs.h:1414
float time_scale
Time scale applied to delta_time.
Definition flecs.h:1372
int32_t pair_id_count
Number of pair ids in the world.
Definition flecs.h:1397
float rematch_time_total
Time spent on query rematching.
Definition flecs.h:1378
int64_t ensure_count
Ensure/emplace commands processed.
Definition flecs.h:1409
float target_fps
Target fps.
Definition flecs.h:1373
double world_time_total_raw
Time elapsed in simulation (no scaling)
Definition flecs.h:1380
float emit_time_total
Total time spent notifying observers.
Definition flecs.h:1376
int64_t modified_count
Modified commands processed.
Definition flecs.h:1410
const char * name_prefix
Value set by ecs_set_name_prefix().
Definition flecs.h:1418
int64_t event_count
Enqueued custom events.
Definition flecs.h:1412
int64_t add_count
Add commands processed.
Definition flecs.h:1404
int64_t remove_count
Remove commands processed.
Definition flecs.h:1405