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#define FLECS_DEBUG /* If sanitized mode is enabled, so is debug mode */
88#endif
89
90/* Tip: if you see weird behavior that you think might be a bug, make sure to
91 * test with the FLECS_DEBUG or FLECS_SANITIZE flags enabled. There's a good
92 * chance that this gives you more information about the issue! */
93
107// #define FLECS_SOFT_ASSERT
108
114// #define FLECS_KEEP_ASSERT
115
139// #define FLECS_CUSTOM_BUILD
140
141#ifndef FLECS_CUSTOM_BUILD
142// #define FLECS_C /**< C API convenience macros, always enabled */
143#define FLECS_CPP
144#define FLECS_MODULE
145#define FLECS_PARSER
146#define FLECS_PLECS
147#define FLECS_RULES
148#define FLECS_SNAPSHOT
149#define FLECS_STATS
150#define FLECS_MONITOR
151#define FLECS_METRICS
152#define FLECS_ALERTS
153#define FLECS_SYSTEM
154#define FLECS_PIPELINE
155#define FLECS_TIMER
156#define FLECS_META
157#define FLECS_META_C
158#define FLECS_UNITS
159#define FLECS_EXPR
160#define FLECS_JSON
161#define FLECS_DOC
162#define FLECS_COREDOC
163#define FLECS_LOG
164#define FLECS_APP
165#define FLECS_OS_API_IMPL
166#define FLECS_HTTP
167#define FLECS_REST
168// #define FLECS_JOURNAL /**< Journaling addon (disabled by default) */
169#endif // ifndef FLECS_CUSTOM_BUILD
170
174// #define FLECS_LOW_FOOTPRINT
175#ifdef FLECS_LOW_FOOTPRINT
176#define FLECS_HI_COMPONENT_ID (16)
177#define FLECS_HI_ID_RECORD_ID (16)
178#define FLECS_SPARSE_PAGE_BITS (6)
179#define FLECS_ENTITY_PAGE_BITS (6)
180#define FLECS_USE_OS_ALLOC
181#endif
182
193#ifndef FLECS_HI_COMPONENT_ID
194#define FLECS_HI_COMPONENT_ID (256)
195#endif
196
203#ifndef FLECS_HI_ID_RECORD_ID
204#define FLECS_HI_ID_RECORD_ID (1024)
205#endif
206
212#ifndef FLECS_SPARSE_PAGE_BITS
213#define FLECS_SPARSE_PAGE_BITS (12)
214#endif
215
218#ifndef FLECS_ENTITY_PAGE_BITS
219#define FLECS_ENTITY_PAGE_BITS (12)
220#endif
221
226// #define FLECS_USE_OS_ALLOC
227
230#ifndef FLECS_ID_DESC_MAX
231#define FLECS_ID_DESC_MAX (32)
232#endif
233
236#define FLECS_TERM_DESC_MAX (16)
237
240#define FLECS_EVENT_DESC_MAX (8)
241
244#define FLECS_VARIABLE_COUNT_MAX (64)
245
248#define FLECS_QUERY_SCOPE_NESTING_MAX (8)
249
252#include "flecs/private/api_defines.h"
253#include "flecs/private/vec.h" /* Vector datatype */
254#include "flecs/private/sparse.h" /* Sparse set */
255#include "flecs/private/block_allocator.h" /* Block allocator */
256#include "flecs/private/map.h" /* Map */
257#include "flecs/private/allocator.h" /* Allocator */
258#include "flecs/private/strbuf.h" /* String builder */
259#include "flecs/os_api.h" /* Abstraction for operating system functions */
260
261#ifdef __cplusplus
262extern "C" {
263#endif
264
279typedef uint64_t ecs_id_t;
280
287
303typedef struct {
304 ecs_id_t *array;
305 int32_t count;
306} ecs_type_t;
307
331
334
336typedef struct ecs_term_t ecs_term_t;
337
343
363
383typedef struct ecs_rule_t ecs_rule_t;
384
402
407
408/* Type used for iterating iterable objects.
409 * Iterators are a common interface across iterable objects (world, filters,
410 * rules, queries, systems, observers) to provide applications with information
411 * about the currently iterated result, and to store any state required for the
412 * iteration. */
413typedef struct ecs_iter_t ecs_iter_t;
414
423typedef struct ecs_ref_t ecs_ref_t;
424
429
434
437
440
443
466typedef void ecs_poly_t;
467
470
472typedef struct ecs_header_t {
473 int32_t magic; /* Magic number verifying it's a flecs object */
474 int32_t type; /* Magic number indicating which type of flecs object */
475 ecs_mixins_t *mixins; /* Table with offsets to (optional) mixins */
477
495typedef void (*ecs_run_action_t)(
496 ecs_iter_t *it);
497
504typedef void (*ecs_iter_action_t)(
505 ecs_iter_t *it);
506
519 const ecs_world_t *world,
520 const ecs_poly_t *iterable,
521 ecs_iter_t *it,
522 ecs_term_t *filter);
523
532 ecs_iter_t *it);
533
540 ecs_iter_t *it);
541
544 ecs_entity_t e1,
545 const void *ptr1,
546 ecs_entity_t e2,
547 const void *ptr2);
548
551 ecs_world_t* world,
552 ecs_table_t* table,
553 ecs_entity_t* entities,
554 void* ptr,
555 int32_t size,
556 int32_t lo,
557 int32_t hi,
558 ecs_order_by_action_t order_by);
559
561typedef uint64_t (*ecs_group_by_action_t)(
562 ecs_world_t *world,
563 ecs_table_t *table,
564 ecs_id_t group_id,
565 void *ctx);
566
567/* Callback invoked when a query creates a new group. */
568typedef void* (*ecs_group_create_action_t)(
569 ecs_world_t *world,
570 uint64_t group_id,
571 void *group_by_ctx); /* from ecs_query_desc_t */
572
573/* Callback invoked when a query deletes an existing group. */
574typedef void (*ecs_group_delete_action_t)(
575 ecs_world_t *world,
576 uint64_t group_id,
577 void *group_ctx, /* return value from ecs_group_create_action_t */
578 void *group_by_ctx); /* from ecs_query_desc_t */
579
581typedef void (*ecs_module_action_t)(
582 ecs_world_t *world);
583
585typedef void (*ecs_fini_action_t)(
586 ecs_world_t *world,
587 void *ctx);
588
590typedef void (*ecs_ctx_free_t)(
591 void *ctx);
592
594typedef int (*ecs_compare_action_t)(
595 const void *ptr1,
596 const void *ptr2);
597
599typedef uint64_t (*ecs_hash_value_action_t)(
600 const void *ptr);
601
603typedef void (*ecs_xtor_t)(
604 void *ptr,
605 int32_t count,
606 const ecs_type_info_t *type_info);
607
609typedef void (*ecs_copy_t)(
610 void *dst_ptr,
611 const void *src_ptr,
612 int32_t count,
613 const ecs_type_info_t *type_info);
614
616typedef void (*ecs_move_t)(
617 void *dst_ptr,
618 void *src_ptr,
619 int32_t count,
620 const ecs_type_info_t *type_info);
621
622/* Destructor function for poly objects */
623typedef void (*ecs_poly_dtor_t)(
624 ecs_poly_t *poly);
625
636typedef struct ecs_iterable_t {
639
649typedef enum ecs_inout_kind_t {
656
658typedef enum ecs_oper_kind_t {
667
668/* Term id flags */
669#define EcsSelf (1u << 1)
670#define EcsUp (1u << 2)
671#define EcsDown (1u << 3)
672#define EcsTraverseAll (1u << 4)
673#define EcsCascade (1u << 5)
674#define EcsParent (1u << 6)
675#define EcsIsVariable (1u << 7)
676#define EcsIsEntity (1u << 8)
677#define EcsIsName (1u << 9)
678#define EcsFilter (1u << 10)
679#define EcsTraverseFlags (EcsUp|EcsDown|EcsTraverseAll|EcsSelf|EcsCascade|EcsParent)
680
681/* Term flags discovered & set during filter creation. Mostly used internally to
682 * store information relevant to queries. */
683#define EcsTermMatchAny (1u << 0)
684#define EcsTermMatchAnySrc (1u << 1)
685#define EcsTermSrcFirstEq (1u << 2)
686#define EcsTermSrcSecondEq (1u << 3)
687#define EcsTermTransitive (1u << 4)
688#define EcsTermReflexive (1u << 5)
689#define EcsTermIdInherited (1u << 6)
690
691/* Term flags used for term iteration */
692#define EcsTermMatchDisabled (1u << 7)
693#define EcsTermMatchPrefab (1u << 8)
694
696typedef struct ecs_term_id_t {
703 const char *name;
713 ecs_flags32_t flags;
715
731 char *name;
733 int32_t field_index;
736 ecs_flags16_t flags;
738 bool move;
739};
740
742FLECS_API extern ecs_filter_t ECS_FILTER_INIT;
743
746 ecs_header_t hdr;
747
749 int32_t term_count;
750 int32_t field_count;
752 bool owned;
755 ecs_flags32_t flags;
757 char *variable_names[1];
758 int32_t *sizes;
760 /* Mixins */
763 ecs_poly_dtor_t dtor;
765};
766
767/* An observer reacts to events matching a filter */
769 ecs_header_t hdr;
770
773 /* Observer events */
775 int32_t event_count;
776
780 void *ctx;
788 int32_t *last_event_id;
789 int32_t last_event_id_storage;
790
792 int32_t term_index;
798 bool is_multi;
800 /* Mixins */
801 ecs_poly_dtor_t dtor;
802};
803
818
821
827
833
837
842
847
848 void *ctx;
853};
854
860 ecs_size_t size;
861 ecs_size_t alignment;
864 const char *name;
865};
866
867#include "flecs/private/api_types.h" /* Supporting API types */
868#include "flecs/private/api_support.h" /* Supporting API functions */
869#include "flecs/private/vec.h" /* Vector */
870#include "flecs/private/hashmap.h" /* Hashmap */
871
876typedef struct ecs_entity_desc_t {
877 int32_t _canary;
878
881 const char *name;
886 const char *sep;
890 const char *root_sep;
892 const char *symbol;
908
910 const char *add_expr;
912
917typedef struct ecs_bulk_desc_t {
918 int32_t _canary;
919
925 int32_t count;
929 void **data;
942
947typedef struct ecs_component_desc_t {
948 int32_t _canary;
949
952
956
961typedef struct ecs_filter_desc_t {
962 int32_t _canary;
963
967
970
973
976
983
985 ecs_flags32_t flags;
986
988 const char *expr;
989
993
998typedef struct ecs_query_desc_t {
999 int32_t _canary;
1000
1003
1006
1011
1015
1020
1027
1030 ecs_group_create_action_t on_group_create;
1031
1034 ecs_group_delete_action_t on_group_delete;
1035
1038
1041
1049
1051 void *ctx;
1052
1055
1058
1062
1067typedef struct ecs_observer_desc_t {
1068 int32_t _canary;
1069
1072
1075
1078
1083
1086
1094
1096 void *ctx;
1097
1100
1103
1106
1109
1113
1115 int32_t term_index;
1117
1122typedef struct ecs_event_desc_t {
1125
1130
1133
1137
1139 int32_t offset;
1140
1144 int32_t count;
1145
1148
1150 const void *param;
1151
1154
1156 ecs_flags32_t flags;
1158
1159
1166/* Utility to hold a value of a dynamic type */
1167typedef struct ecs_value_t {
1168 ecs_entity_t type;
1169 void *ptr;
1170} ecs_value_t;
1171
1173typedef struct ecs_world_info_t {
1202 int32_t id_count;
1208 int32_t table_count;
1215 /* -- Command counts -- */
1216 struct {
1217 int64_t add_count;
1220 int64_t clear_count;
1221 int64_t set_count;
1224 int64_t other_count;
1228 } cmd;
1229
1230 const char *name_prefix;
1235
1238 int32_t match_count;
1239 int32_t table_count;
1240 void *ctx;
1242
1252typedef struct EcsIdentifier {
1253 char *value;
1254 ecs_size_t length;
1255 uint64_t hash;
1256 uint64_t index_hash;
1257 ecs_hashmap_t *index;
1259
1261typedef struct EcsComponent {
1262 ecs_size_t size;
1263 ecs_size_t alignment;
1265
1267typedef struct EcsPoly {
1270
1272typedef struct EcsTarget {
1273 int32_t count;
1274 ecs_record_t *target;
1276
1279
1283/* Only include deprecated definitions if deprecated addon is required */
1284#ifdef FLECS_DEPRECATED
1286#endif
1287
1301FLECS_API extern const ecs_id_t ECS_PAIR;
1302
1304FLECS_API extern const ecs_id_t ECS_OVERRIDE;
1305
1307FLECS_API extern const ecs_id_t ECS_TOGGLE;
1308
1310FLECS_API extern const ecs_id_t ECS_AND;
1311
1319/* Builtin component ids */
1320FLECS_API extern const ecs_entity_t ecs_id(EcsComponent);
1321FLECS_API extern const ecs_entity_t ecs_id(EcsIdentifier);
1322FLECS_API extern const ecs_entity_t ecs_id(EcsIterable);
1323FLECS_API extern const ecs_entity_t ecs_id(EcsPoly);
1324
1325FLECS_API extern const ecs_entity_t EcsQuery;
1326FLECS_API extern const ecs_entity_t EcsObserver;
1327
1328/* System module component ids */
1329FLECS_API extern const ecs_entity_t EcsSystem;
1330FLECS_API extern const ecs_entity_t ecs_id(EcsTickSource);
1331
1332/* Pipeline module component ids */
1333FLECS_API extern const ecs_entity_t ecs_id(EcsPipelineQuery);
1334
1335/* Timer module component ids */
1336FLECS_API extern const ecs_entity_t ecs_id(EcsTimer);
1337FLECS_API extern const ecs_entity_t ecs_id(EcsRateFilter);
1338
1340FLECS_API extern const ecs_entity_t EcsFlecs;
1341
1343FLECS_API extern const ecs_entity_t EcsFlecsCore;
1344
1346FLECS_API extern const ecs_entity_t EcsWorld;
1347
1349FLECS_API extern const ecs_entity_t EcsWildcard;
1350
1352FLECS_API extern const ecs_entity_t EcsAny;
1353
1355FLECS_API extern const ecs_entity_t EcsThis;
1356
1358FLECS_API extern const ecs_entity_t EcsVariable;
1359
1364FLECS_API extern const ecs_entity_t EcsTransitive;
1365
1370FLECS_API extern const ecs_entity_t EcsReflexive;
1371
1379FLECS_API extern const ecs_entity_t EcsFinal;
1380
1386FLECS_API extern const ecs_entity_t EcsDontInherit;
1387
1393FLECS_API extern const ecs_entity_t EcsAlwaysOverride;
1394
1399FLECS_API extern const ecs_entity_t EcsSymmetric;
1400
1407FLECS_API extern const ecs_entity_t EcsExclusive;
1408
1410FLECS_API extern const ecs_entity_t EcsAcyclic;
1411
1414FLECS_API extern const ecs_entity_t EcsTraversable;
1415
1422FLECS_API extern const ecs_entity_t EcsWith;
1423
1430FLECS_API extern const ecs_entity_t EcsOneOf;
1431
1434FLECS_API extern const ecs_entity_t EcsTag;
1435
1439FLECS_API extern const ecs_entity_t EcsUnion;
1440
1442FLECS_API extern const ecs_entity_t EcsName;
1443
1445FLECS_API extern const ecs_entity_t EcsSymbol;
1446
1448FLECS_API extern const ecs_entity_t EcsAlias;
1449
1451FLECS_API extern const ecs_entity_t EcsChildOf;
1452
1454FLECS_API extern const ecs_entity_t EcsIsA;
1455
1457FLECS_API extern const ecs_entity_t EcsDependsOn;
1458
1460FLECS_API extern const ecs_entity_t EcsSlotOf;
1461
1463FLECS_API extern const ecs_entity_t EcsModule;
1464
1466FLECS_API extern const ecs_entity_t EcsPrivate;
1467
1470FLECS_API extern const ecs_entity_t EcsPrefab;
1471
1474FLECS_API extern const ecs_entity_t EcsDisabled;
1475
1477FLECS_API extern const ecs_entity_t EcsOnAdd;
1478
1480FLECS_API extern const ecs_entity_t EcsOnRemove;
1481
1483FLECS_API extern const ecs_entity_t EcsOnSet;
1484
1486FLECS_API extern const ecs_entity_t EcsUnSet;
1487
1489FLECS_API extern const ecs_entity_t EcsMonitor;
1490
1492FLECS_API extern const ecs_entity_t EcsOnTableCreate;
1493
1495FLECS_API extern const ecs_entity_t EcsOnTableDelete;
1496
1498FLECS_API extern const ecs_entity_t EcsOnTableEmpty;
1499
1501FLECS_API extern const ecs_entity_t EcsOnTableFill;
1502
1504FLECS_API extern const ecs_entity_t EcsOnDelete;
1505
1508FLECS_API extern const ecs_entity_t EcsOnDeleteTarget;
1509
1512FLECS_API extern const ecs_entity_t EcsRemove;
1513
1516FLECS_API extern const ecs_entity_t EcsDelete;
1517
1520FLECS_API extern const ecs_entity_t EcsPanic;
1521
1523FLECS_API extern const ecs_entity_t ecs_id(EcsTarget);
1524
1527FLECS_API extern const ecs_entity_t EcsFlatten;
1528
1534FLECS_API extern const ecs_entity_t EcsDefaultChildComponent;
1535
1536/* Builtin predicates for comparing entity ids in queries. Only supported by rules */
1537FLECS_API extern const ecs_entity_t EcsPredEq;
1538FLECS_API extern const ecs_entity_t EcsPredMatch;
1539FLECS_API extern const ecs_entity_t EcsPredLookup;
1540
1541/* Builtin marker entities for opening/closing query scopes */
1542FLECS_API extern const ecs_entity_t EcsScopeOpen;
1543FLECS_API extern const ecs_entity_t EcsScopeClose;
1544
1546FLECS_API extern const ecs_entity_t EcsEmpty;
1547
1548/* Pipeline module tags */
1549FLECS_API extern const ecs_entity_t ecs_id(EcsPipeline);
1550FLECS_API extern const ecs_entity_t EcsOnStart;
1551FLECS_API extern const ecs_entity_t EcsPreFrame;
1552FLECS_API extern const ecs_entity_t EcsOnLoad;
1553FLECS_API extern const ecs_entity_t EcsPostLoad;
1554FLECS_API extern const ecs_entity_t EcsPreUpdate;
1555FLECS_API extern const ecs_entity_t EcsOnUpdate;
1556FLECS_API extern const ecs_entity_t EcsOnValidate;
1557FLECS_API extern const ecs_entity_t EcsPostUpdate;
1558FLECS_API extern const ecs_entity_t EcsPreStore;
1559FLECS_API extern const ecs_entity_t EcsOnStore;
1560FLECS_API extern const ecs_entity_t EcsPostFrame;
1561FLECS_API extern const ecs_entity_t EcsPhase;
1562
1565#define EcsLastInternalComponentId (ecs_id(EcsPoly))
1566
1569#define EcsFirstUserComponentId (8)
1570
1573#define EcsFirstUserEntityId (FLECS_HI_COMPONENT_ID + 128)
1574
1575/* When visualized the reserved id ranges look like this:
1576 * [1..8]: Builtin components
1577 * [9..FLECS_HI_COMPONENT_ID]: Low ids reserved for application components
1578 * [FLECS_HI_COMPONENT_ID + 1..EcsFirstUserEntityId]: Builtin entities
1579 */
1580
1601FLECS_API
1603
1610FLECS_API
1612
1620FLECS_API
1622 int argc,
1623 char *argv[]);
1624
1631FLECS_API
1633 ecs_world_t *world);
1634
1642FLECS_API
1644 const ecs_world_t *world);
1645
1653FLECS_API
1655 ecs_world_t *world,
1656 ecs_fini_action_t action,
1657 void *ctx);
1658
1684FLECS_API
1686 ecs_world_t *world,
1687 ecs_ftime_t delta_time);
1688
1695FLECS_API
1697 ecs_world_t *world);
1698
1706FLECS_API
1708 ecs_world_t *world,
1709 ecs_fini_action_t action,
1710 void *ctx);
1711
1718FLECS_API
1720 ecs_world_t *world);
1721
1726FLECS_API
1728 const ecs_world_t *world);
1729
1742 ecs_world_t *world,
1743 bool enable);
1744
1756 ecs_world_t *world,
1757 bool enable);
1758
1774FLECS_API
1776 ecs_world_t *world,
1777 ecs_ftime_t fps);
1778
1815FLECS_API
1817 ecs_world_t *world);
1818
1826FLECS_API
1828 ecs_world_t *world);
1829
1840FLECS_API
1842 ecs_world_t *world);
1843
1853FLECS_API
1855 ecs_world_t *world);
1856
1862FLECS_API
1864 const ecs_world_t *world);
1865
1874FLECS_API
1876 ecs_world_t *world);
1877
1887FLECS_API
1889 ecs_world_t *world);
1890
1896FLECS_API
1898 ecs_world_t *world);
1899
1916FLECS_API
1918 ecs_world_t *world,
1919 bool automerge);
1920
1934FLECS_API
1936 ecs_world_t *world,
1937 int32_t stages);
1938
1945FLECS_API
1947 const ecs_world_t *world);
1948
1956FLECS_API
1958 const ecs_world_t *world);
1959
1975FLECS_API
1977 const ecs_world_t *world,
1978 int32_t stage_id);
1979
1987FLECS_API
1989 const ecs_world_t *world);
1990
2009FLECS_API
2011 ecs_world_t *world);
2012
2019FLECS_API
2021 ecs_world_t *stage);
2022
2029FLECS_API
2031 ecs_world_t *stage);
2032
2048FLECS_API
2050 ecs_world_t *world,
2051 void *ctx,
2052 ecs_ctx_free_t ctx_free);
2053
2062FLECS_API
2064 ecs_world_t *world,
2065 void *ctx,
2066 ecs_ctx_free_t ctx_free);
2067
2075FLECS_API
2077 const ecs_world_t *world);
2078
2086FLECS_API
2088 const ecs_world_t *world);
2089
2095FLECS_API
2097 const ecs_world_t *world);
2098
2107FLECS_API
2109 ecs_world_t *world,
2110 int32_t entity_count);
2111
2127FLECS_API
2129 ecs_world_t *world,
2130 ecs_entity_t id_start,
2131 ecs_entity_t id_end);
2132
2143FLECS_API
2145 ecs_world_t *world,
2146 bool enable);
2147
2152FLECS_API
2154 const ecs_world_t *world);
2155
2169FLECS_API
2171 ecs_world_t *world,
2172 ecs_flags32_t flags);
2173
2207FLECS_API
2209 ecs_world_t *world,
2210 ecs_id_t id,
2211 uint16_t clear_generation,
2212 uint16_t delete_generation,
2213 int32_t min_id_count,
2214 double time_budget_seconds);
2215
2221FLECS_API
2223 const ecs_poly_t *poly);
2224
2230FLECS_API
2232 const ecs_poly_t *poly);
2233
2244FLECS_API
2246 const ecs_poly_t *object,
2247 int32_t type);
2248
2249#define ecs_poly_is(object, type)\
2250 ecs_poly_is_(object, type##_magic)
2251
2259FLECS_API
2261 ecs_entity_t first,
2262 ecs_entity_t second);
2263
2288FLECS_API
2290 ecs_world_t *world);
2291
2309FLECS_API
2311 ecs_world_t *world);
2312
2321FLECS_API
2323 ecs_world_t *world,
2324 ecs_id_t id);
2325
2333FLECS_API
2335 ecs_world_t *world,
2336 ecs_table_t *table);
2337
2356FLECS_API
2358 ecs_world_t *world,
2359 const ecs_entity_desc_t *desc);
2360
2387FLECS_API
2389 ecs_world_t *world,
2390 const ecs_bulk_desc_t *desc);
2391
2401FLECS_API
2403 ecs_world_t *world,
2404 ecs_id_t id,
2405 int32_t count);
2406
2418FLECS_API
2420 ecs_world_t *world,
2421 ecs_entity_t dst,
2422 ecs_entity_t src,
2423 bool copy_value);
2424
2433FLECS_API
2435 ecs_world_t *world,
2436 ecs_entity_t entity);
2437
2445FLECS_API
2447 ecs_world_t *world,
2448 ecs_id_t id);
2449
2466FLECS_API
2468 ecs_world_t *world,
2469 ecs_entity_t entity,
2470 ecs_id_t id);
2471
2480FLECS_API
2482 ecs_world_t *world,
2483 ecs_entity_t entity,
2484 ecs_id_t id);
2485
2508FLECS_API
2510 ecs_world_t *world,
2511 ecs_entity_t entity,
2512 ecs_id_t id);
2513
2520FLECS_API
2522 ecs_world_t *world,
2523 ecs_entity_t entity);
2524
2532FLECS_API
2534 ecs_world_t *world,
2535 ecs_id_t id);
2536
2544FLECS_API
2546 ecs_world_t *world,
2547 ecs_id_t id);
2548
2555FLECS_API
2557 const ecs_world_t *world);
2558
2576FLECS_API
2578 ecs_world_t *world,
2579 ecs_entity_t entity,
2580 bool enabled);
2581
2595FLECS_API
2597 ecs_world_t *world,
2598 ecs_entity_t entity,
2599 ecs_id_t id,
2600 bool enable);
2601
2612FLECS_API
2614 const ecs_world_t *world,
2615 ecs_entity_t entity,
2616 ecs_id_t id);
2617
2635FLECS_API
2636const void* ecs_get_id(
2637 const ecs_world_t *world,
2638 ecs_entity_t entity,
2639 ecs_id_t id);
2640
2651FLECS_API
2653 const ecs_world_t *world,
2654 ecs_entity_t entity,
2655 ecs_id_t id);
2656
2665FLECS_API
2667 const ecs_world_t *world,
2668 ecs_ref_t *ref,
2669 ecs_id_t id);
2670
2678FLECS_API
2680 const ecs_world_t *world,
2681 ecs_ref_t *ref);
2682
2697FLECS_API
2699 ecs_world_t *world,
2700 ecs_entity_t entity,
2701 ecs_id_t id);
2702
2714FLECS_API
2716 ecs_world_t *world,
2717 ecs_entity_t entity,
2718 ecs_id_t id);
2719
2738FLECS_API
2740 ecs_world_t *world,
2741 ecs_entity_t entity);
2742
2749FLECS_API
2751 ecs_record_t *record);
2752
2772FLECS_API
2774 ecs_world_t *world,
2775 ecs_entity_t entity);
2776
2782FLECS_API
2784 const ecs_record_t *record);
2785
2791FLECS_API
2793 const ecs_record_t *record);
2794
2808FLECS_API
2810 ecs_world_t *world,
2811 const ecs_record_t *record,
2812 ecs_id_t id);
2813
2822FLECS_API
2824 ecs_world_t *world,
2825 ecs_record_t *record,
2826 ecs_id_t id);
2827
2834FLECS_API
2836 ecs_world_t *world,
2837 const ecs_record_t *record,
2838 ecs_id_t id);
2839
2853FLECS_API
2855 ecs_world_t *world,
2856 ecs_entity_t entity,
2857 ecs_id_t id);
2858
2868FLECS_API
2870 ecs_world_t *world,
2871 ecs_entity_t entity,
2872 ecs_id_t id);
2873
2890FLECS_API
2892 ecs_world_t *world,
2893 ecs_entity_t entity,
2894 ecs_id_t id,
2895 size_t size,
2896 const void *ptr);
2897
2924FLECS_API
2926 const ecs_world_t *world,
2927 ecs_entity_t e);
2928
2952FLECS_API
2954 const ecs_world_t *world,
2955 ecs_entity_t e);
2956
2962FLECS_API
2964 ecs_entity_t e);
2965
2977FLECS_API
2979 ecs_world_t *world,
2980 ecs_entity_t entity);
2981
2998FLECS_API
3000 const ecs_world_t *world,
3001 ecs_entity_t e);
3002
3023FLECS_API
3025 ecs_world_t *world,
3026 ecs_entity_t entity);
3027
3046FLECS_API
3048 ecs_world_t *world,
3049 ecs_id_t id);
3050
3058FLECS_API
3060 const ecs_world_t *world,
3061 ecs_entity_t entity);
3062
3077FLECS_API
3079 const ecs_world_t *world,
3080 ecs_entity_t entity);
3081
3088FLECS_API
3090 const ecs_world_t *world,
3091 ecs_entity_t entity);
3092
3100FLECS_API
3102 const ecs_world_t *world,
3103 const ecs_type_t* type);
3104
3113FLECS_API
3115 const ecs_world_t *world,
3116 const ecs_table_t *table);
3117
3129FLECS_API
3131 const ecs_world_t *world,
3132 ecs_entity_t entity);
3133
3142FLECS_API
3144 const ecs_world_t *world,
3145 ecs_entity_t entity,
3146 ecs_id_t id);
3147
3158FLECS_API
3160 const ecs_world_t *world,
3161 ecs_entity_t entity,
3162 ecs_id_t id);
3163
3178FLECS_API
3180 const ecs_world_t *world,
3181 ecs_entity_t entity,
3182 ecs_entity_t rel,
3183 int32_t index);
3184
3193FLECS_API
3195 const ecs_world_t *world,
3196 ecs_entity_t entity);
3197
3216FLECS_API
3218 const ecs_world_t *world,
3219 ecs_entity_t entity,
3220 ecs_entity_t rel,
3221 ecs_id_t id);
3222
3233FLECS_API
3235 const ecs_world_t *world,
3236 ecs_entity_t entity,
3237 ecs_entity_t rel);
3238
3239typedef struct ecs_flatten_desc_t {
3240 /* When true, the flatten operation will not remove names from entities in
3241 * the flattened tree. This may fail if entities from different subtrees
3242 * have the same name. */
3243 bool keep_names;
3244
3245 /* When true, the flattened tree won't contain information about the
3246 * original depth of the entities. This can reduce fragmentation, but may
3247 * cause existing code, such as cascade queries, to no longer work. */
3248 bool lose_depth;
3250
3275FLECS_API
3277 ecs_world_t *world,
3278 ecs_id_t pair,
3279 const ecs_flatten_desc_t *desc);
3280
3288FLECS_API
3290 const ecs_world_t *world,
3291 ecs_id_t entity);
3292
3309FLECS_API
3310const char* ecs_get_name(
3311 const ecs_world_t *world,
3312 ecs_entity_t entity);
3313
3321FLECS_API
3322const char* ecs_get_symbol(
3323 const ecs_world_t *world,
3324 ecs_entity_t entity);
3325
3337FLECS_API
3339 ecs_world_t *world,
3340 ecs_entity_t entity,
3341 const char *name);
3342
3354FLECS_API
3356 ecs_world_t *world,
3357 ecs_entity_t entity,
3358 const char *symbol);
3359
3371FLECS_API
3373 ecs_world_t *world,
3374 ecs_entity_t entity,
3375 const char *alias);
3376
3385FLECS_API
3387 const ecs_world_t *world,
3388 const char *name);
3389
3399FLECS_API
3401 const ecs_world_t *world,
3402 ecs_entity_t parent,
3403 const char *name);
3404
3423FLECS_API
3425 const ecs_world_t *world,
3426 ecs_entity_t parent,
3427 const char *path,
3428 const char *sep,
3429 const char *prefix,
3430 bool recursive);
3431
3445FLECS_API
3447 const ecs_world_t *world,
3448 const char *symbol,
3449 bool lookup_as_path,
3450 bool recursive);
3451
3471FLECS_API
3473 const ecs_world_t *world,
3474 ecs_entity_t parent,
3475 ecs_entity_t child,
3476 const char *sep,
3477 const char *prefix);
3478
3490 const ecs_world_t *world,
3491 ecs_entity_t parent,
3492 ecs_entity_t child,
3493 const char *sep,
3494 const char *prefix,
3495 ecs_strbuf_t *buf);
3496
3512FLECS_API
3514 ecs_world_t *world,
3515 ecs_entity_t parent,
3516 const char *path,
3517 const char *sep,
3518 const char *prefix);
3519
3534FLECS_API
3536 ecs_world_t *world,
3537 ecs_entity_t entity,
3538 ecs_entity_t parent,
3539 const char *path,
3540 const char *sep,
3541 const char *prefix);
3542
3554FLECS_API
3556 ecs_world_t *world,
3557 ecs_entity_t scope);
3558
3566FLECS_API
3568 const ecs_world_t *world);
3569
3579FLECS_API
3581 ecs_world_t *world,
3582 const char *prefix);
3583
3608FLECS_API
3610 ecs_world_t *world,
3611 const ecs_entity_t *lookup_path);
3612
3619FLECS_API
3621 const ecs_world_t *world);
3622
3646FLECS_API
3648 ecs_world_t *world,
3649 const ecs_component_desc_t *desc);
3650
3660FLECS_API
3662 const ecs_world_t *world,
3663 ecs_id_t id);
3664
3676FLECS_API
3678 ecs_world_t *world,
3679 ecs_entity_t id,
3680 const ecs_type_hooks_t *hooks);
3681
3688FLECS_API
3690 ecs_world_t *world,
3691 ecs_entity_t id);
3692
3715FLECS_API
3717 const ecs_world_t *world,
3718 ecs_id_t id);
3719
3732FLECS_API
3734 const ecs_world_t *world,
3735 ecs_id_t id);
3736
3745FLECS_API
3747 const ecs_world_t *world,
3748 ecs_id_t id);
3749
3769FLECS_API
3771 const ecs_world_t *world,
3772 ecs_id_t id);
3773
3781FLECS_API
3783 ecs_id_t id,
3784 ecs_id_t pattern);
3785
3791FLECS_API
3793 ecs_id_t id);
3794
3800FLECS_API
3802 ecs_id_t id);
3803
3817FLECS_API
3819 const ecs_world_t *world,
3820 ecs_id_t id);
3821
3830FLECS_API
3831ecs_flags32_t ecs_id_get_flags(
3832 const ecs_world_t *world,
3833 ecs_id_t id);
3834
3841FLECS_API
3843 ecs_id_t id_flags);
3844
3852FLECS_API
3854 const ecs_world_t *world,
3855 ecs_id_t id);
3856
3864FLECS_API
3866 const ecs_world_t *world,
3867 ecs_id_t id,
3868 ecs_strbuf_t *buf);
3869
3887FLECS_API
3888ecs_iter_t ecs_term_iter(
3889 const ecs_world_t *world,
3890 ecs_term_t *term);
3891
3900FLECS_API
3902 const ecs_iter_t *it,
3903 ecs_term_t *term);
3904
3914FLECS_API
3916 ecs_iter_t *it);
3917
3926FLECS_API
3927ecs_iter_t ecs_children(
3928 const ecs_world_t *world,
3929 ecs_entity_t parent);
3930
3937FLECS_API
3939 ecs_iter_t *it);
3940
3946FLECS_API
3948 const ecs_term_id_t *id);
3949
3961FLECS_API
3963 const ecs_term_t *term);
3964
3979FLECS_API
3981 const ecs_term_t *term);
3982
3995FLECS_API
3997 const ecs_term_t *term);
3998
4017FLECS_API
4019 const ecs_world_t *world,
4020 ecs_term_t *term);
4021
4030FLECS_API
4032 const ecs_term_t *src);
4033
4044FLECS_API
4046 ecs_term_t *src);
4047
4054FLECS_API
4056 ecs_term_t *term);
4057
4081FLECS_API
4083 ecs_world_t *world,
4084 const ecs_filter_desc_t *desc);
4085
4091FLECS_API
4093 ecs_filter_t *filter);
4094
4108FLECS_API
4110 const ecs_world_t *world,
4111 ecs_filter_t *filter);
4112
4124FLECS_API
4126 const ecs_filter_t *filter);
4127
4136FLECS_API
4138 const ecs_world_t *world,
4139 const ecs_term_t *term);
4140
4149FLECS_API
4151 const ecs_world_t *world,
4152 const ecs_filter_t *filter);
4153
4162FLECS_API
4164 const ecs_world_t *world,
4165 const ecs_filter_t *filter);
4166
4175FLECS_API
4177 const ecs_iter_t *it,
4178 const ecs_filter_t *filter);
4179
4199FLECS_API
4201 const ecs_world_t *world,
4202 const ecs_filter_t *filter);
4203
4213FLECS_API
4215 ecs_iter_t *it);
4216
4223FLECS_API
4225 ecs_iter_t *it);
4226
4232FLECS_API
4234 ecs_filter_t *dst,
4235 ecs_filter_t *src);
4236
4242FLECS_API
4244 ecs_filter_t *dst,
4245 const ecs_filter_t *src);
4246
4289FLECS_API
4291 ecs_world_t *world,
4292 const ecs_query_desc_t *desc);
4293
4301FLECS_API
4304
4312FLECS_API
4314 const ecs_query_t *query);
4315
4343FLECS_API
4345 const ecs_world_t *world,
4347
4357FLECS_API
4359 ecs_iter_t *iter);
4360
4367FLECS_API
4369 ecs_iter_t *iter);
4370
4381FLECS_API
4383 ecs_iter_t *iter);
4384
4406FLECS_API
4408 ecs_iter_t *iter,
4409 bool when_changed);
4410
4440FLECS_API
4443 const ecs_iter_t *it);
4444
4455FLECS_API
4457 ecs_iter_t *it);
4458
4481FLECS_API
4483 ecs_iter_t *it,
4484 uint64_t group_id);
4485
4494FLECS_API
4496 const ecs_query_t *query,
4497 uint64_t group_id);
4498
4507FLECS_API
4509 const ecs_query_t *query,
4510 uint64_t group_id);
4511
4520FLECS_API
4522 const ecs_query_t *query);
4523
4529FLECS_API
4531 const ecs_query_t *query);
4532
4538FLECS_API
4540 const ecs_query_t *query);
4541
4547FLECS_API
4549 const ecs_query_t *query);
4550
4558FLECS_API
4560 const ecs_query_t *query);
4561
4568FLECS_API
4570 const ecs_query_t *query);
4571
4578FLECS_API
4580 const ecs_query_t *query);
4581
4607FLECS_API
4609 ecs_world_t *world,
4610 ecs_event_desc_t *desc);
4611
4621FLECS_API
4623 ecs_world_t *world,
4624 const ecs_observer_desc_t *desc);
4625
4635FLECS_API
4637 ecs_iter_t *it);
4638
4646FLECS_API
4648 const ecs_world_t *world,
4650
4658FLECS_API
4660 const ecs_world_t *world,
4662
4692FLECS_API
4694 const ecs_world_t *world,
4695 const ecs_poly_t *poly,
4696 ecs_iter_t *iter,
4697 ecs_term_t *filter);
4698
4712FLECS_API
4714 ecs_iter_t *it);
4715
4725FLECS_API
4727 ecs_iter_t *it);
4728
4740FLECS_API
4742 ecs_iter_t *it);
4743
4756FLECS_API
4758 ecs_iter_t *it);
4759
4767FLECS_API
4769 ecs_iter_t *it);
4770
4804FLECS_API
4806 ecs_iter_t *it,
4807 int32_t var_id,
4808 ecs_entity_t entity);
4809
4817FLECS_API
4819 ecs_iter_t *it,
4820 int32_t var_id,
4821 const ecs_table_t *table);
4822
4830FLECS_API
4832 ecs_iter_t *it,
4833 int32_t var_id,
4834 const ecs_table_range_t *range);
4835
4848FLECS_API
4850 ecs_iter_t *it,
4851 int32_t var_id);
4852
4866FLECS_API
4868 ecs_iter_t *it,
4869 int32_t var_id);
4870
4884FLECS_API
4886 ecs_iter_t *it,
4887 int32_t var_id);
4888
4900FLECS_API
4902 ecs_iter_t *it,
4903 int32_t var_id);
4904
4916FLECS_API
4918 const ecs_iter_t *it);
4919
4935FLECS_API
4936ecs_iter_t ecs_page_iter(
4937 const ecs_iter_t *it,
4938 int32_t offset,
4939 int32_t limit);
4940
4947FLECS_API
4949 ecs_iter_t *it);
4950
4971FLECS_API
4973 const ecs_iter_t *it,
4974 int32_t index,
4975 int32_t count);
4976
4983FLECS_API
4985 ecs_iter_t *it);
4986
5010FLECS_API
5012 const ecs_iter_t *it,
5013 size_t size,
5014 int32_t index);
5015
5024FLECS_API
5026 const ecs_iter_t *it,
5027 int32_t index);
5028
5039FLECS_API
5041 const ecs_iter_t *it,
5042 int32_t index);
5043
5050FLECS_API
5052 const ecs_iter_t *it,
5053 int32_t index);
5054
5061FLECS_API
5063 const ecs_iter_t *it,
5064 int32_t index);
5065
5074FLECS_API
5076 const ecs_iter_t *it,
5077 int32_t index);
5078
5086FLECS_API
5088 const ecs_iter_t *it,
5089 int32_t index);
5090
5098FLECS_API
5100 const ecs_iter_t *it,
5101 int32_t index);
5102
5116FLECS_API
5118 const ecs_iter_t *it,
5119 int32_t index);
5120
5135FLECS_API
5137 const ecs_table_t *table);
5138
5147FLECS_API
5149 const ecs_world_t *world,
5150 const ecs_table_t *table,
5151 ecs_id_t id);
5152
5162FLECS_API
5164 const ecs_world_t *world,
5165 const ecs_table_t *table,
5166 ecs_id_t id);
5167
5175FLECS_API
5177 const ecs_table_t *table);
5178
5190FLECS_API
5192 const ecs_table_t *table,
5193 int32_t index);
5194
5203FLECS_API
5205 const ecs_table_t *table,
5206 int32_t index);
5207
5216FLECS_API
5218 const ecs_table_t *table,
5219 int32_t index,
5220 int32_t offset);
5221
5230FLECS_API
5232 const ecs_world_t *world,
5233 const ecs_table_t *table,
5234 ecs_id_t id,
5235 int32_t offset);
5236
5244FLECS_API
5246 const ecs_table_t *table,
5247 int32_t index);
5248
5257FLECS_API
5259 const ecs_table_t *table);
5260
5269FLECS_API
5271 const ecs_world_t *world,
5272 const ecs_table_t *table,
5273 ecs_id_t id);
5274
5285FLECS_API
5287 const ecs_world_t *world,
5288 const ecs_table_t *table,
5289 ecs_entity_t rel);
5290
5300FLECS_API
5302 ecs_world_t *world,
5303 ecs_table_t *table,
5304 ecs_id_t id);
5305
5316FLECS_API
5318 ecs_world_t *world,
5319 const ecs_id_t *ids,
5320 int32_t id_count);
5321
5331FLECS_API
5333 ecs_world_t *world,
5334 ecs_table_t *table,
5335 ecs_id_t id);
5336
5352FLECS_API
5354 ecs_world_t *world,
5355 ecs_table_t *table);
5356
5363FLECS_API
5365 ecs_world_t *world,
5366 ecs_table_t *table);
5367
5377FLECS_API
5379 ecs_table_t *table,
5380 ecs_flags32_t flags);
5381
5389FLECS_API
5391 ecs_world_t* world,
5392 ecs_table_t* table,
5393 int32_t row_1,
5394 int32_t row_2);
5395
5418FLECS_API
5420 ecs_world_t *world,
5421 ecs_entity_t entity,
5422 ecs_record_t *record,
5423 ecs_table_t *table,
5424 const ecs_type_t *added,
5425 const ecs_type_t *removed);
5426
5428FLECS_API
5430 const ecs_world_t *world,
5431 ecs_entity_t entity);
5432
5434FLECS_API
5436 const ecs_record_t *r,
5437 int32_t column,
5438 size_t c_size);
5439
5455FLECS_API
5457 const ecs_world_t *world,
5458 const ecs_table_t *table,
5459 ecs_id_t id,
5460 ecs_id_t *id_out);
5461
5492FLECS_API
5494 const ecs_world_t *world,
5495 const ecs_table_t *table,
5496 int32_t offset,
5497 ecs_id_t id,
5498 ecs_id_t *id_out);
5499
5536FLECS_API
5538 const ecs_world_t *world,
5539 const ecs_table_t *table,
5540 int32_t offset,
5541 ecs_id_t id,
5542 ecs_entity_t rel,
5543 ecs_flags32_t flags, /* EcsSelf and/or EcsUp */
5544 ecs_entity_t *subject_out,
5545 ecs_id_t *id_out,
5546 struct ecs_table_record_t **tr_out);
5547
5563FLECS_API
5565 const ecs_world_t *world,
5566 ecs_entity_t type,
5567 void *ptr);
5568
5576FLECS_API
5578 const ecs_world_t *world,
5579 const ecs_type_info_t *ti,
5580 void *ptr);
5581
5588FLECS_API
5590 ecs_world_t *world,
5591 ecs_entity_t type);
5592
5600 ecs_world_t *world,
5601 const ecs_type_info_t *ti);
5602
5611 const ecs_world_t *world,
5612 const ecs_type_info_t *ti,
5613 void *ptr);
5614
5622FLECS_API
5624 const ecs_world_t *world,
5625 ecs_entity_t type,
5626 void* ptr);
5627
5634FLECS_API
5636 ecs_world_t *world,
5637 ecs_entity_t type,
5638 void* ptr);
5639
5648FLECS_API
5650 const ecs_world_t *world,
5651 const ecs_type_info_t *ti,
5652 void* dst,
5653 const void *src);
5654
5663FLECS_API
5665 const ecs_world_t *world,
5666 ecs_entity_t type,
5667 void* dst,
5668 const void *src);
5669
5679 const ecs_world_t *world,
5680 const ecs_type_info_t *ti,
5681 void* dst,
5682 void *src);
5683
5693 const ecs_world_t *world,
5694 ecs_entity_t type,
5695 void* dst,
5696 void *src);
5697
5707 const ecs_world_t *world,
5708 const ecs_type_info_t *ti,
5709 void* dst,
5710 void *src);
5711
5721 const ecs_world_t *world,
5722 ecs_entity_t type,
5723 void* dst,
5724 void *src);
5725
5740#include "flecs/addons/flecs_c.h"
5741
5742#ifdef __cplusplus
5743}
5744#endif
5745
5746#include "flecs/private/addons.h"
5747
5748#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:1278
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:423
ecs_id_t ecs_entity_t
An entity identifier.
Definition: flecs.h:286
struct ecs_rule_t ecs_rule_t
A rule is a query with advanced graph traversal features.
Definition: flecs.h:383
struct ecs_table_record_t ecs_table_record_t
Information about where in a table a specific (component) id is stored.
Definition: flecs.h:442
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:439
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition: flecs.h:330
struct ecs_mixins_t ecs_mixins_t
Type that stores poly mixins.
Definition: flecs.h:469
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
Definition: flecs.h:279
struct ecs_query_t ecs_query_t
A query that caches its results.
Definition: flecs.h:362
struct ecs_observable_t ecs_observable_t
An observable produces events that can be listened for by an observer.
Definition: flecs.h:406
struct ecs_record_t ecs_record_t
Information about an entity, like its table and row.
Definition: flecs.h:436
struct ecs_table_t ecs_table_t
A table stores entities and components for a specific type.
Definition: flecs.h:333
void ecs_poly_t
A poly object.
Definition: flecs.h:466
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:581
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:561
uint64_t(* ecs_hash_value_action_t)(const void *ptr)
Callback used for hashing values.
Definition: flecs.h:599
void(* ecs_iter_fini_action_t)(ecs_iter_t *it)
Function prototype for freeing an iterator.
Definition: flecs.h:539
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:550
bool(* ecs_iter_next_action_t)(ecs_iter_t *it)
Function prototype for iterating an iterator.
Definition: flecs.h:531
void(* ecs_iter_action_t)(ecs_iter_t *it)
Function prototype for iterables.
Definition: flecs.h:504
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:609
int(* ecs_compare_action_t)(const void *ptr1, const void *ptr2)
Callback used for sorting values.
Definition: flecs.h:594
void(* ecs_fini_action_t)(ecs_world_t *world, void *ctx)
Action callback on world exit.
Definition: flecs.h:585
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:616
void(* ecs_run_action_t)(ecs_iter_t *it)
Function prototype for runnables (systems, observers).
Definition: flecs.h:495
void(* ecs_ctx_free_t)(void *ctx)
Function to cleanup context data.
Definition: flecs.h:590
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:543
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:518
void(* ecs_xtor_t)(void *ptr, int32_t count, const ecs_type_info_t *type_info)
Constructor/destructor callback.
Definition: flecs.h:603
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:236
#define FLECS_EVENT_DESC_MAX
Maximum number of events in ecs_observer_desc_t.
Definition: flecs.h:240
#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:231
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:649
ecs_oper_kind_t
Specify operator for term.
Definition: flecs.h:658
ecs_filter_t ECS_FILTER_INIT
Use $this variable to initialize user-allocated filter object.
@ EcsOut
Term is only written.
Definition: flecs.h:654
@ EcsInOut
Term is both read and written.
Definition: flecs.h:652
@ EcsInOutDefault
InOut for regular terms, In for shared terms.
Definition: flecs.h:650
@ EcsInOutNone
Term is neither read nor written.
Definition: flecs.h:651
@ EcsIn
Term is only read.
Definition: flecs.h:653
@ EcsNot
The term must not match.
Definition: flecs.h:661
@ EcsOptional
The term may match.
Definition: flecs.h:662
@ EcsOr
One of the terms in an or chain must match.
Definition: flecs.h:660
@ EcsOrFrom
Term must match at least one component from term id.
Definition: flecs.h:664
@ EcsAnd
The term must match.
Definition: flecs.h:659
@ EcsNotFrom
Term must match none of the components from term id.
Definition: flecs.h:665
@ EcsAndFrom
Term must match all components from term id.
Definition: flecs.h:663
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:1261
ecs_size_t size
Component size.
Definition: flecs.h:1262
ecs_size_t alignment
Component alignment.
Definition: flecs.h:1263
A (string) identifier.
Definition: flecs.h:1252
ecs_size_t length
Length of identifier.
Definition: flecs.h:1254
char * value
Identifier string.
Definition: flecs.h:1253
ecs_hashmap_t * index
Current index.
Definition: flecs.h:1257
uint64_t hash
Hash of current value.
Definition: flecs.h:1255
uint64_t index_hash
Hash of existing record in current index.
Definition: flecs.h:1256
Component for storing a poly object.
Definition: flecs.h:1267
ecs_poly_t * poly
Pointer to poly object.
Definition: flecs.h:1268
Apply a rate filter to a tick source.
Definition: timer.h:45
Target data for flattened relationships.
Definition: flecs.h:1272
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:917
void ** data
Array with component data to insert.
Definition: flecs.h:929
ecs_id_t ids[(32)]
Ids to create the entities with.
Definition: flecs.h:927
int32_t count
Number of entities to create/populate.
Definition: flecs.h:925
ecs_entity_t * entities
Entities to bulk insert.
Definition: flecs.h:920
ecs_table_t * table
Table to insert the entities into.
Definition: flecs.h:936
Used with ecs_component_init.
Definition: flecs.h:947
ecs_type_info_t type
Parameters for type (size, hooks, ...)
Definition: flecs.h:954
ecs_entity_t entity
Existing entity to associate with observer (optional)
Definition: flecs.h:951
Used with ecs_entity_init.
Definition: flecs.h:876
const char * sep
Optional custom separator for hierarchical names.
Definition: flecs.h:886
const char * root_sep
Optional, used for identifiers relative to root.
Definition: flecs.h:890
const char * name
Name of the entity.
Definition: flecs.h:881
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:902
ecs_id_t add[(32)]
Array of ids to add to the new or existing entity.
Definition: flecs.h:907
const char * symbol
Optional entity symbol.
Definition: flecs.h:892
const char * add_expr
String expression with components to add.
Definition: flecs.h:910
ecs_entity_t id
Set to modify existing entity (optional)
Definition: flecs.h:879
Used with ecs_emit.
Definition: flecs.h:1122
ecs_entity_t entity
Single-entity alternative to setting table / offset / count.
Definition: flecs.h:1147
ecs_table_t * table
The table for which to notify.
Definition: flecs.h:1132
int32_t count
Limit number of notified entities to count.
Definition: flecs.h:1144
ecs_table_t * other_table
Optional 2nd table to notify.
Definition: flecs.h:1136
const void * param
Optional context.
Definition: flecs.h:1150
int32_t offset
Limit notified entities to ones starting from offset (row) in table.
Definition: flecs.h:1139
const ecs_type_t * ids
Component ids.
Definition: flecs.h:1129
ecs_poly_t * observable
Observable (usually the world)
Definition: flecs.h:1153
ecs_entity_t event
The event id.
Definition: flecs.h:1124
ecs_flags32_t flags
Event flags.
Definition: flecs.h:1156
Used with ecs_filter_init.
Definition: flecs.h:961
ecs_term_t * terms_buffer
For filters with lots of terms an outside array can be provided.
Definition: flecs.h:969
bool instanced
When true, terms returned by an iterator may either contain 1 or N elements, where terms with N eleme...
Definition: flecs.h:982
ecs_term_t terms[(16)]
Terms of the filter.
Definition: flecs.h:966
int32_t terms_buffer_count
Number of terms in array provided in terms_buffer.
Definition: flecs.h:972
ecs_entity_t entity
Entity associated with query (optional)
Definition: flecs.h:991
ecs_flags32_t flags
Flags for advanced usage.
Definition: flecs.h:985
ecs_filter_t * storage
External storage to prevent allocation of the filter object.
Definition: flecs.h:975
const char * expr
Filter expression.
Definition: flecs.h:988
Filters alllow for ad-hoc quick filtering of entity tables.
Definition: flecs.h:745
ecs_term_t * terms
Array containing terms for filter.
Definition: flecs.h:748
int32_t * sizes
Field size (same for each result)
Definition: flecs.h:758
bool owned
Is filter object owned by filter.
Definition: flecs.h:752
int32_t field_count
Number of fields in iterator for filter.
Definition: flecs.h:750
int32_t term_count
Number of elements in terms array.
Definition: flecs.h:749
ecs_flags32_t flags
Filter flags.
Definition: flecs.h:755
bool terms_owned
Is terms array owned by filter.
Definition: flecs.h:753
ecs_world_t * world
World mixin.
Definition: flecs.h:764
char * variable_names[1]
Placeholder variable names array.
Definition: flecs.h:757
ecs_poly_dtor_t dtor
Dtor mixin.
Definition: flecs.h:763
ecs_entity_t entity
Entity associated with filter (optional)
Definition: flecs.h:761
ecs_iterable_t iterable
Iterable mixin.
Definition: flecs.h:762
Header for ecs_poly_t objects.
Definition: flecs.h:472
Iterable mixin.
Definition: flecs.h:636
ecs_iter_init_action_t init
Callback that creates iterator.
Definition: flecs.h:637
Used with ecs_observer_init.
Definition: flecs.h:1067
void * binding_ctx
Context to be used for language bindings.
Definition: flecs.h:1099
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition: flecs.h:1102
ecs_entity_t entity
Existing entity to associate with observer (optional)
Definition: flecs.h:1071
ecs_filter_desc_t filter
Filter for observer.
Definition: flecs.h:1074
int32_t term_index
Used for internal purposes.
Definition: flecs.h:1115
ecs_entity_t events[(8)]
Events to observe (OnAdd, OnRemove, OnSet, UnSet)
Definition: flecs.h:1077
int32_t * last_event_id
Optional shared last event id for multiple observers.
Definition: flecs.h:1112
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition: flecs.h:1105
void * ctx
User context to pass to callback.
Definition: flecs.h:1096
ecs_poly_t * observable
Observable with which to register the observer.
Definition: flecs.h:1108
ecs_iter_action_t callback
Callback to invoke on an event, invoked when the observer matches.
Definition: flecs.h:1085
bool yield_existing
When observer is created, generate events from existing data.
Definition: flecs.h:1082
ecs_run_action_t run
Callback invoked on an event.
Definition: flecs.h:1093
ecs_iter_action_t callback
See ecs_observer_desc_t::callback.
Definition: flecs.h:777
int32_t term_index
Index of the term in parent observer (single term observers only)
Definition: flecs.h:792
ecs_observable_t * observable
Observable for observer.
Definition: flecs.h:786
ecs_run_action_t run
See ecs_observer_desc_t::run.
Definition: flecs.h:778
int32_t * last_event_id
Last handled event id.
Definition: flecs.h:788
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition: flecs.h:783
ecs_filter_t filter
Query for observer.
Definition: flecs.h:771
void * ctx
Callback context.
Definition: flecs.h:780
ecs_id_t register_id
Id observer is registered with (single term observers only)
Definition: flecs.h:791
void * binding_ctx
Binding context (for language bindings)
Definition: flecs.h:781
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:794
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition: flecs.h:784
bool is_multi
If true, the observer triggers on more than one term.
Definition: flecs.h:798
Used with ecs_query_init.
Definition: flecs.h:998
ecs_order_by_action_t order_by
Callback used for ordering query results.
Definition: flecs.h:1010
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition: flecs.h:1057
ecs_id_t group_by_id
Id to be used by group_by.
Definition: flecs.h:1019
ecs_group_by_action_t group_by
Callback used for grouping results.
Definition: flecs.h:1026
void * ctx
User context to pass to callback.
Definition: flecs.h:1051
ecs_ctx_free_t group_by_ctx_free
Function to free group_by_ctx.
Definition: flecs.h:1040
void * group_by_ctx
Context to pass to group_by.
Definition: flecs.h:1037
void * binding_ctx
Context to be used for language bindings.
Definition: flecs.h:1054
ecs_group_create_action_t on_group_create
Callback that is invoked when a new group is created.
Definition: flecs.h:1030
ecs_query_t * parent
If set, the query will be created as a subquery.
Definition: flecs.h:1048
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition: flecs.h:1060
ecs_entity_t order_by_component
Component to be used by order_by.
Definition: flecs.h:1005
ecs_filter_desc_t filter
Filter for the query.
Definition: flecs.h:1002
ecs_group_delete_action_t on_group_delete
Callback that is invoked when an existing group is deleted.
Definition: flecs.h:1034
ecs_sort_table_action_t sort_table
Callback used for ordering query results.
Definition: flecs.h:1014
Type that contains information about a query group.
Definition: flecs.h:1237
int32_t table_count
Number of tables in group.
Definition: flecs.h:1239
void * ctx
Group context, returned by on_group_create.
Definition: flecs.h:1240
int32_t match_count
How often tables have been matched/unmatched.
Definition: flecs.h:1238
Type that describes a single identifier in a term.
Definition: flecs.h:696
ecs_flags32_t flags
Term flags.
Definition: flecs.h:713
ecs_entity_t trav
Relationship to traverse when looking for the component.
Definition: flecs.h:709
const char * name
Name.
Definition: flecs.h:703
ecs_entity_t id
Entity id.
Definition: flecs.h:697
Type that describes a term (single element in a query)
Definition: flecs.h:717
ecs_term_id_t second
Second element of pair.
Definition: flecs.h:725
ecs_id_t id
Component id to be matched by term.
Definition: flecs.h:718
char * name
Name of term.
Definition: flecs.h:731
ecs_term_id_t src
Source of term.
Definition: flecs.h:723
ecs_id_record_t * idr
Cached pointer to internal index.
Definition: flecs.h:734
ecs_term_id_t first
Component or first element of pair.
Definition: flecs.h:724
int32_t field_index
Index of field for term in iterator.
Definition: flecs.h:733
ecs_id_t id_flags
Id flags of term id.
Definition: flecs.h:730
bool move
Used by internals.
Definition: flecs.h:738
ecs_flags16_t flags
Flags that help eval, set by ecs_filter_init.
Definition: flecs.h:736
ecs_inout_kind_t inout
Access to contents matched by term.
Definition: flecs.h:727
ecs_oper_kind_t oper
Operator of term.
Definition: flecs.h:728
Type that contains component lifecycle callbacks.
Definition: flecs.h:810
ecs_copy_t copy_ctor
Ctor + copy.
Definition: flecs.h:817
void * ctx
User defined context.
Definition: flecs.h:848
ecs_iter_action_t on_remove
Callback that is invoked when an instance of the component is removed.
Definition: flecs.h:846
void * binding_ctx
Language binding context.
Definition: flecs.h:849
ecs_move_t move_dtor
Move + dtor.
Definition: flecs.h:832
ecs_copy_t copy
copy assignment
Definition: flecs.h:813
ecs_iter_action_t on_set
Callback that is invoked when an instance of the component is set.
Definition: flecs.h:841
ecs_move_t move
move assignment
Definition: flecs.h:814
ecs_xtor_t ctor
ctor
Definition: flecs.h:811
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition: flecs.h:851
ecs_iter_action_t on_add
Callback that is invoked when an instance of a component is added.
Definition: flecs.h:836
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition: flecs.h:852
ecs_move_t move_ctor
Ctor + move.
Definition: flecs.h:820
ecs_move_t ctor_move_dtor
Ctor + move + dtor (or move_ctor + dtor).
Definition: flecs.h:826
ecs_xtor_t dtor
dtor
Definition: flecs.h:812
Type that contains component information (passed to ctors/dtors/...)
Definition: flecs.h:859
ecs_size_t alignment
Alignment of type.
Definition: flecs.h:861
ecs_size_t size
Size of type.
Definition: flecs.h:860
const char * name
Type name.
Definition: flecs.h:864
ecs_entity_t component
Handle to component (do not set)
Definition: flecs.h:863
ecs_type_hooks_t hooks
Type hooks.
Definition: flecs.h:862
A type is a list of (component) ids.
Definition: flecs.h:303
Type that contains information about the world.
Definition: flecs.h:1173
int64_t get_mut_count
get_mut/emplace commands processed
Definition: flecs.h:1222
float delta_time
Time passed to or computed by ecs_progress.
Definition: flecs.h:1179
int32_t id_count
Number of ids in the world (excluding wildcards)
Definition: flecs.h:1202
ecs_entity_t min_id
First allowed entity id.
Definition: flecs.h:1175
int32_t trivial_table_count
Number of tables with trivial components (no lifecycle callbacks)
Definition: flecs.h:1210
int64_t set_count
set commands processed
Definition: flecs.h:1221
float world_time_total
Time elapsed in simulation.
Definition: flecs.h:1186
int32_t tag_id_count
Number of tag (no data) ids in the world.
Definition: flecs.h:1203
int32_t tag_table_count
Number of tag-only tables.
Definition: flecs.h:1209
int32_t component_id_count
Number of component (data) ids in the world.
Definition: flecs.h:1204
int32_t table_record_count
Total number of table records (entries in table caches)
Definition: flecs.h:1212
int64_t pipeline_build_count_total
Total number of pipeline builds.
Definition: flecs.h:1198
int32_t table_count
Number of tables.
Definition: flecs.h:1208
float delta_time_raw
Raw delta time (no time scaling)
Definition: flecs.h:1178
float frame_time_total
Total time spent processing a frame.
Definition: flecs.h:1182
float world_time_total_raw
Time elapsed in simulation (no scaling)
Definition: flecs.h:1187
int64_t table_create_total
Total number of times a table was created.
Definition: flecs.h:1196
int64_t observers_ran_frame
Total number of times observer was invoked.
Definition: flecs.h:1200
float system_time_total
Total time spent in systems.
Definition: flecs.h:1183
int64_t id_delete_total
Total number of times an id was deleted.
Definition: flecs.h:1195
int64_t systems_ran_frame
Total number of systems ran in last frame.
Definition: flecs.h:1199
float merge_time_total
Total time spent in merges.
Definition: flecs.h:1185
int64_t discard_count
commands discarded, happens when entity is no longer alive when running the command
Definition: flecs.h:1225
int64_t clear_count
clear commands processed
Definition: flecs.h:1220
ecs_entity_t last_component_id
Last issued component entity id.
Definition: flecs.h:1174
int32_t empty_table_count
Number of tables without entities.
Definition: flecs.h:1211
int64_t frame_count_total
Total number of frames.
Definition: flecs.h:1190
ecs_entity_t max_id
Last allowed entity id.
Definition: flecs.h:1176
int64_t merge_count_total
Total number of merges.
Definition: flecs.h:1191
int64_t other_count
other commands processed
Definition: flecs.h:1224
int64_t batched_command_count
commands batched
Definition: flecs.h:1227
int64_t table_delete_total
Total number of times a table was deleted.
Definition: flecs.h:1197
int64_t delete_count
delete commands processed
Definition: flecs.h:1219
int64_t rematch_count_total
Total number of rematches.
Definition: flecs.h:1192
int64_t id_create_total
Total number of times a new id was created.
Definition: flecs.h:1194
int64_t batched_entity_count
entities for which commands were batched
Definition: flecs.h:1226
float time_scale
Time scale applied to delta_time.
Definition: flecs.h:1180
int32_t pair_id_count
Number of pair ids in the world.
Definition: flecs.h:1205
float rematch_time_total
Time spent on query rematching.
Definition: flecs.h:1188
float target_fps
Target fps.
Definition: flecs.h:1181
int32_t wildcard_id_count
Number of wildcard ids.
Definition: flecs.h:1206
int32_t table_storage_count
Total number of table storages.
Definition: flecs.h:1213
float emit_time_total
Total time spent notifying observers.
Definition: flecs.h:1184
int64_t modified_count
modified commands processed
Definition: flecs.h:1223
const char * name_prefix
Value set by ecs_set_name_prefix.
Definition: flecs.h:1230
int64_t add_count
add commands processed
Definition: flecs.h:1217
int64_t remove_count
remove commands processed
Definition: flecs.h:1218
flecs::term term() const
Create a term for a (component) type.