Flecs v3.2
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
34#ifndef ecs_float_t
35#define ecs_float_t float
36#endif
37
41#ifndef ecs_ftime_t
42#define ecs_ftime_t ecs_float_t
43#endif
44
48// #define FLECS_LEGACY
49
53#define FLECS_NO_DEPRECATED_WARNINGS
54
60// #define FLECS_ACCURATE_COUNTERS
61
62/* Make sure provided configuration is valid */
63#if defined(FLECS_DEBUG) && defined(FLECS_NDEBUG)
64#error "invalid configuration: cannot both define FLECS_DEBUG and FLECS_NDEBUG"
65#endif
66#if defined(FLECS_DEBUG) && defined(NDEBUG)
67#error "invalid configuration: cannot both define FLECS_DEBUG and NDEBUG"
68#endif
69
74#if !defined(FLECS_DEBUG) && !defined(FLECS_NDEBUG)
75#if defined(NDEBUG)
76#define FLECS_NDEBUG
77#else
78#define FLECS_DEBUG
79#endif
80#endif
81
86#ifdef FLECS_SANITIZE
87#ifndef FLECS_DEBUG
88#define FLECS_DEBUG /* If sanitized mode is enabled, so is debug mode */
89#endif
90#endif
91
92/* Tip: if you see weird behavior that you think might be a bug, make sure to
93 * test with the FLECS_DEBUG or FLECS_SANITIZE flags enabled. There's a good
94 * chance that this gives you more information about the issue! */
95
109// #define FLECS_SOFT_ASSERT
110
116// #define FLECS_KEEP_ASSERT
117
141// #define FLECS_CUSTOM_BUILD
142
143#ifndef FLECS_CUSTOM_BUILD
144// #define FLECS_C /**< C API convenience macros, always enabled */
145#define FLECS_CPP
146#define FLECS_MODULE
147#define FLECS_PARSER
148#define FLECS_PLECS
149#define FLECS_RULES
150#define FLECS_SNAPSHOT
151#define FLECS_STATS
152#define FLECS_MONITOR
153#define FLECS_METRICS
154#define FLECS_ALERTS
155#define FLECS_SYSTEM
156#define FLECS_PIPELINE
157#define FLECS_TIMER
158#define FLECS_META
159#define FLECS_META_C
160#define FLECS_UNITS
161#define FLECS_EXPR
162#define FLECS_JSON
163#define FLECS_DOC
164#define FLECS_COREDOC
165#define FLECS_LOG
166#define FLECS_APP
167#define FLECS_OS_API_IMPL
168#define FLECS_HTTP
169#define FLECS_REST
170// #define FLECS_JOURNAL /**< Journaling addon (disabled by default) */
171#endif // ifndef FLECS_CUSTOM_BUILD
172
176// #define FLECS_LOW_FOOTPRINT
177#ifdef FLECS_LOW_FOOTPRINT
178#define FLECS_HI_COMPONENT_ID (16)
179#define FLECS_HI_ID_RECORD_ID (16)
180#define FLECS_SPARSE_PAGE_BITS (6)
181#define FLECS_ENTITY_PAGE_BITS (6)
182#define FLECS_USE_OS_ALLOC
183#endif
184
195#ifndef FLECS_HI_COMPONENT_ID
196#define FLECS_HI_COMPONENT_ID (256)
197#endif
198
205#ifndef FLECS_HI_ID_RECORD_ID
206#define FLECS_HI_ID_RECORD_ID (1024)
207#endif
208
214#ifndef FLECS_SPARSE_PAGE_BITS
215#define FLECS_SPARSE_PAGE_BITS (12)
216#endif
217
220#ifndef FLECS_ENTITY_PAGE_BITS
221#define FLECS_ENTITY_PAGE_BITS (12)
222#endif
223
228// #define FLECS_USE_OS_ALLOC
229
232#ifndef FLECS_ID_DESC_MAX
233#define FLECS_ID_DESC_MAX (32)
234#endif
235
238#define FLECS_TERM_DESC_MAX (16)
239
242#define FLECS_EVENT_DESC_MAX (8)
243
246#define FLECS_VARIABLE_COUNT_MAX (64)
247
250#define FLECS_QUERY_SCOPE_NESTING_MAX (8)
251
254#include "flecs/private/api_defines.h"
255#include "flecs/private/vec.h" /* Vector datatype */
256#include "flecs/private/sparse.h" /* Sparse set */
257#include "flecs/private/block_allocator.h" /* Block allocator */
258#include "flecs/private/map.h" /* Map */
259#include "flecs/private/allocator.h" /* Allocator */
260#include "flecs/private/strbuf.h" /* String builder */
261#include "flecs/os_api.h" /* Abstraction for operating system functions */
262
263#ifdef __cplusplus
264extern "C" {
265#endif
266
281typedef uint64_t ecs_id_t;
282
289
305typedef struct {
306 ecs_id_t *array;
307 int32_t count;
308} ecs_type_t;
309
333
336
338typedef struct ecs_term_t ecs_term_t;
339
345
365
385typedef struct ecs_rule_t ecs_rule_t;
386
404
409
410/* Type used for iterating iterable objects.
411 * Iterators are a common interface across iterable objects (world, filters,
412 * rules, queries, systems, observers) to provide applications with information
413 * about the currently iterated result, and to store any state required for the
414 * iteration. */
415typedef struct ecs_iter_t ecs_iter_t;
416
425typedef struct ecs_ref_t ecs_ref_t;
426
431
436
439
442
445
468typedef void ecs_poly_t;
469
472
474typedef struct ecs_header_t {
475 int32_t magic; /* Magic number verifying it's a flecs object */
476 int32_t type; /* Magic number indicating which type of flecs object */
477 ecs_mixins_t *mixins; /* Table with offsets to (optional) mixins */
479
497typedef void (*ecs_run_action_t)(
498 ecs_iter_t *it);
499
506typedef void (*ecs_iter_action_t)(
507 ecs_iter_t *it);
508
521 const ecs_world_t *world,
522 const ecs_poly_t *iterable,
523 ecs_iter_t *it,
524 ecs_term_t *filter);
525
534 ecs_iter_t *it);
535
542 ecs_iter_t *it);
543
546 ecs_entity_t e1,
547 const void *ptr1,
548 ecs_entity_t e2,
549 const void *ptr2);
550
553 ecs_world_t* world,
554 ecs_table_t* table,
555 ecs_entity_t* entities,
556 void* ptr,
557 int32_t size,
558 int32_t lo,
559 int32_t hi,
560 ecs_order_by_action_t order_by);
561
563typedef uint64_t (*ecs_group_by_action_t)(
564 ecs_world_t *world,
565 ecs_table_t *table,
566 ecs_id_t group_id,
567 void *ctx);
568
569/* Callback invoked when a query creates a new group. */
570typedef void* (*ecs_group_create_action_t)(
571 ecs_world_t *world,
572 uint64_t group_id,
573 void *group_by_ctx); /* from ecs_query_desc_t */
574
575/* Callback invoked when a query deletes an existing group. */
576typedef void (*ecs_group_delete_action_t)(
577 ecs_world_t *world,
578 uint64_t group_id,
579 void *group_ctx, /* return value from ecs_group_create_action_t */
580 void *group_by_ctx); /* from ecs_query_desc_t */
581
583typedef void (*ecs_module_action_t)(
584 ecs_world_t *world);
585
587typedef void (*ecs_fini_action_t)(
588 ecs_world_t *world,
589 void *ctx);
590
592typedef void (*ecs_ctx_free_t)(
593 void *ctx);
594
596typedef int (*ecs_compare_action_t)(
597 const void *ptr1,
598 const void *ptr2);
599
601typedef uint64_t (*ecs_hash_value_action_t)(
602 const void *ptr);
603
605typedef void (*ecs_xtor_t)(
606 void *ptr,
607 int32_t count,
608 const ecs_type_info_t *type_info);
609
611typedef void (*ecs_copy_t)(
612 void *dst_ptr,
613 const void *src_ptr,
614 int32_t count,
615 const ecs_type_info_t *type_info);
616
618typedef void (*ecs_move_t)(
619 void *dst_ptr,
620 void *src_ptr,
621 int32_t count,
622 const ecs_type_info_t *type_info);
623
624/* Destructor function for poly objects */
625typedef void (*ecs_poly_dtor_t)(
626 ecs_poly_t *poly);
627
641
658
669
670/* Term id flags */
671#define EcsSelf (1u << 1)
672#define EcsUp (1u << 2)
673#define EcsDown (1u << 3)
674#define EcsTraverseAll (1u << 4)
675#define EcsCascade (1u << 5)
676#define EcsDesc (1u << 6)
677#define EcsParent (1u << 7)
678#define EcsIsVariable (1u << 8)
679#define EcsIsEntity (1u << 9)
680#define EcsIsName (1u << 10)
681#define EcsFilter (1u << 11)
682#define EcsTraverseFlags (EcsUp|EcsDown|EcsTraverseAll|EcsSelf|EcsCascade|EcsDesc|EcsParent)
683
684/* Term flags discovered & set during filter creation. Mostly used internally to
685 * store information relevant to queries. */
686#define EcsTermMatchAny (1u << 0)
687#define EcsTermMatchAnySrc (1u << 1)
688#define EcsTermSrcFirstEq (1u << 2)
689#define EcsTermSrcSecondEq (1u << 3)
690#define EcsTermTransitive (1u << 4)
691#define EcsTermReflexive (1u << 5)
692#define EcsTermIdInherited (1u << 6)
693
694/* Term flags used for term iteration */
695#define EcsTermMatchDisabled (1u << 7)
696#define EcsTermMatchPrefab (1u << 8)
697
718
743
745FLECS_API extern ecs_filter_t ECS_FILTER_INIT;
746
749 ecs_header_t hdr;
750
752 int32_t term_count;
753 int32_t field_count;
755 bool owned;
758 ecs_flags32_t flags;
760 char *variable_names[1];
761 int32_t *sizes;
763 /* Mixins */
766 ecs_poly_dtor_t dtor;
768};
769
770/* An observer reacts to events matching a filter */
772 ecs_header_t hdr;
773
776 /* Observer events */
778 int32_t event_count;
779
783 void *ctx;
791 int32_t *last_event_id;
792 int32_t last_event_id_storage;
793
795 int32_t term_index;
801 bool is_multi;
803 /* Mixins */
804 ecs_poly_dtor_t dtor;
805};
806
857
869
870#include "flecs/private/api_types.h" /* Supporting API types */
871#include "flecs/private/api_support.h" /* Supporting API functions */
872#include "flecs/private/vec.h" /* Vector */
873#include "flecs/private/hashmap.h" /* Hashmap */
874
879typedef struct ecs_entity_desc_t {
880 int32_t _canary;
881
884 const char *name;
889 const char *sep;
893 const char *root_sep;
895 const char *symbol;
911
913 const char *add_expr;
915
945
959
964typedef struct ecs_filter_desc_t {
965 int32_t _canary;
966
970
973
976
979
986
988 ecs_flags32_t flags;
989
991 const char *expr;
992
996
1065
1120
1125typedef struct ecs_event_desc_t {
1128
1133
1136
1140
1142 int32_t offset;
1143
1147 int32_t count;
1148
1151
1156 void *param;
1157
1158 /* Same as param, but with the guarantee that the value won't be modified.
1159 * When an event with a const parameter is enqueued, the value of the param
1160 * is copied to a temporary storage of the event type. */
1161 const void *const_param;
1162
1165
1167 ecs_flags32_t flags;
1169
1170
1177/* Utility to hold a value of a dynamic type */
1178typedef struct ecs_value_t {
1179 ecs_entity_t type;
1180 void *ptr;
1181} ecs_value_t;
1182
1184typedef struct ecs_world_info_t {
1213 int32_t id_count;
1219 int32_t table_count;
1226 /* -- Command counts -- */
1227 struct {
1228 int64_t add_count;
1231 int64_t clear_count;
1232 int64_t set_count;
1235 int64_t other_count;
1239 } cmd;
1240
1241 const char *name_prefix;
1246
1253
1263typedef struct EcsIdentifier {
1264 char *value;
1265 ecs_size_t length;
1266 uint64_t hash;
1267 uint64_t index_hash;
1268 ecs_hashmap_t *index;
1270
1272typedef struct EcsComponent {
1273 ecs_size_t size;
1274 ecs_size_t alignment;
1276
1281
1283typedef struct EcsTarget {
1284 int32_t count;
1285 ecs_record_t *target;
1287
1290
1294/* Only include deprecated definitions if deprecated addon is required */
1295#ifdef FLECS_DEPRECATED
1297#endif
1298
1312FLECS_API extern const ecs_id_t ECS_PAIR;
1313
1315FLECS_API extern const ecs_id_t ECS_OVERRIDE;
1316
1318FLECS_API extern const ecs_id_t ECS_TOGGLE;
1319
1321FLECS_API extern const ecs_id_t ECS_AND;
1322
1330/* Builtin component ids */
1331FLECS_API extern const ecs_entity_t ecs_id(EcsComponent);
1332FLECS_API extern const ecs_entity_t ecs_id(EcsIdentifier);
1333FLECS_API extern const ecs_entity_t ecs_id(EcsIterable);
1334FLECS_API extern const ecs_entity_t ecs_id(EcsPoly);
1335
1336FLECS_API extern const ecs_entity_t EcsQuery;
1337FLECS_API extern const ecs_entity_t EcsObserver;
1338
1339/* System module component ids */
1340FLECS_API extern const ecs_entity_t EcsSystem;
1341FLECS_API extern const ecs_entity_t ecs_id(EcsTickSource);
1342
1343/* Pipeline module component ids */
1344FLECS_API extern const ecs_entity_t ecs_id(EcsPipelineQuery);
1345
1346/* Timer module component ids */
1347FLECS_API extern const ecs_entity_t ecs_id(EcsTimer);
1348FLECS_API extern const ecs_entity_t ecs_id(EcsRateFilter);
1349
1351FLECS_API extern const ecs_entity_t EcsFlecs;
1352
1354FLECS_API extern const ecs_entity_t EcsFlecsCore;
1355
1357FLECS_API extern const ecs_entity_t EcsWorld;
1358
1360FLECS_API extern const ecs_entity_t EcsWildcard;
1361
1363FLECS_API extern const ecs_entity_t EcsAny;
1364
1366FLECS_API extern const ecs_entity_t EcsThis;
1367
1369FLECS_API extern const ecs_entity_t EcsVariable;
1370
1375FLECS_API extern const ecs_entity_t EcsTransitive;
1376
1381FLECS_API extern const ecs_entity_t EcsReflexive;
1382
1390FLECS_API extern const ecs_entity_t EcsFinal;
1391
1397FLECS_API extern const ecs_entity_t EcsDontInherit;
1398
1404FLECS_API extern const ecs_entity_t EcsAlwaysOverride;
1405
1410FLECS_API extern const ecs_entity_t EcsSymmetric;
1411
1418FLECS_API extern const ecs_entity_t EcsExclusive;
1419
1421FLECS_API extern const ecs_entity_t EcsAcyclic;
1422
1425FLECS_API extern const ecs_entity_t EcsTraversable;
1426
1433FLECS_API extern const ecs_entity_t EcsWith;
1434
1441FLECS_API extern const ecs_entity_t EcsOneOf;
1442
1445FLECS_API extern const ecs_entity_t EcsTag;
1446
1450FLECS_API extern const ecs_entity_t EcsUnion;
1451
1453FLECS_API extern const ecs_entity_t EcsName;
1454
1456FLECS_API extern const ecs_entity_t EcsSymbol;
1457
1459FLECS_API extern const ecs_entity_t EcsAlias;
1460
1462FLECS_API extern const ecs_entity_t EcsChildOf;
1463
1465FLECS_API extern const ecs_entity_t EcsIsA;
1466
1468FLECS_API extern const ecs_entity_t EcsDependsOn;
1469
1471FLECS_API extern const ecs_entity_t EcsSlotOf;
1472
1474FLECS_API extern const ecs_entity_t EcsModule;
1475
1477FLECS_API extern const ecs_entity_t EcsPrivate;
1478
1481FLECS_API extern const ecs_entity_t EcsPrefab;
1482
1485FLECS_API extern const ecs_entity_t EcsDisabled;
1486
1488FLECS_API extern const ecs_entity_t EcsOnAdd;
1489
1491FLECS_API extern const ecs_entity_t EcsOnRemove;
1492
1494FLECS_API extern const ecs_entity_t EcsOnSet;
1495
1497FLECS_API extern const ecs_entity_t EcsUnSet;
1498
1500FLECS_API extern const ecs_entity_t EcsMonitor;
1501
1503FLECS_API extern const ecs_entity_t EcsOnTableCreate;
1504
1506FLECS_API extern const ecs_entity_t EcsOnTableDelete;
1507
1509FLECS_API extern const ecs_entity_t EcsOnTableEmpty;
1510
1512FLECS_API extern const ecs_entity_t EcsOnTableFill;
1513
1515FLECS_API extern const ecs_entity_t EcsOnDelete;
1516
1519FLECS_API extern const ecs_entity_t EcsOnDeleteTarget;
1520
1523FLECS_API extern const ecs_entity_t EcsRemove;
1524
1527FLECS_API extern const ecs_entity_t EcsDelete;
1528
1531FLECS_API extern const ecs_entity_t EcsPanic;
1532
1534FLECS_API extern const ecs_entity_t ecs_id(EcsTarget);
1535
1538FLECS_API extern const ecs_entity_t EcsFlatten;
1539
1545FLECS_API extern const ecs_entity_t EcsDefaultChildComponent;
1546
1547/* Builtin predicates for comparing entity ids in queries. Only supported by rules */
1548FLECS_API extern const ecs_entity_t EcsPredEq;
1549FLECS_API extern const ecs_entity_t EcsPredMatch;
1550FLECS_API extern const ecs_entity_t EcsPredLookup;
1551
1552/* Builtin marker entities for opening/closing query scopes */
1553FLECS_API extern const ecs_entity_t EcsScopeOpen;
1554FLECS_API extern const ecs_entity_t EcsScopeClose;
1555
1557FLECS_API extern const ecs_entity_t EcsEmpty;
1558
1559/* Pipeline module tags */
1560FLECS_API extern const ecs_entity_t ecs_id(EcsPipeline);
1561FLECS_API extern const ecs_entity_t EcsOnStart;
1562FLECS_API extern const ecs_entity_t EcsPreFrame;
1563FLECS_API extern const ecs_entity_t EcsOnLoad;
1564FLECS_API extern const ecs_entity_t EcsPostLoad;
1565FLECS_API extern const ecs_entity_t EcsPreUpdate;
1566FLECS_API extern const ecs_entity_t EcsOnUpdate;
1567FLECS_API extern const ecs_entity_t EcsOnValidate;
1568FLECS_API extern const ecs_entity_t EcsPostUpdate;
1569FLECS_API extern const ecs_entity_t EcsPreStore;
1570FLECS_API extern const ecs_entity_t EcsOnStore;
1571FLECS_API extern const ecs_entity_t EcsPostFrame;
1572FLECS_API extern const ecs_entity_t EcsPhase;
1573
1576#define EcsLastInternalComponentId (ecs_id(EcsPoly))
1577
1580#define EcsFirstUserComponentId (8)
1581
1584#define EcsFirstUserEntityId (FLECS_HI_COMPONENT_ID + 128)
1585
1586/* When visualized the reserved id ranges look like this:
1587 * [1..8]: Builtin components
1588 * [9..FLECS_HI_COMPONENT_ID]: Low ids reserved for application components
1589 * [FLECS_HI_COMPONENT_ID + 1..EcsFirstUserEntityId]: Builtin entities
1590 */
1591
1612FLECS_API
1614
1621FLECS_API
1623
1631FLECS_API
1633 int argc,
1634 char *argv[]);
1635
1642FLECS_API
1644 ecs_world_t *world);
1645
1653FLECS_API
1655 const ecs_world_t *world);
1656
1664FLECS_API
1666 ecs_world_t *world,
1667 ecs_fini_action_t action,
1668 void *ctx);
1669
1695FLECS_API
1697 ecs_world_t *world,
1698 ecs_ftime_t delta_time);
1699
1706FLECS_API
1708 ecs_world_t *world);
1709
1717FLECS_API
1719 ecs_world_t *world,
1720 ecs_fini_action_t action,
1721 void *ctx);
1722
1729FLECS_API
1731 ecs_world_t *world);
1732
1737FLECS_API
1739 const ecs_world_t *world);
1740
1753 ecs_world_t *world,
1754 bool enable);
1755
1767 ecs_world_t *world,
1768 bool enable);
1769
1785FLECS_API
1787 ecs_world_t *world,
1788 ecs_ftime_t fps);
1789
1826FLECS_API
1828 ecs_world_t *world);
1829
1837FLECS_API
1839 ecs_world_t *world);
1840
1851FLECS_API
1853 ecs_world_t *world);
1854
1864FLECS_API
1866 ecs_world_t *world);
1867
1873FLECS_API
1875 const ecs_world_t *world);
1876
1885FLECS_API
1887 ecs_world_t *world);
1888
1898FLECS_API
1900 ecs_world_t *world);
1901
1907FLECS_API
1909 ecs_world_t *world);
1910
1927FLECS_API
1929 ecs_world_t *world,
1930 bool automerge);
1931
1945FLECS_API
1947 ecs_world_t *world,
1948 int32_t stages);
1949
1956FLECS_API
1958 const ecs_world_t *world);
1959
1967FLECS_API
1969 const ecs_world_t *world);
1970
1986FLECS_API
1988 const ecs_world_t *world,
1989 int32_t stage_id);
1990
1998FLECS_API
2000 const ecs_world_t *world);
2001
2020FLECS_API
2022 ecs_world_t *world);
2023
2030FLECS_API
2032 ecs_world_t *stage);
2033
2040FLECS_API
2042 ecs_world_t *stage);
2043
2059FLECS_API
2061 ecs_world_t *world,
2062 void *ctx,
2063 ecs_ctx_free_t ctx_free);
2064
2073FLECS_API
2075 ecs_world_t *world,
2076 void *ctx,
2077 ecs_ctx_free_t ctx_free);
2078
2086FLECS_API
2088 const ecs_world_t *world);
2089
2097FLECS_API
2099 const ecs_world_t *world);
2100
2106FLECS_API
2108 const ecs_world_t *world);
2109
2118FLECS_API
2120 ecs_world_t *world,
2121 int32_t entity_count);
2122
2138FLECS_API
2140 ecs_world_t *world,
2141 ecs_entity_t id_start,
2142 ecs_entity_t id_end);
2143
2154FLECS_API
2156 ecs_world_t *world,
2157 bool enable);
2158
2163FLECS_API
2165 const ecs_world_t *world);
2166
2180FLECS_API
2182 ecs_world_t *world,
2183 ecs_flags32_t flags);
2184
2218FLECS_API
2220 ecs_world_t *world,
2221 ecs_id_t id,
2222 uint16_t clear_generation,
2223 uint16_t delete_generation,
2224 int32_t min_id_count,
2225 double time_budget_seconds);
2226
2232FLECS_API
2234 const ecs_poly_t *poly);
2235
2241FLECS_API
2243 const ecs_poly_t *poly);
2244
2255FLECS_API
2257 const ecs_poly_t *object,
2258 int32_t type);
2259
2260#define ecs_poly_is(object, type)\
2261 ecs_poly_is_(object, type##_magic)
2262
2270FLECS_API
2272 ecs_entity_t first,
2273 ecs_entity_t second);
2274
2299FLECS_API
2301 ecs_world_t *world);
2302
2320FLECS_API
2322 ecs_world_t *world);
2323
2332FLECS_API
2334 ecs_world_t *world,
2335 ecs_id_t id);
2336
2344FLECS_API
2346 ecs_world_t *world,
2347 ecs_table_t *table);
2348
2367FLECS_API
2369 ecs_world_t *world,
2370 const ecs_entity_desc_t *desc);
2371
2398FLECS_API
2400 ecs_world_t *world,
2401 const ecs_bulk_desc_t *desc);
2402
2412FLECS_API
2414 ecs_world_t *world,
2415 ecs_id_t id,
2416 int32_t count);
2417
2429FLECS_API
2431 ecs_world_t *world,
2432 ecs_entity_t dst,
2433 ecs_entity_t src,
2434 bool copy_value);
2435
2444FLECS_API
2446 ecs_world_t *world,
2447 ecs_entity_t entity);
2448
2456FLECS_API
2458 ecs_world_t *world,
2459 ecs_id_t id);
2460
2477FLECS_API
2479 ecs_world_t *world,
2480 ecs_entity_t entity,
2481 ecs_id_t id);
2482
2491FLECS_API
2493 ecs_world_t *world,
2494 ecs_entity_t entity,
2495 ecs_id_t id);
2496
2519FLECS_API
2521 ecs_world_t *world,
2522 ecs_entity_t entity,
2523 ecs_id_t id);
2524
2531FLECS_API
2533 ecs_world_t *world,
2534 ecs_entity_t entity);
2535
2543FLECS_API
2545 ecs_world_t *world,
2546 ecs_id_t id);
2547
2555FLECS_API
2557 ecs_world_t *world,
2558 ecs_id_t id);
2559
2566FLECS_API
2568 const ecs_world_t *world);
2569
2587FLECS_API
2589 ecs_world_t *world,
2590 ecs_entity_t entity,
2591 bool enabled);
2592
2606FLECS_API
2608 ecs_world_t *world,
2609 ecs_entity_t entity,
2610 ecs_id_t id,
2611 bool enable);
2612
2623FLECS_API
2625 const ecs_world_t *world,
2626 ecs_entity_t entity,
2627 ecs_id_t id);
2628
2646FLECS_API
2647const void* ecs_get_id(
2648 const ecs_world_t *world,
2649 ecs_entity_t entity,
2650 ecs_id_t id);
2651
2662FLECS_API
2664 const ecs_world_t *world,
2665 ecs_entity_t entity,
2666 ecs_id_t id);
2667
2676FLECS_API
2678 const ecs_world_t *world,
2679 ecs_ref_t *ref,
2680 ecs_id_t id);
2681
2689FLECS_API
2691 const ecs_world_t *world,
2692 ecs_ref_t *ref);
2693
2708FLECS_API
2710 ecs_world_t *world,
2711 ecs_entity_t entity,
2712 ecs_id_t id);
2713
2725FLECS_API
2727 ecs_world_t *world,
2728 ecs_entity_t entity,
2729 ecs_id_t id);
2730
2749FLECS_API
2751 ecs_world_t *world,
2752 ecs_entity_t entity);
2753
2760FLECS_API
2762 ecs_record_t *record);
2763
2783FLECS_API
2785 ecs_world_t *world,
2786 ecs_entity_t entity);
2787
2793FLECS_API
2795 const ecs_record_t *record);
2796
2802FLECS_API
2804 const ecs_record_t *record);
2805
2819FLECS_API
2821 ecs_world_t *world,
2822 const ecs_record_t *record,
2823 ecs_id_t id);
2824
2833FLECS_API
2835 ecs_world_t *world,
2836 ecs_record_t *record,
2837 ecs_id_t id);
2838
2845FLECS_API
2847 ecs_world_t *world,
2848 const ecs_record_t *record,
2849 ecs_id_t id);
2850
2864FLECS_API
2866 ecs_world_t *world,
2867 ecs_entity_t entity,
2868 ecs_id_t id);
2869
2879FLECS_API
2881 ecs_world_t *world,
2882 ecs_entity_t entity,
2883 ecs_id_t id);
2884
2901FLECS_API
2903 ecs_world_t *world,
2904 ecs_entity_t entity,
2905 ecs_id_t id,
2906 size_t size,
2907 const void *ptr);
2908
2935FLECS_API
2937 const ecs_world_t *world,
2938 ecs_entity_t e);
2939
2963FLECS_API
2965 const ecs_world_t *world,
2966 ecs_entity_t e);
2967
2973FLECS_API
2975 ecs_entity_t e);
2976
2988FLECS_API
2990 ecs_world_t *world,
2991 ecs_entity_t entity);
2992
3009FLECS_API
3011 const ecs_world_t *world,
3012 ecs_entity_t e);
3013
3034FLECS_API
3036 ecs_world_t *world,
3037 ecs_entity_t entity);
3038
3057FLECS_API
3059 ecs_world_t *world,
3060 ecs_id_t id);
3061
3069FLECS_API
3071 const ecs_world_t *world,
3072 ecs_entity_t entity);
3073
3088FLECS_API
3090 const ecs_world_t *world,
3091 ecs_entity_t entity);
3092
3099FLECS_API
3101 const ecs_world_t *world,
3102 ecs_entity_t entity);
3103
3111FLECS_API
3113 const ecs_world_t *world,
3114 const ecs_type_t* type);
3115
3124FLECS_API
3126 const ecs_world_t *world,
3127 const ecs_table_t *table);
3128
3140FLECS_API
3142 const ecs_world_t *world,
3143 ecs_entity_t entity);
3144
3153FLECS_API
3155 const ecs_world_t *world,
3156 ecs_entity_t entity,
3157 ecs_id_t id);
3158
3169FLECS_API
3171 const ecs_world_t *world,
3172 ecs_entity_t entity,
3173 ecs_id_t id);
3174
3189FLECS_API
3191 const ecs_world_t *world,
3192 ecs_entity_t entity,
3193 ecs_entity_t rel,
3194 int32_t index);
3195
3204FLECS_API
3206 const ecs_world_t *world,
3207 ecs_entity_t entity);
3208
3227FLECS_API
3229 const ecs_world_t *world,
3230 ecs_entity_t entity,
3231 ecs_entity_t rel,
3232 ecs_id_t id);
3233
3244FLECS_API
3246 const ecs_world_t *world,
3247 ecs_entity_t entity,
3248 ecs_entity_t rel);
3249
3250typedef struct ecs_flatten_desc_t {
3251 /* When true, the flatten operation will not remove names from entities in
3252 * the flattened tree. This may fail if entities from different subtrees
3253 * have the same name. */
3254 bool keep_names;
3255
3256 /* When true, the flattened tree won't contain information about the
3257 * original depth of the entities. This can reduce fragmentation, but may
3258 * cause existing code, such as cascade queries, to no longer work. */
3259 bool lose_depth;
3261
3286FLECS_API
3288 ecs_world_t *world,
3289 ecs_id_t pair,
3290 const ecs_flatten_desc_t *desc);
3291
3299FLECS_API
3301 const ecs_world_t *world,
3302 ecs_id_t entity);
3303
3320FLECS_API
3321const char* ecs_get_name(
3322 const ecs_world_t *world,
3323 ecs_entity_t entity);
3324
3332FLECS_API
3333const char* ecs_get_symbol(
3334 const ecs_world_t *world,
3335 ecs_entity_t entity);
3336
3348FLECS_API
3350 ecs_world_t *world,
3351 ecs_entity_t entity,
3352 const char *name);
3353
3365FLECS_API
3367 ecs_world_t *world,
3368 ecs_entity_t entity,
3369 const char *symbol);
3370
3382FLECS_API
3384 ecs_world_t *world,
3385 ecs_entity_t entity,
3386 const char *alias);
3387
3396FLECS_API
3398 const ecs_world_t *world,
3399 const char *name);
3400
3410FLECS_API
3412 const ecs_world_t *world,
3413 ecs_entity_t parent,
3414 const char *name);
3415
3434FLECS_API
3436 const ecs_world_t *world,
3437 ecs_entity_t parent,
3438 const char *path,
3439 const char *sep,
3440 const char *prefix,
3441 bool recursive);
3442
3456FLECS_API
3458 const ecs_world_t *world,
3459 const char *symbol,
3460 bool lookup_as_path,
3461 bool recursive);
3462
3482FLECS_API
3484 const ecs_world_t *world,
3485 ecs_entity_t parent,
3486 ecs_entity_t child,
3487 const char *sep,
3488 const char *prefix);
3489
3501 const ecs_world_t *world,
3502 ecs_entity_t parent,
3503 ecs_entity_t child,
3504 const char *sep,
3505 const char *prefix,
3506 ecs_strbuf_t *buf);
3507
3523FLECS_API
3525 ecs_world_t *world,
3526 ecs_entity_t parent,
3527 const char *path,
3528 const char *sep,
3529 const char *prefix);
3530
3545FLECS_API
3547 ecs_world_t *world,
3548 ecs_entity_t entity,
3549 ecs_entity_t parent,
3550 const char *path,
3551 const char *sep,
3552 const char *prefix);
3553
3565FLECS_API
3567 ecs_world_t *world,
3568 ecs_entity_t scope);
3569
3577FLECS_API
3579 const ecs_world_t *world);
3580
3590FLECS_API
3592 ecs_world_t *world,
3593 const char *prefix);
3594
3619FLECS_API
3621 ecs_world_t *world,
3622 const ecs_entity_t *lookup_path);
3623
3630FLECS_API
3632 const ecs_world_t *world);
3633
3657FLECS_API
3659 ecs_world_t *world,
3660 const ecs_component_desc_t *desc);
3661
3671FLECS_API
3673 const ecs_world_t *world,
3674 ecs_id_t id);
3675
3687FLECS_API
3689 ecs_world_t *world,
3690 ecs_entity_t id,
3691 const ecs_type_hooks_t *hooks);
3692
3699FLECS_API
3701 ecs_world_t *world,
3702 ecs_entity_t id);
3703
3726FLECS_API
3728 const ecs_world_t *world,
3729 ecs_id_t id);
3730
3743FLECS_API
3745 const ecs_world_t *world,
3746 ecs_id_t id);
3747
3756FLECS_API
3758 const ecs_world_t *world,
3759 ecs_id_t id);
3760
3780FLECS_API
3782 const ecs_world_t *world,
3783 ecs_id_t id);
3784
3792FLECS_API
3794 ecs_id_t id,
3795 ecs_id_t pattern);
3796
3802FLECS_API
3804 ecs_id_t id);
3805
3811FLECS_API
3813 ecs_id_t id);
3814
3828FLECS_API
3830 const ecs_world_t *world,
3831 ecs_id_t id);
3832
3841FLECS_API
3842ecs_flags32_t ecs_id_get_flags(
3843 const ecs_world_t *world,
3844 ecs_id_t id);
3845
3852FLECS_API
3854 ecs_id_t id_flags);
3855
3863FLECS_API
3865 const ecs_world_t *world,
3866 ecs_id_t id);
3867
3875FLECS_API
3877 const ecs_world_t *world,
3878 ecs_id_t id,
3879 ecs_strbuf_t *buf);
3880
3898FLECS_API
3899ecs_iter_t ecs_term_iter(
3900 const ecs_world_t *world,
3901 ecs_term_t *term);
3902
3911FLECS_API
3913 const ecs_iter_t *it,
3914 ecs_term_t *term);
3915
3925FLECS_API
3927 ecs_iter_t *it);
3928
3937FLECS_API
3938ecs_iter_t ecs_children(
3939 const ecs_world_t *world,
3940 ecs_entity_t parent);
3941
3948FLECS_API
3950 ecs_iter_t *it);
3951
3957FLECS_API
3959 const ecs_term_id_t *id);
3960
3972FLECS_API
3974 const ecs_term_t *term);
3975
3990FLECS_API
3992 const ecs_term_t *term);
3993
4006FLECS_API
4008 const ecs_term_t *term);
4009
4028FLECS_API
4030 const ecs_world_t *world,
4031 ecs_term_t *term);
4032
4041FLECS_API
4043 const ecs_term_t *src);
4044
4055FLECS_API
4057 ecs_term_t *src);
4058
4065FLECS_API
4067 ecs_term_t *term);
4068
4092FLECS_API
4094 ecs_world_t *world,
4095 const ecs_filter_desc_t *desc);
4096
4102FLECS_API
4104 ecs_filter_t *filter);
4105
4119FLECS_API
4121 const ecs_world_t *world,
4122 ecs_filter_t *filter);
4123
4135FLECS_API
4137 const ecs_filter_t *filter);
4138
4147FLECS_API
4149 const ecs_world_t *world,
4150 const ecs_term_t *term);
4151
4160FLECS_API
4162 const ecs_world_t *world,
4163 const ecs_filter_t *filter);
4164
4173FLECS_API
4175 const ecs_world_t *world,
4176 const ecs_filter_t *filter);
4177
4186FLECS_API
4188 const ecs_iter_t *it,
4189 const ecs_filter_t *filter);
4190
4210FLECS_API
4212 const ecs_world_t *world,
4213 const ecs_filter_t *filter);
4214
4224FLECS_API
4226 ecs_iter_t *it);
4227
4234FLECS_API
4236 ecs_iter_t *it);
4237
4243FLECS_API
4245 ecs_filter_t *dst,
4246 ecs_filter_t *src);
4247
4253FLECS_API
4255 ecs_filter_t *dst,
4256 const ecs_filter_t *src);
4257
4300FLECS_API
4302 ecs_world_t *world,
4303 const ecs_query_desc_t *desc);
4304
4312FLECS_API
4315
4323FLECS_API
4325 const ecs_query_t *query);
4326
4354FLECS_API
4356 const ecs_world_t *world,
4358
4368FLECS_API
4370 ecs_iter_t *iter);
4371
4378FLECS_API
4380 ecs_iter_t *iter);
4381
4392FLECS_API
4394 ecs_iter_t *iter);
4395
4417FLECS_API
4419 ecs_iter_t *iter,
4420 bool when_changed);
4421
4451FLECS_API
4454 const ecs_iter_t *it);
4455
4466FLECS_API
4468 ecs_iter_t *it);
4469
4492FLECS_API
4494 ecs_iter_t *it,
4495 uint64_t group_id);
4496
4505FLECS_API
4507 const ecs_query_t *query,
4508 uint64_t group_id);
4509
4518FLECS_API
4520 const ecs_query_t *query,
4521 uint64_t group_id);
4522
4531FLECS_API
4533 const ecs_query_t *query);
4534
4540FLECS_API
4542 const ecs_query_t *query);
4543
4549FLECS_API
4551 const ecs_query_t *query);
4552
4558FLECS_API
4560 const ecs_query_t *query);
4561
4569FLECS_API
4571 const ecs_query_t *query);
4572
4579FLECS_API
4581 const ecs_query_t *query);
4582
4589FLECS_API
4591 const ecs_query_t *query);
4592
4618FLECS_API
4620 ecs_world_t *world,
4621 ecs_event_desc_t *desc);
4622
4623FLECS_API
4624void ecs_enqueue(
4625 ecs_world_t *world,
4626 ecs_event_desc_t *desc);
4627
4637FLECS_API
4639 ecs_world_t *world,
4640 const ecs_observer_desc_t *desc);
4641
4651FLECS_API
4653 ecs_iter_t *it);
4654
4662FLECS_API
4664 const ecs_world_t *world,
4666
4674FLECS_API
4676 const ecs_world_t *world,
4678
4708FLECS_API
4710 const ecs_world_t *world,
4711 const ecs_poly_t *poly,
4712 ecs_iter_t *iter,
4713 ecs_term_t *filter);
4714
4728FLECS_API
4730 ecs_iter_t *it);
4731
4741FLECS_API
4743 ecs_iter_t *it);
4744
4756FLECS_API
4758 ecs_iter_t *it);
4759
4772FLECS_API
4774 ecs_iter_t *it);
4775
4783FLECS_API
4785 ecs_iter_t *it);
4786
4820FLECS_API
4822 ecs_iter_t *it,
4823 int32_t var_id,
4824 ecs_entity_t entity);
4825
4833FLECS_API
4835 ecs_iter_t *it,
4836 int32_t var_id,
4837 const ecs_table_t *table);
4838
4846FLECS_API
4848 ecs_iter_t *it,
4849 int32_t var_id,
4850 const ecs_table_range_t *range);
4851
4864FLECS_API
4866 ecs_iter_t *it,
4867 int32_t var_id);
4868
4882FLECS_API
4884 ecs_iter_t *it,
4885 int32_t var_id);
4886
4900FLECS_API
4902 ecs_iter_t *it,
4903 int32_t var_id);
4904
4916FLECS_API
4918 ecs_iter_t *it,
4919 int32_t var_id);
4920
4932FLECS_API
4934 const ecs_iter_t *it);
4935
4951FLECS_API
4952ecs_iter_t ecs_page_iter(
4953 const ecs_iter_t *it,
4954 int32_t offset,
4955 int32_t limit);
4956
4963FLECS_API
4965 ecs_iter_t *it);
4966
4987FLECS_API
4989 const ecs_iter_t *it,
4990 int32_t index,
4991 int32_t count);
4992
4999FLECS_API
5001 ecs_iter_t *it);
5002
5026FLECS_API
5028 const ecs_iter_t *it,
5029 size_t size,
5030 int32_t index);
5031
5040FLECS_API
5042 const ecs_iter_t *it,
5043 int32_t index);
5044
5055FLECS_API
5057 const ecs_iter_t *it,
5058 int32_t index);
5059
5066FLECS_API
5068 const ecs_iter_t *it,
5069 int32_t index);
5070
5077FLECS_API
5079 const ecs_iter_t *it,
5080 int32_t index);
5081
5090FLECS_API
5092 const ecs_iter_t *it,
5093 int32_t index);
5094
5102FLECS_API
5104 const ecs_iter_t *it,
5105 int32_t index);
5106
5114FLECS_API
5116 const ecs_iter_t *it,
5117 int32_t index);
5118
5132FLECS_API
5134 const ecs_iter_t *it,
5135 int32_t index);
5136
5151FLECS_API
5153 const ecs_table_t *table);
5154
5163FLECS_API
5165 const ecs_world_t *world,
5166 const ecs_table_t *table,
5167 ecs_id_t id);
5168
5178FLECS_API
5180 const ecs_world_t *world,
5181 const ecs_table_t *table,
5182 ecs_id_t id);
5183
5191FLECS_API
5193 const ecs_table_t *table);
5194
5206FLECS_API
5208 const ecs_table_t *table,
5209 int32_t index);
5210
5219FLECS_API
5221 const ecs_table_t *table,
5222 int32_t index);
5223
5232FLECS_API
5234 const ecs_table_t *table,
5235 int32_t index,
5236 int32_t offset);
5237
5246FLECS_API
5248 const ecs_world_t *world,
5249 const ecs_table_t *table,
5250 ecs_id_t id,
5251 int32_t offset);
5252
5260FLECS_API
5262 const ecs_table_t *table,
5263 int32_t index);
5264
5273FLECS_API
5275 const ecs_table_t *table);
5276
5285FLECS_API
5287 const ecs_world_t *world,
5288 const ecs_table_t *table,
5289 ecs_id_t id);
5290
5301FLECS_API
5303 const ecs_world_t *world,
5304 const ecs_table_t *table,
5305 ecs_entity_t rel);
5306
5316FLECS_API
5318 ecs_world_t *world,
5319 ecs_table_t *table,
5320 ecs_id_t id);
5321
5332FLECS_API
5334 ecs_world_t *world,
5335 const ecs_id_t *ids,
5336 int32_t id_count);
5337
5347FLECS_API
5349 ecs_world_t *world,
5350 ecs_table_t *table,
5351 ecs_id_t id);
5352
5368FLECS_API
5370 ecs_world_t *world,
5371 ecs_table_t *table);
5372
5379FLECS_API
5381 ecs_world_t *world,
5382 ecs_table_t *table);
5383
5393FLECS_API
5395 ecs_table_t *table,
5396 ecs_flags32_t flags);
5397
5405FLECS_API
5407 ecs_world_t* world,
5408 ecs_table_t* table,
5409 int32_t row_1,
5410 int32_t row_2);
5411
5434FLECS_API
5436 ecs_world_t *world,
5437 ecs_entity_t entity,
5438 ecs_record_t *record,
5439 ecs_table_t *table,
5440 const ecs_type_t *added,
5441 const ecs_type_t *removed);
5442
5444FLECS_API
5446 const ecs_world_t *world,
5447 ecs_entity_t entity);
5448
5450FLECS_API
5452 const ecs_record_t *r,
5453 int32_t column,
5454 size_t c_size);
5455
5471FLECS_API
5473 const ecs_world_t *world,
5474 const ecs_table_t *table,
5475 ecs_id_t id,
5476 ecs_id_t *id_out);
5477
5508FLECS_API
5510 const ecs_world_t *world,
5511 const ecs_table_t *table,
5512 int32_t offset,
5513 ecs_id_t id,
5514 ecs_id_t *id_out);
5515
5552FLECS_API
5554 const ecs_world_t *world,
5555 const ecs_table_t *table,
5556 int32_t offset,
5557 ecs_id_t id,
5558 ecs_entity_t rel,
5559 ecs_flags32_t flags, /* EcsSelf and/or EcsUp */
5560 ecs_entity_t *subject_out,
5561 ecs_id_t *id_out,
5562 struct ecs_table_record_t **tr_out);
5563
5579FLECS_API
5581 const ecs_world_t *world,
5582 ecs_entity_t type,
5583 void *ptr);
5584
5592FLECS_API
5594 const ecs_world_t *world,
5595 const ecs_type_info_t *ti,
5596 void *ptr);
5597
5604FLECS_API
5606 ecs_world_t *world,
5607 ecs_entity_t type);
5608
5616 ecs_world_t *world,
5617 const ecs_type_info_t *ti);
5618
5627 const ecs_world_t *world,
5628 const ecs_type_info_t *ti,
5629 void *ptr);
5630
5638FLECS_API
5640 const ecs_world_t *world,
5641 ecs_entity_t type,
5642 void* ptr);
5643
5650FLECS_API
5652 ecs_world_t *world,
5653 ecs_entity_t type,
5654 void* ptr);
5655
5664FLECS_API
5666 const ecs_world_t *world,
5667 const ecs_type_info_t *ti,
5668 void* dst,
5669 const void *src);
5670
5679FLECS_API
5681 const ecs_world_t *world,
5682 ecs_entity_t type,
5683 void* dst,
5684 const void *src);
5685
5695 const ecs_world_t *world,
5696 const ecs_type_info_t *ti,
5697 void* dst,
5698 void *src);
5699
5709 const ecs_world_t *world,
5710 ecs_entity_t type,
5711 void* dst,
5712 void *src);
5713
5723 const ecs_world_t *world,
5724 const ecs_type_info_t *ti,
5725 void* dst,
5726 void *src);
5727
5737 const ecs_world_t *world,
5738 ecs_entity_t type,
5739 void* dst,
5740 void *src);
5741
5756#include "flecs/addons/flecs_c.h"
5757
5758#ifdef __cplusplus
5759}
5760#endif
5761
5762#include "flecs/private/addons.h"
5763
5764#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_override_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Add override for (component) 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.
ecs_iterable_t EcsIterable
Component for iterable entities.
Definition flecs.h:1289
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 relatoinship as reflexive.
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 EcsTraversable
Marks a relationship as traversable.
const ecs_entity_t EcsUnSet
Event that triggers when a component is unset for an entity.
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 EcsAlwaysOverride
Ensures a component is always overridden.
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 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 EcsRemove
Remove cleanup policy.
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 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 EcsUnion
Tag to indicate that relationship is stored as union.
const ecs_entity_t EcsAny
Any entity ("_").
const ecs_entity_t EcsWith
Ensure that a component always is added together with another component.
const ecs_entity_t EcsTag
Can be added to relationship to indicate that it should never hold data, even when it or the relation...
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 EcsFlecs
Root scope for builtin flecs entities.
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
Ensures that component is never inherited from an IsA target.
const ecs_entity_t EcsPanic
Panic cleanup policy.
const ecs_entity_t EcsDefaultChildComponent
Used like (EcsDefaultChildComponent, Component).
const ecs_entity_t EcsFinal
Ensures that entity/component cannot be used as target in IsA relationship.
const ecs_entity_t EcsVariable
Variable entity ("$").
const ecs_entity_t EcsFlatten
Tag added to root entity to indicate its subtree should be flattened.
bool ecs_defer_end(ecs_world_t *world)
End block of operations to defer.
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.
bool ecs_stage_is_async(ecs_world_t *stage)
Test whether provided stage is asynchronous.
void ecs_merge(ecs_world_t *world)
Merge world or stage.
void ecs_async_stage_free(ecs_world_t *stage)
Free asynchronous stage.
void ecs_set_automerge(ecs_world_t *world, bool automerge)
Enable/disable automerging for world or stage.
ecs_world_t * ecs_async_stage_new(ecs_world_t *world)
Create asynchronous stage.
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.
bool ecs_readonly_begin(ecs_world_t *world)
Begin readonly mode.
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.
int32_t ecs_get_stage_id(const ecs_world_t *world)
Get current stage id.
const ecs_type_hooks_t * ecs_get_hooks_id(ecs_world_t *world, ecs_entity_t id)
Get hooks for component.
ecs_entity_t ecs_component_init(ecs_world_t *world, const ecs_component_desc_t *desc)
Find or create a component.
void ecs_set_hooks_id(ecs_world_t *world, ecs_entity_t id, const ecs_type_hooks_t *hooks)
Register hooks for component.
const ecs_type_info_t * ecs_get_type_info(const ecs_world_t *world, ecs_id_t id)
Get the type for an id.
struct ecs_ref_t ecs_ref_t
A ref is a fast way to fetch a component for a specific entity.
Definition flecs.h:425
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:288
struct ecs_rule_t ecs_rule_t
A rule is a query with advanced graph traversal features.
Definition flecs.h:385
struct ecs_table_record_t ecs_table_record_t
Information about where in a table a specific (component) id is stored.
Definition flecs.h:444
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:441
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition flecs.h:332
struct ecs_mixins_t ecs_mixins_t
Type that stores poly mixins.
Definition flecs.h:471
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
Definition flecs.h:281
struct ecs_query_t ecs_query_t
A query that caches its results.
Definition flecs.h:364
struct ecs_observable_t ecs_observable_t
An observable produces events that can be listened for by an observer.
Definition flecs.h:408
struct ecs_record_t ecs_record_t
Information about an entity, like its table and row.
Definition flecs.h:438
struct ecs_table_t ecs_table_t
A table stores entities and components for a specific type.
Definition flecs.h:335
void ecs_poly_t
A poly object.
Definition flecs.h:468
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.
ecs_entity_t ecs_new_id(ecs_world_t *world)
Create new entity 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_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_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.
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.
void ecs_flatten(ecs_world_t *world, ecs_id_t pair, const ecs_flatten_desc_t *desc)
Recursively flatten relationship for target entity (experimental).
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.
bool ecs_children_next(ecs_iter_t *it)
Progress a children iterator.
ecs_term_t ecs_term_copy(const ecs_term_t *src)
Copy resources of a term to another term.
ecs_iter_t ecs_term_chain_iter(const ecs_iter_t *it, ecs_term_t *term)
Return a chained term iterator.
void ecs_term_fini(ecs_term_t *term)
Free resources of term.
ecs_filter_t * ecs_filter_init(ecs_world_t *world, const ecs_filter_desc_t *desc)
Initialize filter A filter is a lightweight object that can be used to query for entities in a world.
bool ecs_filter_next(ecs_iter_t *it)
Iterate tables matched by filter.
ecs_iter_t ecs_filter_iter(const ecs_world_t *world, const ecs_filter_t *filter)
Return a filter iterator.
char * ecs_term_str(const ecs_world_t *world, const ecs_term_t *term)
Convert term to string expression.
int ecs_filter_finalize(const ecs_world_t *world, ecs_filter_t *filter)
Finalize filter.
char * ecs_filter_str(const ecs_world_t *world, const ecs_filter_t *filter)
Convert filter to string expression.
void ecs_filter_fini(ecs_filter_t *filter)
Deinitialize filter.
bool ecs_filter_next_instanced(ecs_iter_t *it)
Same as ecs_filter_next, but always instanced.
bool ecs_term_next(ecs_iter_t *it)
Progress a term iterator.
int32_t ecs_filter_pivot_term(const ecs_world_t *world, const ecs_filter_t *filter)
Get pivot term for filter.
ecs_iter_t ecs_children(const ecs_world_t *world, ecs_entity_t parent)
Iterator for a parent's children.
int32_t ecs_filter_find_this_var(const ecs_filter_t *filter)
Find index for $this variable.
bool ecs_term_match_this(const ecs_term_t *term)
Is term matched on $this variable.
int ecs_term_finalize(const ecs_world_t *world, ecs_term_t *term)
Finalize term.
bool ecs_term_id_is_set(const ecs_term_id_t *id)
Test whether term id is set.
void ecs_filter_move(ecs_filter_t *dst, ecs_filter_t *src)
Move resources of one filter to another.
bool ecs_term_is_initialized(const ecs_term_t *term)
Test whether a term is set.
ecs_term_t ecs_term_move(ecs_term_t *src)
Move resources of a term to another term.
void ecs_filter_copy(ecs_filter_t *dst, const ecs_filter_t *src)
Copy resources of one filter to another.
ecs_iter_t ecs_filter_chain_iter(const ecs_iter_t *it, const ecs_filter_t *filter)
Return a chained filter iterator.
bool ecs_term_match_0(const ecs_term_t *term)
Is term matched on 0 source.
ecs_iter_t ecs_term_iter(const ecs_world_t *world, ecs_term_t *term)
Iterator for a single (component) id.
void(* ecs_module_action_t)(ecs_world_t *world)
Initialization action for modules.
Definition flecs.h:583
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:563
uint64_t(* ecs_hash_value_action_t)(const void *ptr)
Callback used for hashing values.
Definition flecs.h:601
void(* ecs_iter_fini_action_t)(ecs_iter_t *it)
Function prototype for freeing an iterator.
Definition flecs.h:541
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:552
bool(* ecs_iter_next_action_t)(ecs_iter_t *it)
Function prototype for iterating an iterator.
Definition flecs.h:533
void(* ecs_iter_action_t)(ecs_iter_t *it)
Function prototype for iterables.
Definition flecs.h:506
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:611
int(* ecs_compare_action_t)(const void *ptr1, const void *ptr2)
Callback used for sorting values.
Definition flecs.h:596
void(* ecs_fini_action_t)(ecs_world_t *world, void *ctx)
Action callback on world exit.
Definition flecs.h:587
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:618
void(* ecs_run_action_t)(ecs_iter_t *it)
Function prototype for runnables (systems, observers).
Definition flecs.h:497
void(* ecs_ctx_free_t)(void *ctx)
Function to cleanup context data.
Definition flecs.h:592
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:545
void(* ecs_iter_init_action_t)(const ecs_world_t *world, const ecs_poly_t *iterable, ecs_iter_t *it, ecs_term_t *filter)
Function prototype for creating an iterator from a poly.
Definition flecs.h:520
void(* ecs_xtor_t)(void *ptr, int32_t count, const ecs_type_info_t *type_info)
Constructor/destructor callback.
Definition flecs.h:605
void * ecs_emplace_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Emplace a component.
ecs_ref_t ecs_ref_init_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Create a component ref.
void * ecs_record_get_mut_id(ecs_world_t *world, ecs_record_t *record, ecs_id_t id)
Same as ecs_record_get_id, but returns a mutable pointer.
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.
void ecs_read_end(const ecs_record_t *record)
End read access to entity.
void ecs_write_end(ecs_record_t *record)
End exclusive write access to entity.
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 component.
const void * ecs_record_get_id(ecs_world_t *world, const ecs_record_t *record, ecs_id_t id)
Get component from entity record.
ecs_entity_t 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.
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.
void * ecs_get_mut_modified_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Combines get_mut + modifed in single operation.
const ecs_record_t * ecs_read_begin(ecs_world_t *world, ecs_entity_t entity)
Begin read access to entity.
void * ecs_get_mut_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Get a mutable pointer to a component.
const ecs_id_t ECS_PAIR
Indicates that the id is a pair.
const ecs_id_t ECS_OVERRIDE
Automatically override component when it is inherited.
const ecs_id_t ECS_AND
Include all components from entity to which AND is applied.
const ecs_id_t ECS_TOGGLE
Adds bitset to storage which allows component to be enabled/disabled.
bool ecs_id_is_union(const ecs_world_t *world, ecs_id_t id)
Return whether represents a union.
bool ecs_id_is_valid(const ecs_world_t *world, ecs_id_t id)
Utility to check if id is valid.
bool ecs_id_is_pair(ecs_id_t id)
Utility to check if id is a pair.
ecs_entity_t ecs_get_typeid(const ecs_world_t *world, ecs_id_t id)
Get the type for an id.
bool ecs_id_match(ecs_id_t id, ecs_id_t pattern)
Utility to match an id with a pattern.
const char * ecs_id_flag_str(ecs_id_t id_flags)
Convert id flag to string.
bool ecs_id_in_use(const ecs_world_t *world, ecs_id_t id)
Returns whether specified id is in use.
bool ecs_id_is_tag(const ecs_world_t *world, ecs_id_t id)
Returns whether specified id a tag.
void ecs_id_str_buf(const ecs_world_t *world, ecs_id_t id, ecs_strbuf_t *buf)
Write id string to buffer.
char * ecs_id_str(const ecs_world_t *world, ecs_id_t id)
Convert id to string.
bool ecs_id_is_wildcard(ecs_id_t id)
Utility to check if id is a wildcard.
ecs_flags32_t ecs_id_get_flags(const ecs_world_t *world, ecs_id_t id)
Get flags associated with id.
bool ecs_field_is_set(const ecs_iter_t *it, int32_t index)
Test whether field is set.
bool ecs_field_is_writeonly(const ecs_iter_t *it, int32_t index)
Test whether the field is writeonly.
bool ecs_field_is_self(const ecs_iter_t *it, int32_t index)
Test whether the field is matched on self.
void * ecs_field_w_size(const ecs_iter_t *it, size_t size, int32_t index)
Obtain data for a query field.
ecs_iter_t ecs_worker_iter(const ecs_iter_t *it, int32_t index, int32_t count)
Create a worker iterator.
size_t ecs_field_size(const ecs_iter_t *it, int32_t index)
Return field type size.
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_iter_poly(const ecs_world_t *world, const ecs_poly_t *poly, ecs_iter_t *iter, ecs_term_t *filter)
Create iterator from poly object.
ecs_id_t ecs_field_id(const ecs_iter_t *it, int32_t index)
Return id matched for field.
bool ecs_field_is_readonly(const ecs_iter_t *it, int32_t index)
Test whether the field is readonly.
void ecs_iter_set_var(ecs_iter_t *it, int32_t var_id, ecs_entity_t entity)
Set value for iterator variable.
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.
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.
ecs_entity_t ecs_field_src(const ecs_iter_t *it, int32_t index)
Return field source.
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 enti...
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.
int32_t ecs_field_column_index(const ecs_iter_t *it, int32_t index)
Return index of matched table column.
ecs_id_t ecs_strip_generation(ecs_entity_t e)
Remove generation from entity id.
void ecs_ensure(ecs_world_t *world, ecs_entity_t entity)
Ensure id is alive.
bool ecs_is_valid(const ecs_world_t *world, ecs_entity_t e)
Test whether an entity is valid.
void ecs_set_entity_generation(ecs_world_t *world, ecs_entity_t entity)
Override the generation of an entity.
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.
void ecs_ensure_id(ecs_world_t *world, ecs_id_t id)
Same as ecs_ensure, but for (component) ids.
bool ecs_is_alive(const ecs_world_t *world, ecs_entity_t e)
Test whether an entity is alive.
void ecs_emit(ecs_world_t *world, ecs_event_desc_t *desc)
Send event.
ecs_entity_t ecs_observer_init(ecs_world_t *world, const ecs_observer_desc_t *desc)
Create observer.
void * ecs_observer_get_ctx(const ecs_world_t *world, ecs_entity_t observer)
Get observer ctx.
bool ecs_observer_default_run_action(ecs_iter_t *it)
Default run action for observer.
void * ecs_observer_get_binding_ctx(const ecs_world_t *world, ecs_entity_t observer)
Get observer binding ctx.
#define FLECS_TERM_DESC_MAX
Maximum number of terms in ecs_filter_desc_t.
Definition flecs.h:238
#define FLECS_EVENT_DESC_MAX
Maximum number of events in ecs_observer_desc_t.
Definition flecs.h:242
#define ecs_ftime_t
Customizable precision for scalar time values.
Definition flecs.h:42
#define FLECS_ID_DESC_MAX
Maximum number of ids to add ecs_entity_desc_t / ecs_bulk_desc_t.
Definition flecs.h:233
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(const ecs_world_t *world, const char *name)
Lookup an entity by name.
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.
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.
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_next_instanced(ecs_iter_t *iter)
Same as ecs_query_next, but always instanced.
void ecs_query_fini(ecs_query_t *query)
Destroy a query.
void ecs_query_skip(ecs_iter_t *it)
Skip a table while iterating.
int32_t ecs_query_table_count(const ecs_query_t *query)
Returns number of tables query matched with.
bool ecs_query_next_table(ecs_iter_t *iter)
Fast alternative to ecs_query_next that only returns matched tables.
int32_t ecs_query_entity_count(const ecs_query_t *query)
Returns number of entities query matched with.
char * ecs_query_str(const ecs_query_t *query)
Convert query to string.
void * ecs_query_get_ctx(const ecs_query_t *query)
Get query ctx.
ecs_query_t * ecs_query_init(ecs_world_t *world, const ecs_query_desc_t *desc)
Create a query.
void ecs_query_set_group(ecs_iter_t *it, uint64_t group_id)
Set group to iterate for query iterator.
ecs_iter_t ecs_query_iter(const ecs_world_t *world, ecs_query_t *query)
Return a query iterator.
bool ecs_query_next(ecs_iter_t *iter)
Progress the query iterator.
void * ecs_query_get_group_ctx(const ecs_query_t *query, uint64_t group_id)
Get context of query group.
int ecs_query_populate(ecs_iter_t *iter, bool when_changed)
Populate iterator fields.
bool ecs_query_orphaned(const ecs_query_t *query)
Returns whether query is orphaned.
void * ecs_query_get_binding_ctx(const ecs_query_t *query)
Get query binding ctx.
const ecs_filter_t * ecs_query_get_filter(const ecs_query_t *query)
Get filter from a query.
int32_t ecs_query_empty_table_count(const ecs_query_t *query)
Returns number of empty tables query matched with.
bool ecs_query_changed(ecs_query_t *query, const ecs_iter_t *it)
Returns whether the query data changed since the last iteration.
ecs_inout_kind_t
Specify read/write access for term.
Definition flecs.h:651
ecs_oper_kind_t
Specify operator for term.
Definition flecs.h:660
ecs_filter_t ECS_FILTER_INIT
Use $this variable to initialize user-allocated filter object.
@ EcsOut
Term is only written.
Definition flecs.h:656
@ EcsInOut
Term is both read and written.
Definition flecs.h:654
@ EcsInOutDefault
InOut for regular terms, In for shared terms.
Definition flecs.h:652
@ EcsInOutNone
Term is neither read nor written.
Definition flecs.h:653
@ EcsIn
Term is only read.
Definition flecs.h:655
@ EcsNot
The term must not match.
Definition flecs.h:663
@ EcsOptional
The term may match.
Definition flecs.h:664
@ EcsOr
One of the terms in an or chain must match.
Definition flecs.h:662
@ EcsOrFrom
Term must match at least one component from term id.
Definition flecs.h:666
@ EcsAnd
The term must match.
Definition flecs.h:661
@ EcsNotFrom
Term must match none of the components from term id.
Definition flecs.h:667
@ EcsAndFrom
Term must match all components from term id.
Definition flecs.h:665
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.
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_search_relation(const ecs_world_t *world, const ecs_table_t *table, int32_t offset, ecs_id_t id, ecs_entity_t rel, ecs_flags32_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_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 records in the 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 or unlock table.
void * ecs_record_get_column(const ecs_record_t *r, int32_t column, size_t c_size)
Get component pointer from column/record.
ecs_table_t * ecs_table_find(ecs_world_t *world, const ecs_id_t *ids, int32_t id_count)
Find table from id array.
ecs_record_t * ecs_record_find(const ecs_world_t *world, ecs_entity_t entity)
Find record for entity.
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_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.
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.
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 signaled.
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.
bool ecs_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 issueing 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.
flecs::observer_builder< Components... > observer(Args &&... args) const
Create a new observer.
Operating system abstraction API.
flecs::query< Comps... > query(flecs::query_base &parent, Args &&... args) const
Create a subquery.
Component information.
Definition flecs.h:1272
ecs_size_t size
Component size.
Definition flecs.h:1273
ecs_size_t alignment
Component alignment.
Definition flecs.h:1274
A (string) identifier.
Definition flecs.h:1263
ecs_size_t length
Length of identifier.
Definition flecs.h:1265
char * value
Identifier string.
Definition flecs.h:1264
ecs_hashmap_t * index
Current index.
Definition flecs.h:1268
uint64_t hash
Hash of current value.
Definition flecs.h:1266
uint64_t index_hash
Hash of existing record in current index.
Definition flecs.h:1267
Component for storing a poly object.
Definition flecs.h:1278
ecs_poly_t * poly
Pointer to poly object.
Definition flecs.h:1279
Apply a rate filter to a tick source.
Definition timer.h:45
Target data for flattened relationships.
Definition flecs.h:1283
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
Used with ecs_bulk_init.
Definition flecs.h:920
void ** data
Array with component data to insert.
Definition flecs.h:932
ecs_id_t ids[(32)]
Ids to create the entities with.
Definition flecs.h:930
int32_t count
Number of entities to create/populate.
Definition flecs.h:928
ecs_entity_t * entities
Entities to bulk insert.
Definition flecs.h:923
ecs_table_t * table
Table to insert the entities into.
Definition flecs.h:939
Used with ecs_component_init.
Definition flecs.h:950
ecs_type_info_t type
Parameters for type (size, hooks, ...)
Definition flecs.h:957
ecs_entity_t entity
Existing entity to associate with observer (optional)
Definition flecs.h:954
Used with ecs_entity_init.
Definition flecs.h:879
const char * sep
Optional custom separator for hierarchical names.
Definition flecs.h:889
const char * root_sep
Optional, used for identifiers relative to root.
Definition flecs.h:893
const char * name
Name of the entity.
Definition flecs.h:884
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:905
ecs_id_t add[(32)]
Array of ids to add to the new or existing entity.
Definition flecs.h:910
const char * symbol
Optional entity symbol.
Definition flecs.h:895
const char * add_expr
String expression with components to add.
Definition flecs.h:913
ecs_entity_t id
Set to modify existing entity (optional)
Definition flecs.h:882
Used with ecs_emit.
Definition flecs.h:1125
ecs_entity_t entity
Single-entity alternative to setting table / offset / count.
Definition flecs.h:1150
ecs_table_t * table
The table for which to notify.
Definition flecs.h:1135
int32_t count
Limit number of notified entities to count.
Definition flecs.h:1147
ecs_table_t * other_table
Optional 2nd table to notify.
Definition flecs.h:1139
int32_t offset
Limit notified entities to ones starting from offset (row) in table.
Definition flecs.h:1142
const ecs_type_t * ids
Component ids.
Definition flecs.h:1132
ecs_poly_t * observable
Observable (usually the world)
Definition flecs.h:1164
ecs_entity_t event
The event id.
Definition flecs.h:1127
ecs_flags32_t flags
Event flags.
Definition flecs.h:1167
void * param
Optional context.
Definition flecs.h:1156
Used with ecs_filter_init.
Definition flecs.h:964
ecs_term_t * terms_buffer
For filters with lots of terms an outside array can be provided.
Definition flecs.h:972
bool instanced
When true, terms returned by an iterator may either contain 1 or N elements, where terms with N eleme...
Definition flecs.h:985
ecs_term_t terms[(16)]
Terms of the filter.
Definition flecs.h:969
int32_t terms_buffer_count
Number of terms in array provided in terms_buffer.
Definition flecs.h:975
ecs_entity_t entity
Entity associated with query (optional)
Definition flecs.h:994
ecs_flags32_t flags
Flags for advanced usage.
Definition flecs.h:988
ecs_filter_t * storage
External storage to prevent allocation of the filter object.
Definition flecs.h:978
const char * expr
Filter expression.
Definition flecs.h:991
Filters alllow for ad-hoc quick filtering of entity tables.
Definition flecs.h:748
ecs_term_t * terms
Array containing terms for filter.
Definition flecs.h:751
int32_t * sizes
Field size (same for each result)
Definition flecs.h:761
bool owned
Is filter object owned by filter.
Definition flecs.h:755
int32_t field_count
Number of fields in iterator for filter.
Definition flecs.h:753
int32_t term_count
Number of elements in terms array.
Definition flecs.h:752
ecs_flags32_t flags
Filter flags.
Definition flecs.h:758
bool terms_owned
Is terms array owned by filter.
Definition flecs.h:756
ecs_world_t * world
World mixin.
Definition flecs.h:767
char * variable_names[1]
Placeholder variable names array.
Definition flecs.h:760
ecs_poly_dtor_t dtor
Dtor mixin.
Definition flecs.h:766
ecs_entity_t entity
Entity associated with filter (optional)
Definition flecs.h:764
ecs_iterable_t iterable
Iterable mixin.
Definition flecs.h:765
Header for ecs_poly_t objects.
Definition flecs.h:474
Iterable mixin.
Definition flecs.h:638
ecs_iter_init_action_t init
Callback that creates iterator.
Definition flecs.h:639
Used with ecs_observer_init.
Definition flecs.h:1070
void * binding_ctx
Context to be used for language bindings.
Definition flecs.h:1102
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:1105
ecs_entity_t entity
Existing entity to associate with observer (optional)
Definition flecs.h:1074
ecs_filter_desc_t filter
Filter for observer.
Definition flecs.h:1077
int32_t term_index
Used for internal purposes.
Definition flecs.h:1118
ecs_entity_t events[(8)]
Events to observe (OnAdd, OnRemove, OnSet, UnSet)
Definition flecs.h:1080
int32_t * last_event_id
Optional shared last event id for multiple observers.
Definition flecs.h:1115
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:1108
void * ctx
User context to pass to callback.
Definition flecs.h:1099
ecs_poly_t * observable
Observable with which to register the observer.
Definition flecs.h:1111
ecs_iter_action_t callback
Callback to invoke on an event, invoked when the observer matches.
Definition flecs.h:1088
bool yield_existing
When observer is created, generate events from existing data.
Definition flecs.h:1085
ecs_run_action_t run
Callback invoked on an event.
Definition flecs.h:1096
ecs_iter_action_t callback
See ecs_observer_desc_t::callback.
Definition flecs.h:780
int32_t term_index
Index of the term in parent observer (single term observers only)
Definition flecs.h:795
ecs_observable_t * observable
Observable for observer.
Definition flecs.h:789
ecs_run_action_t run
See ecs_observer_desc_t::run.
Definition flecs.h:781
int32_t * last_event_id
Last handled event id.
Definition flecs.h:791
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:786
ecs_filter_t filter
Query for observer.
Definition flecs.h:774
void * ctx
Callback context.
Definition flecs.h:783
ecs_id_t register_id
Id observer is registered with (single term observers only)
Definition flecs.h:794
void * binding_ctx
Binding context (for language bindings)
Definition flecs.h:784
bool is_monitor
If true, the observer only triggers when the filter did not match with the entity before the event ha...
Definition flecs.h:797
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:787
bool is_multi
If true, the observer triggers on more than one term.
Definition flecs.h:801
Used with ecs_query_init.
Definition flecs.h:1001
ecs_order_by_action_t order_by
Callback used for ordering query results.
Definition flecs.h:1013
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:1060
ecs_id_t group_by_id
Id to be used by group_by.
Definition flecs.h:1022
ecs_group_by_action_t group_by
Callback used for grouping results.
Definition flecs.h:1029
void * ctx
User context to pass to callback.
Definition flecs.h:1054
ecs_ctx_free_t group_by_ctx_free
Function to free group_by_ctx.
Definition flecs.h:1043
void * group_by_ctx
Context to pass to group_by.
Definition flecs.h:1040
void * binding_ctx
Context to be used for language bindings.
Definition flecs.h:1057
ecs_group_create_action_t on_group_create
Callback that is invoked when a new group is created.
Definition flecs.h:1033
ecs_query_t * parent
If set, the query will be created as a subquery.
Definition flecs.h:1051
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:1063
ecs_entity_t order_by_component
Component to be used by order_by.
Definition flecs.h:1008
ecs_filter_desc_t filter
Filter for the query.
Definition flecs.h:1005
ecs_group_delete_action_t on_group_delete
Callback that is invoked when an existing group is deleted.
Definition flecs.h:1037
ecs_sort_table_action_t sort_table
Callback used for ordering query results.
Definition flecs.h:1017
Type that contains information about a query group.
Definition flecs.h:1248
int32_t table_count
Number of tables in group.
Definition flecs.h:1250
void * ctx
Group context, returned by on_group_create.
Definition flecs.h:1251
int32_t match_count
How often tables have been matched/unmatched.
Definition flecs.h:1249
Type that describes a single identifier in a term.
Definition flecs.h:699
ecs_flags32_t flags
Term flags.
Definition flecs.h:716
ecs_entity_t trav
Relationship to traverse when looking for the component.
Definition flecs.h:712
const char * name
Name.
Definition flecs.h:706
ecs_entity_t id
Entity id.
Definition flecs.h:700
Type that describes a term (single element in a query)
Definition flecs.h:720
ecs_term_id_t second
Second element of pair.
Definition flecs.h:728
ecs_id_t id
Component id to be matched by term.
Definition flecs.h:721
char * name
Name of term.
Definition flecs.h:734
ecs_term_id_t src
Source of term.
Definition flecs.h:726
ecs_id_record_t * idr
Cached pointer to internal index.
Definition flecs.h:737
ecs_term_id_t first
Component or first element of pair.
Definition flecs.h:727
int32_t field_index
Index of field for term in iterator.
Definition flecs.h:736
ecs_id_t id_flags
Id flags of term id.
Definition flecs.h:733
bool move
Used by internals.
Definition flecs.h:741
ecs_flags16_t flags
Flags that help eval, set by ecs_filter_init.
Definition flecs.h:739
ecs_inout_kind_t inout
Access to contents matched by term.
Definition flecs.h:730
ecs_oper_kind_t oper
Operator of term.
Definition flecs.h:731
Type that contains component lifecycle callbacks.
Definition flecs.h:813
ecs_copy_t copy_ctor
Ctor + copy.
Definition flecs.h:820
void * ctx
User defined context.
Definition flecs.h:851
ecs_iter_action_t on_remove
Callback that is invoked when an instance of the component is removed.
Definition flecs.h:849
void * binding_ctx
Language binding context.
Definition flecs.h:852
ecs_move_t move_dtor
Move + dtor.
Definition flecs.h:835
ecs_copy_t copy
copy assignment
Definition flecs.h:816
ecs_iter_action_t on_set
Callback that is invoked when an instance of the component is set.
Definition flecs.h:844
ecs_move_t move
move assignment
Definition flecs.h:817
ecs_xtor_t ctor
ctor
Definition flecs.h:814
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:854
ecs_iter_action_t on_add
Callback that is invoked when an instance of a component is added.
Definition flecs.h:839
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:855
ecs_move_t move_ctor
Ctor + move.
Definition flecs.h:823
ecs_move_t ctor_move_dtor
Ctor + move + dtor (or move_ctor + dtor).
Definition flecs.h:829
ecs_xtor_t dtor
dtor
Definition flecs.h:815
Type that contains component information (passed to ctors/dtors/...)
Definition flecs.h:862
ecs_size_t alignment
Alignment of type.
Definition flecs.h:864
ecs_size_t size
Size of type.
Definition flecs.h:863
const char * name
Type name.
Definition flecs.h:867
ecs_entity_t component
Handle to component (do not set)
Definition flecs.h:866
ecs_type_hooks_t hooks
Type hooks.
Definition flecs.h:865
A type is a list of (component) ids.
Definition flecs.h:305
Type that contains information about the world.
Definition flecs.h:1184
int64_t get_mut_count
get_mut/emplace commands processed
Definition flecs.h:1233
float delta_time
Time passed to or computed by ecs_progress.
Definition flecs.h:1190
int32_t id_count
Number of ids in the world (excluding wildcards)
Definition flecs.h:1213
ecs_entity_t min_id
First allowed entity id.
Definition flecs.h:1186
int32_t trivial_table_count
Number of tables with trivial components (no lifecycle callbacks)
Definition flecs.h:1221
int64_t set_count
set commands processed
Definition flecs.h:1232
float world_time_total
Time elapsed in simulation.
Definition flecs.h:1197
int32_t tag_id_count
Number of tag (no data) ids in the world.
Definition flecs.h:1214
int32_t tag_table_count
Number of tag-only tables.
Definition flecs.h:1220
int32_t component_id_count
Number of component (data) ids in the world.
Definition flecs.h:1215
int32_t table_record_count
Total number of table records (entries in table caches)
Definition flecs.h:1223
int64_t pipeline_build_count_total
Total number of pipeline builds.
Definition flecs.h:1209
int32_t table_count
Number of tables.
Definition flecs.h:1219
float delta_time_raw
Raw delta time (no time scaling)
Definition flecs.h:1189
float frame_time_total
Total time spent processing a frame.
Definition flecs.h:1193
float world_time_total_raw
Time elapsed in simulation (no scaling)
Definition flecs.h:1198
int64_t table_create_total
Total number of times a table was created.
Definition flecs.h:1207
int64_t observers_ran_frame
Total number of times observer was invoked.
Definition flecs.h:1211
float system_time_total
Total time spent in systems.
Definition flecs.h:1194
int64_t id_delete_total
Total number of times an id was deleted.
Definition flecs.h:1206
int64_t systems_ran_frame
Total number of systems ran in last frame.
Definition flecs.h:1210
float merge_time_total
Total time spent in merges.
Definition flecs.h:1196
int64_t discard_count
commands discarded, happens when entity is no longer alive when running the command
Definition flecs.h:1236
int64_t clear_count
clear commands processed
Definition flecs.h:1231
ecs_entity_t last_component_id
Last issued component entity id.
Definition flecs.h:1185
int32_t empty_table_count
Number of tables without entities.
Definition flecs.h:1222
int64_t frame_count_total
Total number of frames.
Definition flecs.h:1201
ecs_entity_t max_id
Last allowed entity id.
Definition flecs.h:1187
int64_t merge_count_total
Total number of merges.
Definition flecs.h:1202
int64_t other_count
other commands processed
Definition flecs.h:1235
int64_t batched_command_count
commands batched
Definition flecs.h:1238
int64_t table_delete_total
Total number of times a table was deleted.
Definition flecs.h:1208
int64_t delete_count
delete commands processed
Definition flecs.h:1230
int64_t rematch_count_total
Total number of rematches.
Definition flecs.h:1203
int64_t id_create_total
Total number of times a new id was created.
Definition flecs.h:1205
int64_t batched_entity_count
entities for which commands were batched
Definition flecs.h:1237
float time_scale
Time scale applied to delta_time.
Definition flecs.h:1191
int32_t pair_id_count
Number of pair ids in the world.
Definition flecs.h:1216
float rematch_time_total
Time spent on query rematching.
Definition flecs.h:1199
float target_fps
Target fps.
Definition flecs.h:1192
int32_t wildcard_id_count
Number of wildcard ids.
Definition flecs.h:1217
int32_t table_storage_count
Total number of table storages.
Definition flecs.h:1224
float emit_time_total
Total time spent notifying observers.
Definition flecs.h:1195
int64_t modified_count
modified commands processed
Definition flecs.h:1234
const char * name_prefix
Value set by ecs_set_name_prefix.
Definition flecs.h:1241
int64_t add_count
add commands processed
Definition flecs.h:1228
int64_t remove_count
remove commands processed
Definition flecs.h:1229
flecs::term term() const
Create a term for a (component) type.