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
35#ifndef ecs_float_t
36#define ecs_float_t float
37#endif
38
42#ifndef ecs_ftime_t
43#define ecs_ftime_t ecs_float_t
44#endif
45
49// #define FLECS_LEGACY
50
54#define FLECS_NO_DEPRECATED_WARNINGS
55
61// #define FLECS_ACCURATE_COUNTERS
62
63/* Make sure provided configuration is valid */
64#if defined(FLECS_DEBUG) && defined(FLECS_NDEBUG)
65#error "invalid configuration: cannot both define FLECS_DEBUG and FLECS_NDEBUG"
66#endif
67#if defined(FLECS_DEBUG) && defined(NDEBUG)
68#error "invalid configuration: cannot both define FLECS_DEBUG and NDEBUG"
69#endif
70
75#if !defined(FLECS_DEBUG) && !defined(FLECS_NDEBUG)
76#if defined(NDEBUG)
77#define FLECS_NDEBUG
78#else
79#define FLECS_DEBUG
80#endif
81#endif
82
87#ifdef FLECS_SANITIZE
88#ifndef FLECS_DEBUG
89#define FLECS_DEBUG /* If sanitized mode is enabled, so is debug mode */
90#endif
91#endif
92
93/* Tip: if you see weird behavior that you think might be a bug, make sure to
94 * test with the FLECS_DEBUG or FLECS_SANITIZE flags enabled. There's a good
95 * chance that this gives you more information about the issue! */
96
110// #define FLECS_SOFT_ASSERT
111
117// #define FLECS_KEEP_ASSERT
118
146// #define FLECS_CUSTOM_BUILD
147
156// #define FLECS_CPP_NO_AUTO_REGISTRATION
157
158#ifndef FLECS_CUSTOM_BUILD
159// #define FLECS_C /**< C API convenience macros, always enabled */
160#define FLECS_CPP
161#define FLECS_MODULE
162#define FLECS_PARSER
163#define FLECS_PLECS
164#define FLECS_RULES
165#define FLECS_SNAPSHOT
166#define FLECS_STATS
167#define FLECS_MONITOR
168#define FLECS_METRICS
169#define FLECS_ALERTS
170#define FLECS_SYSTEM
171#define FLECS_PIPELINE
172#define FLECS_TIMER
173#define FLECS_META
174#define FLECS_META_C
175#define FLECS_UNITS
176#define FLECS_EXPR
177#define FLECS_JSON
178#define FLECS_DOC
179#define FLECS_COREDOC
180#define FLECS_LOG
181#define FLECS_APP
182#define FLECS_OS_API_IMPL
183#define FLECS_HTTP
184#define FLECS_REST
185// #define FLECS_JOURNAL /**< Journaling addon (disabled by default) */
186#endif // ifndef FLECS_CUSTOM_BUILD
187
191// #define FLECS_LOW_FOOTPRINT
192#ifdef FLECS_LOW_FOOTPRINT
193#define FLECS_HI_COMPONENT_ID (16)
194#define FLECS_HI_ID_RECORD_ID (16)
195#define FLECS_SPARSE_PAGE_BITS (6)
196#define FLECS_ENTITY_PAGE_BITS (6)
197#define FLECS_USE_OS_ALLOC
198#endif
199
210#ifndef FLECS_HI_COMPONENT_ID
211#define FLECS_HI_COMPONENT_ID (256)
212#endif
213
220#ifndef FLECS_HI_ID_RECORD_ID
221#define FLECS_HI_ID_RECORD_ID (1024)
222#endif
223
229#ifndef FLECS_SPARSE_PAGE_BITS
230#define FLECS_SPARSE_PAGE_BITS (12)
231#endif
232
235#ifndef FLECS_ENTITY_PAGE_BITS
236#define FLECS_ENTITY_PAGE_BITS (12)
237#endif
238
243// #define FLECS_USE_OS_ALLOC
244
247#ifndef FLECS_ID_DESC_MAX
248#define FLECS_ID_DESC_MAX (32)
249#endif
250
253#define FLECS_TERM_DESC_MAX (16)
254
257#define FLECS_EVENT_DESC_MAX (8)
258
261#define FLECS_VARIABLE_COUNT_MAX (64)
262
265#define FLECS_QUERY_SCOPE_NESTING_MAX (8)
266
269#include "flecs/private/api_defines.h"
270#include "flecs/private/vec.h" /* Vector datatype */
271#include "flecs/private/sparse.h" /* Sparse set */
272#include "flecs/private/block_allocator.h" /* Block allocator */
273#include "flecs/private/map.h" /* Map */
274#include "flecs/private/allocator.h" /* Allocator */
275#include "flecs/private/strbuf.h" /* String builder */
276#include "flecs/os_api.h" /* Abstraction for operating system functions */
277
278#ifdef __cplusplus
279extern "C" {
280#endif
281
298typedef uint64_t ecs_id_t;
299
306
322typedef struct {
323 ecs_id_t *array;
324 int32_t count;
325} ecs_type_t;
326
350
353
355typedef struct ecs_term_t ecs_term_t;
356
362
382
403typedef struct ecs_rule_t ecs_rule_t;
404
424
429
430/* Type used for iterating iterable objects.
431 * Iterators are a common interface across iterable objects (world, filters,
432 * rules, queries, systems, observers) to provide applications with information
433 * about the currently iterated result, and to store any state required for the
434 * iteration. */
435typedef struct ecs_iter_t ecs_iter_t;
436
445typedef struct ecs_ref_t ecs_ref_t;
446
451
456
459
462
465
488typedef void ecs_poly_t;
489
492
494typedef struct ecs_header_t {
495 int32_t magic; /* Magic number verifying it's a flecs object */
496 int32_t type; /* Magic number indicating which type of flecs object */
497 ecs_mixins_t *mixins; /* Table with offsets to (optional) mixins */
499
518typedef void (*ecs_run_action_t)(
519 ecs_iter_t *it);
520
527typedef void (*ecs_iter_action_t)(
528 ecs_iter_t *it);
529
542 const ecs_world_t *world,
543 const ecs_poly_t *iterable,
544 ecs_iter_t *it,
545 ecs_term_t *filter);
546
555 ecs_iter_t *it);
556
563 ecs_iter_t *it);
564
567 ecs_entity_t e1,
568 const void *ptr1,
569 ecs_entity_t e2,
570 const void *ptr2);
571
574 ecs_world_t* world,
575 ecs_table_t* table,
576 ecs_entity_t* entities,
577 void* ptr,
578 int32_t size,
579 int32_t lo,
580 int32_t hi,
581 ecs_order_by_action_t order_by);
582
584typedef uint64_t (*ecs_group_by_action_t)(
585 ecs_world_t *world,
586 ecs_table_t *table,
587 ecs_id_t group_id,
588 void *ctx);
589
590/* Callback invoked when a query creates a new group. */
591typedef void* (*ecs_group_create_action_t)(
592 ecs_world_t *world,
593 uint64_t group_id,
594 void *group_by_ctx); /* from ecs_query_desc_t */
595
596/* Callback invoked when a query deletes an existing group. */
597typedef void (*ecs_group_delete_action_t)(
598 ecs_world_t *world,
599 uint64_t group_id,
600 void *group_ctx, /* return value from ecs_group_create_action_t */
601 void *group_by_ctx); /* from ecs_query_desc_t */
602
604typedef void (*ecs_module_action_t)(
605 ecs_world_t *world);
606
608typedef void (*ecs_fini_action_t)(
609 ecs_world_t *world,
610 void *ctx);
611
613typedef void (*ecs_ctx_free_t)(
614 void *ctx);
615
617typedef int (*ecs_compare_action_t)(
618 const void *ptr1,
619 const void *ptr2);
620
622typedef uint64_t (*ecs_hash_value_action_t)(
623 const void *ptr);
624
626typedef void (*ecs_xtor_t)(
627 void *ptr,
628 int32_t count,
629 const ecs_type_info_t *type_info);
630
632typedef void (*ecs_copy_t)(
633 void *dst_ptr,
634 const void *src_ptr,
635 int32_t count,
636 const ecs_type_info_t *type_info);
637
639typedef void (*ecs_move_t)(
640 void *dst_ptr,
641 void *src_ptr,
642 int32_t count,
643 const ecs_type_info_t *type_info);
644
645/* Destructor function for poly objects */
646typedef void (*ecs_poly_dtor_t)(
647 ecs_poly_t *poly);
648
663
681
692
693/* Term id flags */
694#define EcsSelf (1u << 1)
695#define EcsUp (1u << 2)
696#define EcsDown (1u << 3)
697#define EcsTraverseAll (1u << 4)
698#define EcsCascade (1u << 5)
699#define EcsDesc (1u << 6)
700#define EcsParent (1u << 7)
701#define EcsIsVariable (1u << 8)
702#define EcsIsEntity (1u << 9)
703#define EcsIsName (1u << 10)
704#define EcsFilter (1u << 11)
705#define EcsTraverseFlags (EcsUp|EcsDown|EcsTraverseAll|EcsSelf|EcsCascade|EcsDesc|EcsParent)
706
707/* Term flags discovered & set during filter creation. Mostly used internally to
708 * store information relevant to queries. */
709#define EcsTermMatchAny (1u << 0)
710#define EcsTermMatchAnySrc (1u << 1)
711#define EcsTermSrcFirstEq (1u << 2)
712#define EcsTermSrcSecondEq (1u << 3)
713#define EcsTermTransitive (1u << 4)
714#define EcsTermReflexive (1u << 5)
715#define EcsTermIdInherited (1u << 6)
716#define EcsTermIsTrivial (1u << 7)
717#define EcsTermNoData (1u << 8)
718
719/* Term flags used for term iteration */
720#define EcsTermMatchDisabled (1u << 7)
721#define EcsTermMatchPrefab (1u << 8)
722
743
768
770FLECS_API extern ecs_filter_t ECS_FILTER_INIT;
771
774 ecs_header_t hdr;
775
776 int8_t term_count;
777 int8_t field_count;
778 ecs_flags32_t flags;
779 ecs_flags64_t data_fields;
782 char *variable_names[1];
783 int32_t *sizes;
786 /* Mixins */
789 ecs_poly_dtor_t dtor;
791};
792
793/* An observer reacts to events matching a filter */
795 ecs_header_t hdr;
796
799 /* Observer events */
801 int32_t event_count;
802
806 void *ctx;
814 int32_t *last_event_id;
815 int32_t last_event_id_storage;
816
818 int32_t term_index;
824 bool is_multi;
826 /* Mixins */
827 ecs_poly_dtor_t dtor;
828};
829
880
892
893#include "flecs/private/api_types.h" /* Supporting API types */
894#include "flecs/private/api_support.h" /* Supporting API functions */
895#include "flecs/private/vec.h" /* Vector */
896#include "flecs/private/hashmap.h" /* Hashmap */
897
902typedef struct ecs_entity_desc_t {
903 int32_t _canary;
904
907 const char *name;
912 const char *sep;
916 const char *root_sep;
918 const char *symbol;
934
936 const char *add_expr;
938
968
982
987typedef struct ecs_filter_desc_t {
988 int32_t _canary;
989
993
996
999
1002
1009
1011 ecs_flags32_t flags;
1012
1014 const char *expr;
1015
1019
1088
1143
1148typedef struct ecs_event_desc_t {
1151
1156
1159
1163
1165 int32_t offset;
1166
1170 int32_t count;
1171
1174
1179 void *param;
1180
1181 /* Same as param, but with the guarantee that the value won't be modified.
1182 * When an event with a const parameter is enqueued, the value of the param
1183 * is copied to a temporary storage of the event type. */
1184 const void *const_param;
1185
1188
1190 ecs_flags32_t flags;
1192
1193
1201/* Utility to hold a value of a dynamic type */
1202typedef struct ecs_value_t {
1203 ecs_entity_t type;
1204 void *ptr;
1205} ecs_value_t;
1206
1264
1271
1282typedef struct EcsIdentifier {
1283 char *value;
1284 ecs_size_t length;
1285 uint64_t hash;
1286 uint64_t index_hash;
1287 ecs_hashmap_t *index;
1289
1291typedef struct EcsComponent {
1292 ecs_size_t size;
1293 ecs_size_t alignment;
1295
1300
1302typedef struct EcsTarget {
1303 int32_t count;
1304 ecs_record_t *target;
1306
1309
1313/* Only include deprecated definitions if deprecated addon is required */
1314#ifdef FLECS_DEPRECATED
1316#endif
1317
1333FLECS_API extern const ecs_id_t ECS_PAIR;
1334
1336FLECS_API extern const ecs_id_t ECS_OVERRIDE;
1337
1339FLECS_API extern const ecs_id_t ECS_TOGGLE;
1340
1342FLECS_API extern const ecs_id_t ECS_AND;
1343
1351/* Builtin component ids */
1352FLECS_API extern const ecs_entity_t ecs_id(EcsComponent);
1353FLECS_API extern const ecs_entity_t ecs_id(EcsIdentifier);
1354FLECS_API extern const ecs_entity_t ecs_id(EcsIterable);
1355FLECS_API extern const ecs_entity_t ecs_id(EcsPoly);
1356
1357FLECS_API extern const ecs_entity_t EcsQuery;
1358FLECS_API extern const ecs_entity_t EcsObserver;
1359
1360/* System module component ids */
1361FLECS_API extern const ecs_entity_t EcsSystem;
1362FLECS_API extern const ecs_entity_t ecs_id(EcsTickSource);
1363
1364/* Pipeline module component ids */
1365FLECS_API extern const ecs_entity_t ecs_id(EcsPipelineQuery);
1366
1367/* Timer module component ids */
1368FLECS_API extern const ecs_entity_t ecs_id(EcsTimer);
1369FLECS_API extern const ecs_entity_t ecs_id(EcsRateFilter);
1370
1372FLECS_API extern const ecs_entity_t EcsFlecs;
1373
1375FLECS_API extern const ecs_entity_t EcsFlecsCore;
1376
1378FLECS_API extern const ecs_entity_t EcsWorld;
1379
1381FLECS_API extern const ecs_entity_t EcsWildcard;
1382
1384FLECS_API extern const ecs_entity_t EcsAny;
1385
1387FLECS_API extern const ecs_entity_t EcsThis;
1388
1390FLECS_API extern const ecs_entity_t EcsVariable;
1391
1396FLECS_API extern const ecs_entity_t EcsTransitive;
1397
1402FLECS_API extern const ecs_entity_t EcsReflexive;
1403
1411FLECS_API extern const ecs_entity_t EcsFinal;
1412
1418FLECS_API extern const ecs_entity_t EcsDontInherit;
1419
1425FLECS_API extern const ecs_entity_t EcsAlwaysOverride;
1426
1431FLECS_API extern const ecs_entity_t EcsSymmetric;
1432
1439FLECS_API extern const ecs_entity_t EcsExclusive;
1440
1442FLECS_API extern const ecs_entity_t EcsAcyclic;
1443
1446FLECS_API extern const ecs_entity_t EcsTraversable;
1447
1454FLECS_API extern const ecs_entity_t EcsWith;
1455
1462FLECS_API extern const ecs_entity_t EcsOneOf;
1463
1466FLECS_API extern const ecs_entity_t EcsTag;
1467
1471FLECS_API extern const ecs_entity_t EcsUnion;
1472
1474FLECS_API extern const ecs_entity_t EcsName;
1475
1477FLECS_API extern const ecs_entity_t EcsSymbol;
1478
1480FLECS_API extern const ecs_entity_t EcsAlias;
1481
1483FLECS_API extern const ecs_entity_t EcsChildOf;
1484
1486FLECS_API extern const ecs_entity_t EcsIsA;
1487
1489FLECS_API extern const ecs_entity_t EcsDependsOn;
1490
1492FLECS_API extern const ecs_entity_t EcsSlotOf;
1493
1495FLECS_API extern const ecs_entity_t EcsModule;
1496
1498FLECS_API extern const ecs_entity_t EcsPrivate;
1499
1502FLECS_API extern const ecs_entity_t EcsPrefab;
1503
1506FLECS_API extern const ecs_entity_t EcsDisabled;
1507
1509FLECS_API extern const ecs_entity_t EcsOnAdd;
1510
1512FLECS_API extern const ecs_entity_t EcsOnRemove;
1513
1515FLECS_API extern const ecs_entity_t EcsOnSet;
1516
1518FLECS_API extern const ecs_entity_t EcsUnSet;
1519
1521FLECS_API extern const ecs_entity_t EcsMonitor;
1522
1524FLECS_API extern const ecs_entity_t EcsOnTableCreate;
1525
1527FLECS_API extern const ecs_entity_t EcsOnTableDelete;
1528
1530FLECS_API extern const ecs_entity_t EcsOnTableEmpty;
1531
1533FLECS_API extern const ecs_entity_t EcsOnTableFill;
1534
1536FLECS_API extern const ecs_entity_t EcsOnDelete;
1537
1540FLECS_API extern const ecs_entity_t EcsOnDeleteTarget;
1541
1544FLECS_API extern const ecs_entity_t EcsRemove;
1545
1548FLECS_API extern const ecs_entity_t EcsDelete;
1549
1552FLECS_API extern const ecs_entity_t EcsPanic;
1553
1555FLECS_API extern const ecs_entity_t ecs_id(EcsTarget);
1556
1559FLECS_API extern const ecs_entity_t EcsFlatten;
1560
1566FLECS_API extern const ecs_entity_t EcsDefaultChildComponent;
1567
1568/* Builtin predicates for comparing entity ids in queries. Only supported by rules */
1569FLECS_API extern const ecs_entity_t EcsPredEq;
1570FLECS_API extern const ecs_entity_t EcsPredMatch;
1571FLECS_API extern const ecs_entity_t EcsPredLookup;
1572
1573/* Builtin marker entities for opening/closing query scopes */
1574FLECS_API extern const ecs_entity_t EcsScopeOpen;
1575FLECS_API extern const ecs_entity_t EcsScopeClose;
1576
1578FLECS_API extern const ecs_entity_t EcsEmpty;
1579
1580/* Pipeline module tags */
1581FLECS_API extern const ecs_entity_t ecs_id(EcsPipeline);
1582FLECS_API extern const ecs_entity_t EcsOnStart;
1583FLECS_API extern const ecs_entity_t EcsPreFrame;
1584FLECS_API extern const ecs_entity_t EcsOnLoad;
1585FLECS_API extern const ecs_entity_t EcsPostLoad;
1586FLECS_API extern const ecs_entity_t EcsPreUpdate;
1587FLECS_API extern const ecs_entity_t EcsOnUpdate;
1588FLECS_API extern const ecs_entity_t EcsOnValidate;
1589FLECS_API extern const ecs_entity_t EcsPostUpdate;
1590FLECS_API extern const ecs_entity_t EcsPreStore;
1591FLECS_API extern const ecs_entity_t EcsOnStore;
1592FLECS_API extern const ecs_entity_t EcsPostFrame;
1593FLECS_API extern const ecs_entity_t EcsPhase;
1594
1597#define EcsLastInternalComponentId (ecs_id(EcsPoly))
1598
1601#define EcsFirstUserComponentId (8)
1602
1605#define EcsFirstUserEntityId (FLECS_HI_COMPONENT_ID + 128)
1606
1607/* When visualized the reserved id ranges look like this:
1608 * [1..8]: Builtin components
1609 * [9..FLECS_HI_COMPONENT_ID]: Low ids reserved for application components
1610 * [FLECS_HI_COMPONENT_ID + 1..EcsFirstUserEntityId]: Builtin entities
1611 */
1612
1634FLECS_API
1636
1643FLECS_API
1645
1653FLECS_API
1655 int argc,
1656 char *argv[]);
1657
1664FLECS_API
1666 ecs_world_t *world);
1667
1675FLECS_API
1677 const ecs_world_t *world);
1678
1686FLECS_API
1688 ecs_world_t *world,
1689 ecs_fini_action_t action,
1690 void *ctx);
1691
1717FLECS_API
1719 ecs_world_t *world,
1720 ecs_ftime_t delta_time);
1721
1728FLECS_API
1730 ecs_world_t *world);
1731
1739FLECS_API
1741 ecs_world_t *world,
1742 ecs_fini_action_t action,
1743 void *ctx);
1744
1751FLECS_API
1753 ecs_world_t *world);
1754
1759FLECS_API
1761 const ecs_world_t *world);
1762
1775 ecs_world_t *world,
1776 bool enable);
1777
1789 ecs_world_t *world,
1790 bool enable);
1791
1807FLECS_API
1809 ecs_world_t *world,
1810 ecs_ftime_t fps);
1811
1850FLECS_API
1852 ecs_world_t *world);
1853
1861FLECS_API
1863 ecs_world_t *world);
1864
1875FLECS_API
1877 ecs_world_t *world);
1878
1889FLECS_API
1891 ecs_world_t *world);
1892
1898FLECS_API
1900 const ecs_world_t *world);
1901
1910FLECS_API
1912 ecs_world_t *world);
1913
1923FLECS_API
1925 ecs_world_t *world);
1926
1932FLECS_API
1934 ecs_world_t *world);
1935
1952FLECS_API
1954 ecs_world_t *world,
1955 bool automerge);
1956
1970FLECS_API
1972 ecs_world_t *world,
1973 int32_t stages);
1974
1981FLECS_API
1983 const ecs_world_t *world);
1984
1992FLECS_API
1994 const ecs_world_t *world);
1995
2011FLECS_API
2013 const ecs_world_t *world,
2014 int32_t stage_id);
2015
2023FLECS_API
2025 const ecs_world_t *world);
2026
2045FLECS_API
2047 ecs_world_t *world);
2048
2055FLECS_API
2057 ecs_world_t *stage);
2058
2065FLECS_API
2067 ecs_world_t *stage);
2068
2084FLECS_API
2086 ecs_world_t *world,
2087 void *ctx,
2088 ecs_ctx_free_t ctx_free);
2089
2098FLECS_API
2100 ecs_world_t *world,
2101 void *ctx,
2102 ecs_ctx_free_t ctx_free);
2103
2111FLECS_API
2113 const ecs_world_t *world);
2114
2122FLECS_API
2124 const ecs_world_t *world);
2125
2131FLECS_API
2133 const ecs_world_t *world);
2134
2143FLECS_API
2145 ecs_world_t *world,
2146 int32_t entity_count);
2147
2163FLECS_API
2165 ecs_world_t *world,
2166 ecs_entity_t id_start,
2167 ecs_entity_t id_end);
2168
2179FLECS_API
2181 ecs_world_t *world,
2182 bool enable);
2183
2188FLECS_API
2190 const ecs_world_t *world);
2191
2205FLECS_API
2207 ecs_world_t *world,
2208 ecs_flags32_t flags);
2209
2243FLECS_API
2245 ecs_world_t *world,
2246 ecs_id_t id,
2247 uint16_t clear_generation,
2248 uint16_t delete_generation,
2249 int32_t min_id_count,
2250 double time_budget_seconds);
2251
2257FLECS_API
2259 const ecs_poly_t *poly);
2260
2266FLECS_API
2268 const ecs_poly_t *poly);
2269
2283FLECS_API
2285 const ecs_poly_t *object,
2286 int32_t type);
2287
2288#define ecs_poly_is(object, type)\
2289 ecs_poly_is_(object, type##_magic)
2290
2298FLECS_API
2300 ecs_entity_t first,
2301 ecs_entity_t second);
2302
2329FLECS_API
2331 ecs_world_t *world);
2332
2350FLECS_API
2352 ecs_world_t *world);
2353
2362FLECS_API
2364 ecs_world_t *world,
2365 ecs_id_t id);
2366
2374FLECS_API
2376 ecs_world_t *world,
2377 ecs_table_t *table);
2378
2397FLECS_API
2399 ecs_world_t *world,
2400 const ecs_entity_desc_t *desc);
2401
2428FLECS_API
2430 ecs_world_t *world,
2431 const ecs_bulk_desc_t *desc);
2432
2442FLECS_API
2444 ecs_world_t *world,
2445 ecs_id_t id,
2446 int32_t count);
2447
2463FLECS_API
2465 ecs_world_t *world,
2466 ecs_entity_t dst,
2467 ecs_entity_t src,
2468 bool copy_value);
2469
2478FLECS_API
2480 ecs_world_t *world,
2481 ecs_entity_t entity);
2482
2490FLECS_API
2492 ecs_world_t *world,
2493 ecs_id_t id);
2494
2512FLECS_API
2514 ecs_world_t *world,
2515 ecs_entity_t entity,
2516 ecs_id_t id);
2517
2526FLECS_API
2528 ecs_world_t *world,
2529 ecs_entity_t entity,
2530 ecs_id_t id);
2531
2557FLECS_API
2559 ecs_world_t *world,
2560 ecs_entity_t entity,
2561 ecs_id_t id);
2562
2569FLECS_API
2571 ecs_world_t *world,
2572 ecs_entity_t entity);
2573
2581FLECS_API
2583 ecs_world_t *world,
2584 ecs_id_t id);
2585
2593FLECS_API
2595 ecs_world_t *world,
2596 ecs_id_t id);
2597
2604FLECS_API
2606 const ecs_world_t *world);
2607
2626FLECS_API
2628 ecs_world_t *world,
2629 ecs_entity_t entity,
2630 bool enabled);
2631
2645FLECS_API
2647 ecs_world_t *world,
2648 ecs_entity_t entity,
2649 ecs_id_t id,
2650 bool enable);
2651
2662FLECS_API
2664 const ecs_world_t *world,
2665 ecs_entity_t entity,
2666 ecs_id_t id);
2667
2686FLECS_API
2687const void* ecs_get_id(
2688 const ecs_world_t *world,
2689 ecs_entity_t entity,
2690 ecs_id_t id);
2691
2702FLECS_API
2704 const ecs_world_t *world,
2705 ecs_entity_t entity,
2706 ecs_id_t id);
2707
2716FLECS_API
2718 const ecs_world_t *world,
2719 ecs_ref_t *ref,
2720 ecs_id_t id);
2721
2729FLECS_API
2731 const ecs_world_t *world,
2732 ecs_ref_t *ref);
2733
2748FLECS_API
2750 ecs_world_t *world,
2751 ecs_entity_t entity,
2752 ecs_id_t id);
2753
2765FLECS_API
2767 ecs_world_t *world,
2768 ecs_entity_t entity,
2769 ecs_id_t id);
2770
2789FLECS_API
2791 ecs_world_t *world,
2792 ecs_entity_t entity);
2793
2800FLECS_API
2802 ecs_record_t *record);
2803
2823FLECS_API
2825 ecs_world_t *world,
2826 ecs_entity_t entity);
2827
2833FLECS_API
2835 const ecs_record_t *record);
2836
2842FLECS_API
2844 const ecs_record_t *record);
2845
2859FLECS_API
2861 const ecs_world_t *world,
2862 const ecs_record_t *record,
2863 ecs_id_t id);
2864
2873FLECS_API
2875 ecs_world_t *world,
2876 ecs_record_t *record,
2877 ecs_id_t id);
2878
2885FLECS_API
2887 ecs_world_t *world,
2888 const ecs_record_t *record,
2889 ecs_id_t id);
2890
2904FLECS_API
2906 ecs_world_t *world,
2907 ecs_entity_t entity,
2908 ecs_id_t id);
2909
2919FLECS_API
2921 ecs_world_t *world,
2922 ecs_entity_t entity,
2923 ecs_id_t id);
2924
2941FLECS_API
2943 ecs_world_t *world,
2944 ecs_entity_t entity,
2945 ecs_id_t id,
2946 size_t size,
2947 const void *ptr);
2948
2976FLECS_API
2978 const ecs_world_t *world,
2979 ecs_entity_t e);
2980
3006FLECS_API
3008 const ecs_world_t *world,
3009 ecs_entity_t e);
3010
3016FLECS_API
3018 ecs_entity_t e);
3019
3031FLECS_API
3033 ecs_world_t *world,
3034 ecs_entity_t entity);
3035
3052FLECS_API
3054 const ecs_world_t *world,
3055 ecs_entity_t e);
3056
3077FLECS_API
3079 ecs_world_t *world,
3080 ecs_entity_t entity);
3081
3100FLECS_API
3102 ecs_world_t *world,
3103 ecs_id_t id);
3104
3112FLECS_API
3114 const ecs_world_t *world,
3115 ecs_entity_t entity);
3116
3132FLECS_API
3134 const ecs_world_t *world,
3135 ecs_entity_t entity);
3136
3143FLECS_API
3145 const ecs_world_t *world,
3146 ecs_entity_t entity);
3147
3155FLECS_API
3157 const ecs_world_t *world,
3158 const ecs_type_t* type);
3159
3168FLECS_API
3170 const ecs_world_t *world,
3171 const ecs_table_t *table);
3172
3184FLECS_API
3186 const ecs_world_t *world,
3187 ecs_entity_t entity);
3188
3197FLECS_API
3199 const ecs_world_t *world,
3200 ecs_entity_t entity,
3201 ecs_id_t id);
3202
3213FLECS_API
3215 const ecs_world_t *world,
3216 ecs_entity_t entity,
3217 ecs_id_t id);
3218
3233FLECS_API
3235 const ecs_world_t *world,
3236 ecs_entity_t entity,
3237 ecs_entity_t rel,
3238 int32_t index);
3239
3251FLECS_API
3253 const ecs_world_t *world,
3254 ecs_entity_t entity);
3255
3276FLECS_API
3278 const ecs_world_t *world,
3279 ecs_entity_t entity,
3280 ecs_entity_t rel,
3281 ecs_id_t id);
3282
3293FLECS_API
3295 const ecs_world_t *world,
3296 ecs_entity_t entity,
3297 ecs_entity_t rel);
3298
3299typedef struct ecs_flatten_desc_t {
3300 /* When true, the flatten operation will not remove names from entities in
3301 * the flattened tree. This may fail if entities from different subtrees
3302 * have the same name. */
3303 bool keep_names;
3304
3305 /* When true, the flattened tree won't contain information about the
3306 * original depth of the entities. This can reduce fragmentation, but may
3307 * cause existing code, such as cascade queries, to no longer work. */
3308 bool lose_depth;
3310
3335FLECS_API
3337 ecs_world_t *world,
3338 ecs_id_t pair,
3339 const ecs_flatten_desc_t *desc);
3340
3348FLECS_API
3350 const ecs_world_t *world,
3351 ecs_id_t entity);
3352
3370FLECS_API
3371const char* ecs_get_name(
3372 const ecs_world_t *world,
3373 ecs_entity_t entity);
3374
3382FLECS_API
3383const char* ecs_get_symbol(
3384 const ecs_world_t *world,
3385 ecs_entity_t entity);
3386
3398FLECS_API
3400 ecs_world_t *world,
3401 ecs_entity_t entity,
3402 const char *name);
3403
3415FLECS_API
3417 ecs_world_t *world,
3418 ecs_entity_t entity,
3419 const char *symbol);
3420
3432FLECS_API
3434 ecs_world_t *world,
3435 ecs_entity_t entity,
3436 const char *alias);
3437
3446FLECS_API
3448 const ecs_world_t *world,
3449 const char *name);
3450
3460FLECS_API
3462 const ecs_world_t *world,
3463 ecs_entity_t parent,
3464 const char *name);
3465
3484FLECS_API
3486 const ecs_world_t *world,
3487 ecs_entity_t parent,
3488 const char *path,
3489 const char *sep,
3490 const char *prefix,
3491 bool recursive);
3492
3506FLECS_API
3508 const ecs_world_t *world,
3509 const char *symbol,
3510 bool lookup_as_path,
3511 bool recursive);
3512
3532FLECS_API
3534 const ecs_world_t *world,
3535 ecs_entity_t parent,
3536 ecs_entity_t child,
3537 const char *sep,
3538 const char *prefix);
3539
3551 const ecs_world_t *world,
3552 ecs_entity_t parent,
3553 ecs_entity_t child,
3554 const char *sep,
3555 const char *prefix,
3556 ecs_strbuf_t *buf);
3557
3573FLECS_API
3575 ecs_world_t *world,
3576 ecs_entity_t parent,
3577 const char *path,
3578 const char *sep,
3579 const char *prefix);
3580
3595FLECS_API
3597 ecs_world_t *world,
3598 ecs_entity_t entity,
3599 ecs_entity_t parent,
3600 const char *path,
3601 const char *sep,
3602 const char *prefix);
3603
3615FLECS_API
3617 ecs_world_t *world,
3618 ecs_entity_t scope);
3619
3627FLECS_API
3629 const ecs_world_t *world);
3630
3640FLECS_API
3642 ecs_world_t *world,
3643 const char *prefix);
3644
3669FLECS_API
3671 ecs_world_t *world,
3672 const ecs_entity_t *lookup_path);
3673
3680FLECS_API
3682 const ecs_world_t *world);
3683
3708FLECS_API
3710 ecs_world_t *world,
3711 const ecs_component_desc_t *desc);
3712
3722FLECS_API
3724 const ecs_world_t *world,
3725 ecs_id_t id);
3726
3738FLECS_API
3740 ecs_world_t *world,
3741 ecs_entity_t id,
3742 const ecs_type_hooks_t *hooks);
3743
3750FLECS_API
3752 ecs_world_t *world,
3753 ecs_entity_t id);
3754
3778FLECS_API
3780 const ecs_world_t *world,
3781 ecs_id_t id);
3782
3795FLECS_API
3797 const ecs_world_t *world,
3798 ecs_id_t id);
3799
3808FLECS_API
3810 const ecs_world_t *world,
3811 ecs_id_t id);
3812
3832FLECS_API
3834 const ecs_world_t *world,
3835 ecs_id_t id);
3836
3844FLECS_API
3846 ecs_id_t id,
3847 ecs_id_t pattern);
3848
3854FLECS_API
3856 ecs_id_t id);
3857
3863FLECS_API
3865 ecs_id_t id);
3866
3880FLECS_API
3882 const ecs_world_t *world,
3883 ecs_id_t id);
3884
3893FLECS_API
3894ecs_flags32_t ecs_id_get_flags(
3895 const ecs_world_t *world,
3896 ecs_id_t id);
3897
3904FLECS_API
3906 ecs_id_t id_flags);
3907
3915FLECS_API
3917 const ecs_world_t *world,
3918 ecs_id_t id);
3919
3927FLECS_API
3929 const ecs_world_t *world,
3930 ecs_id_t id,
3931 ecs_strbuf_t *buf);
3932
3951FLECS_API
3952ecs_iter_t ecs_term_iter(
3953 const ecs_world_t *world,
3954 ecs_term_t *term);
3955
3964FLECS_API
3966 const ecs_iter_t *it,
3967 ecs_term_t *term);
3968
3978FLECS_API
3980 ecs_iter_t *it);
3981
3990FLECS_API
3991ecs_iter_t ecs_children(
3992 const ecs_world_t *world,
3993 ecs_entity_t parent);
3994
4001FLECS_API
4003 ecs_iter_t *it);
4004
4010FLECS_API
4012 const ecs_term_id_t *id);
4013
4025FLECS_API
4027 const ecs_term_t *term);
4028
4043FLECS_API
4045 const ecs_term_t *term);
4046
4059FLECS_API
4061 const ecs_term_t *term);
4062
4081FLECS_API
4083 const ecs_world_t *world,
4084 ecs_term_t *term);
4085
4094FLECS_API
4096 const ecs_term_t *src);
4097
4108FLECS_API
4110 ecs_term_t *src);
4111
4118FLECS_API
4120 ecs_term_t *term);
4121
4149FLECS_API
4151 ecs_world_t *world,
4152 const ecs_filter_desc_t *desc);
4153
4159FLECS_API
4161 ecs_filter_t *filter);
4162
4176FLECS_API
4178 const ecs_world_t *world,
4179 ecs_filter_t *filter);
4180
4192FLECS_API
4194 const ecs_filter_t *filter);
4195
4204FLECS_API
4206 const ecs_world_t *world,
4207 const ecs_term_t *term);
4208
4217FLECS_API
4219 const ecs_world_t *world,
4220 const ecs_filter_t *filter);
4221
4230FLECS_API
4232 const ecs_world_t *world,
4233 const ecs_filter_t *filter);
4234
4243FLECS_API
4245 const ecs_iter_t *it,
4246 const ecs_filter_t *filter);
4247
4267FLECS_API
4269 const ecs_world_t *world,
4270 const ecs_filter_t *filter);
4271
4281FLECS_API
4283 ecs_iter_t *it);
4284
4291FLECS_API
4293 ecs_iter_t *it);
4294
4300FLECS_API
4302 ecs_filter_t *dst,
4303 ecs_filter_t *src);
4304
4310FLECS_API
4312 ecs_filter_t *dst,
4313 const ecs_filter_t *src);
4314
4358FLECS_API
4360 ecs_world_t *world,
4361 const ecs_query_desc_t *desc);
4362
4370FLECS_API
4372 ecs_query_t *query);
4373
4381FLECS_API
4383 const ecs_query_t *query);
4384
4412FLECS_API
4414 const ecs_world_t *world,
4415 ecs_query_t *query);
4416
4426FLECS_API
4428 ecs_iter_t *iter);
4429
4436FLECS_API
4438 ecs_iter_t *iter);
4439
4450FLECS_API
4452 ecs_iter_t *iter);
4453
4475FLECS_API
4477 ecs_iter_t *iter,
4478 bool when_changed);
4479
4509FLECS_API
4511 ecs_query_t *query,
4512 const ecs_iter_t *it);
4513
4524FLECS_API
4526 ecs_iter_t *it);
4527
4550FLECS_API
4552 ecs_iter_t *it,
4553 uint64_t group_id);
4554
4563FLECS_API
4565 const ecs_query_t *query,
4566 uint64_t group_id);
4567
4576FLECS_API
4578 const ecs_query_t *query,
4579 uint64_t group_id);
4580
4589FLECS_API
4591 const ecs_query_t *query);
4592
4598FLECS_API
4600 const ecs_query_t *query);
4601
4607FLECS_API
4609 const ecs_query_t *query);
4610
4616FLECS_API
4618 const ecs_query_t *query);
4619
4627FLECS_API
4629 const ecs_query_t *query);
4630
4637FLECS_API
4639 const ecs_query_t *query);
4640
4647FLECS_API
4649 const ecs_query_t *query);
4650
4677FLECS_API
4679 ecs_world_t *world,
4680 ecs_event_desc_t *desc);
4681
4682FLECS_API
4683void ecs_enqueue(
4684 ecs_world_t *world,
4685 ecs_event_desc_t *desc);
4686
4696FLECS_API
4698 ecs_world_t *world,
4699 const ecs_observer_desc_t *desc);
4700
4710FLECS_API
4712 ecs_iter_t *it);
4713
4721FLECS_API
4723 const ecs_world_t *world,
4724 ecs_entity_t observer);
4725
4733FLECS_API
4735 const ecs_world_t *world,
4736 ecs_entity_t observer);
4737
4768FLECS_API
4770 const ecs_world_t *world,
4771 const ecs_poly_t *poly,
4772 ecs_iter_t *iter,
4773 ecs_term_t *filter);
4774
4788FLECS_API
4790 ecs_iter_t *it);
4791
4801FLECS_API
4803 ecs_iter_t *it);
4804
4816FLECS_API
4818 ecs_iter_t *it);
4819
4832FLECS_API
4834 ecs_iter_t *it);
4835
4843FLECS_API
4845 ecs_iter_t *it);
4846
4882FLECS_API
4884 ecs_iter_t *it,
4885 int32_t var_id,
4886 ecs_entity_t entity);
4887
4895FLECS_API
4897 ecs_iter_t *it,
4898 int32_t var_id,
4899 const ecs_table_t *table);
4900
4908FLECS_API
4910 ecs_iter_t *it,
4911 int32_t var_id,
4912 const ecs_table_range_t *range);
4913
4926FLECS_API
4928 ecs_iter_t *it,
4929 int32_t var_id);
4930
4944FLECS_API
4946 ecs_iter_t *it,
4947 int32_t var_id);
4948
4962FLECS_API
4964 ecs_iter_t *it,
4965 int32_t var_id);
4966
4978FLECS_API
4980 ecs_iter_t *it,
4981 int32_t var_id);
4982
4994FLECS_API
4996 const ecs_iter_t *it);
4997
5013FLECS_API
5014ecs_iter_t ecs_page_iter(
5015 const ecs_iter_t *it,
5016 int32_t offset,
5017 int32_t limit);
5018
5025FLECS_API
5027 ecs_iter_t *it);
5028
5049FLECS_API
5051 const ecs_iter_t *it,
5052 int32_t index,
5053 int32_t count);
5054
5061FLECS_API
5063 ecs_iter_t *it);
5064
5088FLECS_API
5090 const ecs_iter_t *it,
5091 size_t size,
5092 int32_t index);
5093
5102FLECS_API
5104 const ecs_iter_t *it,
5105 int32_t index);
5106
5117FLECS_API
5119 const ecs_iter_t *it,
5120 int32_t index);
5121
5128FLECS_API
5130 const ecs_iter_t *it,
5131 int32_t index);
5132
5139FLECS_API
5141 const ecs_iter_t *it,
5142 int32_t index);
5143
5152FLECS_API
5154 const ecs_iter_t *it,
5155 int32_t index);
5156
5164FLECS_API
5166 const ecs_iter_t *it,
5167 int32_t index);
5168
5176FLECS_API
5178 const ecs_iter_t *it,
5179 int32_t index);
5180
5194FLECS_API
5196 const ecs_iter_t *it,
5197 int32_t index);
5198
5214FLECS_API
5216 const ecs_table_t *table);
5217
5226FLECS_API
5228 const ecs_world_t *world,
5229 const ecs_table_t *table,
5230 ecs_id_t id);
5231
5241FLECS_API
5243 const ecs_world_t *world,
5244 const ecs_table_t *table,
5245 ecs_id_t id);
5246
5254FLECS_API
5256 const ecs_table_t *table);
5257
5269FLECS_API
5271 const ecs_table_t *table,
5272 int32_t index);
5273
5282FLECS_API
5284 const ecs_table_t *table,
5285 int32_t index);
5286
5295FLECS_API
5297 const ecs_table_t *table,
5298 int32_t index,
5299 int32_t offset);
5300
5309FLECS_API
5311 const ecs_world_t *world,
5312 const ecs_table_t *table,
5313 ecs_id_t id,
5314 int32_t offset);
5315
5323FLECS_API
5325 const ecs_table_t *table,
5326 int32_t index);
5327
5336FLECS_API
5338 const ecs_table_t *table);
5339
5348FLECS_API
5350 const ecs_world_t *world,
5351 const ecs_table_t *table,
5352 ecs_id_t id);
5353
5364FLECS_API
5366 const ecs_world_t *world,
5367 const ecs_table_t *table,
5368 ecs_entity_t rel);
5369
5379FLECS_API
5381 ecs_world_t *world,
5382 ecs_table_t *table,
5383 ecs_id_t id);
5384
5395FLECS_API
5397 ecs_world_t *world,
5398 const ecs_id_t *ids,
5399 int32_t id_count);
5400
5410FLECS_API
5412 ecs_world_t *world,
5413 ecs_table_t *table,
5414 ecs_id_t id);
5415
5431FLECS_API
5433 ecs_world_t *world,
5434 ecs_table_t *table);
5435
5442FLECS_API
5444 ecs_world_t *world,
5445 ecs_table_t *table);
5446
5456FLECS_API
5458 ecs_table_t *table,
5459 ecs_flags32_t flags);
5460
5468FLECS_API
5470 ecs_world_t* world,
5471 ecs_table_t* table,
5472 int32_t row_1,
5473 int32_t row_2);
5474
5497FLECS_API
5499 ecs_world_t *world,
5500 ecs_entity_t entity,
5501 ecs_record_t *record,
5502 ecs_table_t *table,
5503 const ecs_type_t *added,
5504 const ecs_type_t *removed);
5505
5507FLECS_API
5509 const ecs_world_t *world,
5510 ecs_entity_t entity);
5511
5513FLECS_API
5515 const ecs_record_t *r,
5516 int32_t column,
5517 size_t c_size);
5518
5534FLECS_API
5536 const ecs_world_t *world,
5537 const ecs_table_t *table,
5538 ecs_id_t id,
5539 ecs_id_t *id_out);
5540
5573FLECS_API
5575 const ecs_world_t *world,
5576 const ecs_table_t *table,
5577 int32_t offset,
5578 ecs_id_t id,
5579 ecs_id_t *id_out);
5580
5619FLECS_API
5621 const ecs_world_t *world,
5622 const ecs_table_t *table,
5623 int32_t offset,
5624 ecs_id_t id,
5625 ecs_entity_t rel,
5626 ecs_flags32_t flags, /* EcsSelf and/or EcsUp */
5627 ecs_entity_t *subject_out,
5628 ecs_id_t *id_out,
5629 struct ecs_table_record_t **tr_out);
5630
5647FLECS_API
5649 const ecs_world_t *world,
5650 ecs_entity_t type,
5651 void *ptr);
5652
5660FLECS_API
5662 const ecs_world_t *world,
5663 const ecs_type_info_t *ti,
5664 void *ptr);
5665
5672FLECS_API
5674 ecs_world_t *world,
5675 ecs_entity_t type);
5676
5684 ecs_world_t *world,
5685 const ecs_type_info_t *ti);
5686
5695 const ecs_world_t *world,
5696 const ecs_type_info_t *ti,
5697 void *ptr);
5698
5706FLECS_API
5708 const ecs_world_t *world,
5709 ecs_entity_t type,
5710 void* ptr);
5711
5718FLECS_API
5720 ecs_world_t *world,
5721 ecs_entity_t type,
5722 void* ptr);
5723
5732FLECS_API
5734 const ecs_world_t *world,
5735 const ecs_type_info_t *ti,
5736 void* dst,
5737 const void *src);
5738
5747FLECS_API
5749 const ecs_world_t *world,
5750 ecs_entity_t type,
5751 void* dst,
5752 const void *src);
5753
5763 const ecs_world_t *world,
5764 const ecs_type_info_t *ti,
5765 void* dst,
5766 void *src);
5767
5777 const ecs_world_t *world,
5778 ecs_entity_t type,
5779 void* dst,
5780 void *src);
5781
5791 const ecs_world_t *world,
5792 const ecs_type_info_t *ti,
5793 void* dst,
5794 void *src);
5795
5805 const ecs_world_t *world,
5806 ecs_entity_t type,
5807 void* dst,
5808 void *src);
5809
5823#include "flecs/addons/flecs_c.h"
5824
5825#ifdef __cplusplus
5826}
5827#endif
5828
5829#include "flecs/private/addons.h"
5830
5831#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.
struct EcsTarget EcsTarget
Target data for flattened relationships.
struct EcsIdentifier EcsIdentifier
A (string) identifier.
ecs_iterable_t EcsIterable
Component for iterable entities.
Definition flecs.h:1308
struct EcsPoly EcsPoly
Component for storing a poly object.
struct EcsComponent EcsComponent
Component information.
const ecs_entity_t EcsOnRemove
Event that triggers when an id is removed from an entity.
const ecs_entity_t EcsThis
This entity.
const ecs_entity_t EcsWildcard
Wildcard entity ("*").
const ecs_entity_t EcsName
Tag to indicate name identifier.
const ecs_entity_t EcsAcyclic
Marks a relationship as acyclic.
const ecs_entity_t EcsSymmetric
Marks relationship as commutative.
const ecs_entity_t EcsAlias
Tag to indicate alias identifier.
const ecs_entity_t EcsOnSet
Event that triggers when a component is set for an entity.
const ecs_entity_t EcsReflexive
Marks a relationship as reflexive.
const ecs_entity_t 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 auto-merging 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.
struct ecs_component_desc_t ecs_component_desc_t
Used with ecs_component_init().
const ecs_type_info_t * ecs_get_type_info(const ecs_world_t *world, ecs_id_t id)
Get the type for an id.
struct ecs_header_t ecs_header_t
Header for ecs_poly_t objects.
struct ecs_ref_t ecs_ref_t
A ref is a fast way to fetch a component for a specific entity.
Definition flecs.h:445
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:305
struct ecs_rule_t ecs_rule_t
A rule is a query with advanced graph traversal features.
Definition flecs.h:403
struct ecs_table_record_t ecs_table_record_t
Information about where in a table a specific (component) id is stored.
Definition flecs.h:464
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:461
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition flecs.h:349
struct ecs_mixins_t ecs_mixins_t
Type that stores poly mixins.
Definition flecs.h:491
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
Definition flecs.h:298
struct ecs_query_t ecs_query_t
A query that caches its results.
Definition flecs.h:381
struct ecs_observable_t ecs_observable_t
An observable produces events that can be listened for by an observer.
Definition flecs.h:428
struct ecs_record_t ecs_record_t
Information about an entity, like its table and row.
Definition flecs.h:458
struct ecs_table_t ecs_table_t
A table stores entities and components for a specific type.
Definition flecs.h:352
void ecs_poly_t
A poly object.
Definition flecs.h:488
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.
struct ecs_bulk_desc_t ecs_bulk_desc_t
Used with ecs_bulk_init().
struct ecs_entity_desc_t ecs_entity_desc_t
Used with ecs_entity_init().
char * ecs_entity_str(const ecs_world_t *world, ecs_entity_t entity)
Convert entity to string.
ecs_entity_t ecs_get_target(const ecs_world_t *world, ecs_entity_t entity, ecs_entity_t rel, int32_t index)
Get the target of a relationship.
ecs_entity_t ecs_get_parent(const ecs_world_t *world, ecs_entity_t entity)
Get parent (target of ChildOf relationship) for entity.
const ecs_type_t * ecs_get_type(const ecs_world_t *world, ecs_entity_t entity)
Get the type of an entity.
bool ecs_has_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Test if an entity has an id.
char * ecs_type_str(const ecs_world_t *world, const ecs_type_t *type)
Convert type to string.
char * ecs_table_str(const ecs_world_t *world, const ecs_table_t *table)
Convert table to string.
int32_t ecs_count_id(const ecs_world_t *world, ecs_id_t entity)
Count entities that have the specified id.
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.
struct ecs_filter_desc_t ecs_filter_desc_t
Used with ecs_filter_init().
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:604
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:584
uint64_t(* ecs_hash_value_action_t)(const void *ptr)
Callback used for hashing values.
Definition flecs.h:622
void(* ecs_iter_fini_action_t)(ecs_iter_t *it)
Function prototype for freeing an iterator.
Definition flecs.h:562
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:573
bool(* ecs_iter_next_action_t)(ecs_iter_t *it)
Function prototype for iterating an iterator.
Definition flecs.h:554
void(* ecs_iter_action_t)(ecs_iter_t *it)
Function prototype for iterables.
Definition flecs.h:527
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:632
int(* ecs_compare_action_t)(const void *ptr1, const void *ptr2)
Callback used for sorting values.
Definition flecs.h:617
void(* ecs_fini_action_t)(ecs_world_t *world, void *ctx)
Action callback on world exit.
Definition flecs.h:608
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:639
void(* ecs_run_action_t)(ecs_iter_t *it)
Function prototype for runnables (systems, observers).
Definition flecs.h:518
void(* ecs_ctx_free_t)(void *ctx)
Function to cleanup context data.
Definition flecs.h:613
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:566
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:541
void(* ecs_xtor_t)(void *ptr, int32_t count, const ecs_type_info_t *type_info)
Constructor/destructor callback.
Definition flecs.h:626
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.
const void * ecs_record_get_id(const ecs_world_t *world, const ecs_record_t *record, ecs_id_t id)
Get component from entity record.
void ecs_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.
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 + modified 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 en...
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.
struct ecs_world_info_t ecs_world_info_t
Type that contains information about the world.
struct ecs_query_group_info_t ecs_query_group_info_t
Type that contains information about a query group.
struct ecs_iterable_t ecs_iterable_t
Iterable mixin.
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.
struct ecs_event_desc_t ecs_event_desc_t
Used with ecs_emit().
bool ecs_observer_default_run_action(ecs_iter_t *it)
Default run action for observer.
struct ecs_observer_desc_t ecs_observer_desc_t
Used with ecs_observer_init().
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:253
#define FLECS_EVENT_DESC_MAX
Maximum number of events in ecs_observer_desc_t.
Definition flecs.h:257
#define ecs_ftime_t
Customizable precision for scalar time values.
Definition flecs.h:43
#define FLECS_ID_DESC_MAX
Maximum number of ids to add ecs_entity_desc_t / ecs_bulk_desc_t.
Definition flecs.h:248
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.
struct ecs_query_desc_t ecs_query_desc_t
Used with ecs_query_init().
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:674
ecs_oper_kind_t
Specify operator for term.
Definition flecs.h:683
struct ecs_term_id_t ecs_term_id_t
Type that describes a single identifier in a term.
ecs_filter_t ECS_FILTER_INIT
Use $this variable to initialize user-allocated filter object.
@ EcsOut
Term is only written.
Definition flecs.h:679
@ EcsInOut
Term is both read and written.
Definition flecs.h:677
@ EcsInOutDefault
InOut for regular terms, In for shared terms.
Definition flecs.h:675
@ EcsInOutNone
Term is neither read nor written.
Definition flecs.h:676
@ EcsIn
Term is only read.
Definition flecs.h:678
@ EcsNot
The term must not match.
Definition flecs.h:686
@ EcsOptional
The term may match.
Definition flecs.h:687
@ EcsOr
One of the terms in an or chain must match.
Definition flecs.h:685
@ EcsOrFrom
Term must match at least one component from term id.
Definition flecs.h:689
@ EcsAnd
The term must match.
Definition flecs.h:684
@ EcsNotFrom
Term must match none of the components from term id.
Definition flecs.h:690
@ EcsAndFrom
Term must match all components from term id.
Definition flecs.h:688
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 a 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 issuing new entity ids.
const ecs_world_info_t * ecs_get_world_info(const ecs_world_t *world)
Get world info.
const ecs_world_t * ecs_get_world(const ecs_poly_t *poly)
Get world from poly.
void ecs_set_ctx(ecs_world_t *world, void *ctx, ecs_ctx_free_t ctx_free)
Set a world context.
int32_t ecs_delete_empty_tables(ecs_world_t *world, ecs_id_t id, uint16_t clear_generation, uint16_t delete_generation, int32_t min_id_count, double time_budget_seconds)
Cleanup empty tables.
void ecs_set_binding_ctx(ecs_world_t *world, void *ctx, ecs_ctx_free_t ctx_free)
Set a world binding context.
bool ecs_enable_range_check(ecs_world_t *world, bool enable)
Enable/disable range limits.
void * ecs_get_ctx(const ecs_world_t *world)
Get the world context.
Operating system abstraction API.
Component information.
Definition flecs.h:1291
ecs_size_t size
Component size.
Definition flecs.h:1292
ecs_size_t alignment
Component alignment.
Definition flecs.h:1293
A (string) identifier.
Definition flecs.h:1282
ecs_size_t length
Length of identifier.
Definition flecs.h:1284
char * value
Identifier string.
Definition flecs.h:1283
ecs_hashmap_t * index
Current index.
Definition flecs.h:1287
uint64_t hash
Hash of current value.
Definition flecs.h:1285
uint64_t index_hash
Hash of existing record in current index.
Definition flecs.h:1286
Component for storing a poly object.
Definition flecs.h:1297
ecs_poly_t * poly
Pointer to poly object.
Definition flecs.h:1298
Apply a rate filter to a tick source.
Definition timer.h:45
Target data for flattened relationships.
Definition flecs.h:1302
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:943
void ** data
Array with component data to insert.
Definition flecs.h:955
ecs_id_t ids[(32)]
Ids to create the entities with.
Definition flecs.h:953
int32_t count
Number of entities to create/populate.
Definition flecs.h:951
ecs_entity_t * entities
Entities to bulk insert.
Definition flecs.h:946
ecs_table_t * table
Table to insert the entities into.
Definition flecs.h:962
Used with ecs_component_init().
Definition flecs.h:973
ecs_type_info_t type
Parameters for type (size, hooks, ...)
Definition flecs.h:980
ecs_entity_t entity
Existing entity to associate with observer (optional)
Definition flecs.h:977
Used with ecs_entity_init().
Definition flecs.h:902
const char * sep
Optional custom separator for hierarchical names.
Definition flecs.h:912
const char * root_sep
Optional, used for identifiers relative to root.
Definition flecs.h:916
const char * name
Name of the entity.
Definition flecs.h:907
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:928
ecs_id_t add[(32)]
Array of ids to add to the new or existing entity.
Definition flecs.h:933
const char * symbol
Optional entity symbol.
Definition flecs.h:918
const char * add_expr
String expression with components to add.
Definition flecs.h:936
ecs_entity_t id
Set to modify existing entity (optional)
Definition flecs.h:905
Used with ecs_emit().
Definition flecs.h:1148
ecs_entity_t entity
Single-entity alternative to setting table / offset / count.
Definition flecs.h:1173
ecs_table_t * table
The table for which to notify.
Definition flecs.h:1158
int32_t count
Limit number of notified entities to count.
Definition flecs.h:1170
ecs_table_t * other_table
Optional 2nd table to notify.
Definition flecs.h:1162
int32_t offset
Limit notified entities to ones starting from offset (row) in table.
Definition flecs.h:1165
const ecs_type_t * ids
Component ids.
Definition flecs.h:1155
ecs_poly_t * observable
Observable (usually the world)
Definition flecs.h:1187
ecs_entity_t event
The event id.
Definition flecs.h:1150
ecs_flags32_t flags
Event flags.
Definition flecs.h:1190
void * param
Optional context.
Definition flecs.h:1179
Used with ecs_filter_init().
Definition flecs.h:987
ecs_term_t * terms_buffer
For filters with lots of terms an outside array can be provided.
Definition flecs.h:995
bool instanced
When true, terms returned by an iterator may either contain 1 or N elements, where terms with N eleme...
Definition flecs.h:1008
ecs_term_t terms[(16)]
Terms of the filter.
Definition flecs.h:992
int32_t terms_buffer_count
Number of terms in array provided in terms_buffer.
Definition flecs.h:998
ecs_entity_t entity
Entity associated with query (optional)
Definition flecs.h:1017
ecs_flags32_t flags
Flags for advanced usage.
Definition flecs.h:1011
ecs_filter_t * storage
External storage to prevent allocation of the filter object.
Definition flecs.h:1001
const char * expr
Filter expression.
Definition flecs.h:1014
Filters allow for ad-hoc quick filtering of entity tables.
Definition flecs.h:773
ecs_term_t * terms
Array containing terms for filter.
Definition flecs.h:781
ecs_id_t * ids
Array with field ids.
Definition flecs.h:784
int32_t * sizes
Field size (same for each result)
Definition flecs.h:783
int8_t term_count
Number of elements in terms array.
Definition flecs.h:776
ecs_flags64_t data_fields
Bitset with fields that have data.
Definition flecs.h:779
ecs_flags32_t flags
Filter flags.
Definition flecs.h:778
ecs_world_t * world
World mixin.
Definition flecs.h:790
int8_t field_count
Number of fields in iterator for filter.
Definition flecs.h:777
char * variable_names[1]
Placeholder variable names array.
Definition flecs.h:782
ecs_poly_dtor_t dtor
Dtor mixin.
Definition flecs.h:789
ecs_entity_t entity
Entity associated with filter (optional)
Definition flecs.h:787
ecs_iterable_t iterable
Iterable mixin.
Definition flecs.h:788
Header for ecs_poly_t objects.
Definition flecs.h:494
Iterable mixin.
Definition flecs.h:660
ecs_iter_init_action_t init
Callback that creates iterator.
Definition flecs.h:661
Used with ecs_observer_init().
Definition flecs.h:1093
void * binding_ctx
Context to be used for language bindings.
Definition flecs.h:1125
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:1128
ecs_entity_t entity
Existing entity to associate with observer (optional)
Definition flecs.h:1097
ecs_filter_desc_t filter
Filter for observer.
Definition flecs.h:1100
int32_t term_index
Used for internal purposes.
Definition flecs.h:1141
ecs_entity_t events[(8)]
Events to observe (OnAdd, OnRemove, OnSet, UnSet)
Definition flecs.h:1103
int32_t * last_event_id
Optional shared last event id for multiple observers.
Definition flecs.h:1138
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:1131
void * ctx
User context to pass to callback.
Definition flecs.h:1122
ecs_poly_t * observable
Observable with which to register the observer.
Definition flecs.h:1134
ecs_iter_action_t callback
Callback to invoke on an event, invoked when the observer matches.
Definition flecs.h:1111
bool yield_existing
When observer is created, generate events from existing data.
Definition flecs.h:1108
ecs_run_action_t run
Callback invoked on an event.
Definition flecs.h:1119
ecs_iter_action_t callback
See ecs_observer_desc_t::callback.
Definition flecs.h:803
int32_t term_index
Index of the term in parent observer (single term observers only)
Definition flecs.h:818
ecs_observable_t * observable
Observable for observer.
Definition flecs.h:812
ecs_run_action_t run
See ecs_observer_desc_t::run.
Definition flecs.h:804
int32_t * last_event_id
Last handled event id.
Definition flecs.h:814
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:809
ecs_filter_t filter
Query for observer.
Definition flecs.h:797
void * ctx
Callback context.
Definition flecs.h:806
ecs_id_t register_id
Id observer is registered with (single term observers only)
Definition flecs.h:817
void * binding_ctx
Binding context (for language bindings)
Definition flecs.h:807
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:820
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:810
bool is_multi
If true, the observer triggers on more than one term.
Definition flecs.h:824
Used with ecs_query_init().
Definition flecs.h:1024
ecs_order_by_action_t order_by
Callback used for ordering query results.
Definition flecs.h:1036
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:1083
ecs_id_t group_by_id
Id to be used by group_by.
Definition flecs.h:1045
ecs_group_by_action_t group_by
Callback used for grouping results.
Definition flecs.h:1052
void * ctx
User context to pass to callback.
Definition flecs.h:1077
ecs_ctx_free_t group_by_ctx_free
Function to free group_by_ctx.
Definition flecs.h:1066
void * group_by_ctx
Context to pass to group_by.
Definition flecs.h:1063
void * binding_ctx
Context to be used for language bindings.
Definition flecs.h:1080
ecs_group_create_action_t on_group_create
Callback that is invoked when a new group is created.
Definition flecs.h:1056
ecs_query_t * parent
If set, the query will be created as a subquery.
Definition flecs.h:1074
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:1086
ecs_entity_t order_by_component
Component to be used by order_by.
Definition flecs.h:1031
ecs_filter_desc_t filter
Filter for the query.
Definition flecs.h:1028
ecs_group_delete_action_t on_group_delete
Callback that is invoked when an existing group is deleted.
Definition flecs.h:1060
ecs_sort_table_action_t sort_table
Callback used for ordering query results.
Definition flecs.h:1040
Type that contains information about a query group.
Definition flecs.h:1266
int32_t table_count
Number of tables in group.
Definition flecs.h:1268
void * ctx
Group context, returned by on_group_create.
Definition flecs.h:1269
int32_t match_count
How often tables have been matched/unmatched.
Definition flecs.h:1267
Type that describes a single identifier in a term.
Definition flecs.h:724
ecs_flags32_t flags
Term flags.
Definition flecs.h:741
ecs_entity_t trav
Relationship to traverse when looking for the component.
Definition flecs.h:737
const char * name
Name.
Definition flecs.h:731
ecs_entity_t id
Entity id.
Definition flecs.h:725
Type that describes a term (single element in a query)
Definition flecs.h:745
ecs_term_id_t second
Second element of pair.
Definition flecs.h:753
ecs_id_t id
Component id to be matched by term.
Definition flecs.h:746
char * name
Name of term.
Definition flecs.h:759
ecs_term_id_t src
Source of term.
Definition flecs.h:751
ecs_id_record_t * idr
Cached pointer to internal index.
Definition flecs.h:762
ecs_term_id_t first
Component or first element of pair.
Definition flecs.h:752
int32_t field_index
Index of field for term in iterator.
Definition flecs.h:761
ecs_id_t id_flags
Id flags of term id.
Definition flecs.h:758
bool move
Used by internals.
Definition flecs.h:766
ecs_flags16_t flags
Flags that help eval, set by ecs_filter_init.
Definition flecs.h:764
ecs_inout_kind_t inout
Access to contents matched by term.
Definition flecs.h:755
ecs_oper_kind_t oper
Operator of term.
Definition flecs.h:756
Type that contains component lifecycle callbacks.
Definition flecs.h:836
ecs_copy_t copy_ctor
Ctor + copy.
Definition flecs.h:843
void * ctx
User defined context.
Definition flecs.h:874
ecs_iter_action_t on_remove
Callback that is invoked when an instance of the component is removed.
Definition flecs.h:872
void * binding_ctx
Language binding context.
Definition flecs.h:875
ecs_move_t move_dtor
Move + dtor.
Definition flecs.h:858
ecs_copy_t copy
copy assignment
Definition flecs.h:839
ecs_iter_action_t on_set
Callback that is invoked when an instance of the component is set.
Definition flecs.h:867
ecs_move_t move
move assignment
Definition flecs.h:840
ecs_xtor_t ctor
ctor
Definition flecs.h:837
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:877
ecs_iter_action_t on_add
Callback that is invoked when an instance of a component is added.
Definition flecs.h:862
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:878
ecs_move_t move_ctor
Ctor + move.
Definition flecs.h:846
ecs_move_t ctor_move_dtor
Ctor + move + dtor (or move_ctor + dtor).
Definition flecs.h:852
ecs_xtor_t dtor
dtor
Definition flecs.h:838
Type that contains component information (passed to ctors/dtors/...)
Definition flecs.h:885
ecs_size_t alignment
Alignment of type.
Definition flecs.h:887
ecs_size_t size
Size of type.
Definition flecs.h:886
const char * name
Type name.
Definition flecs.h:890
ecs_entity_t component
Handle to component (do not set)
Definition flecs.h:889
ecs_type_hooks_t hooks
Type hooks.
Definition flecs.h:888
A type is a list of (component) ids.
Definition flecs.h:322
Type that contains information about the world.
Definition flecs.h:1208
int64_t get_mut_count
get_mut/emplace commands processed
Definition flecs.h:1251
float delta_time
Time passed to or computed by ecs_progress.
Definition flecs.h:1214
ecs_entity_t min_id
First allowed entity id.
Definition flecs.h:1210
int64_t set_count
set commands processed
Definition flecs.h:1250
float world_time_total
Time elapsed in simulation.
Definition flecs.h:1221
int32_t tag_id_count
Number of tag (no data) ids in the world.
Definition flecs.h:1237
int32_t component_id_count
Number of component (data) ids in the world.
Definition flecs.h:1238
int64_t pipeline_build_count_total
Total number of pipeline builds.
Definition flecs.h:1233
int32_t table_count
Number of tables.
Definition flecs.h:1241
float delta_time_raw
Raw delta time (no time scaling)
Definition flecs.h:1213
float frame_time_total
Total time spent processing a frame.
Definition flecs.h:1217
float world_time_total_raw
Time elapsed in simulation (no scaling)
Definition flecs.h:1222
int64_t table_create_total
Total number of times a table was created.
Definition flecs.h:1231
int64_t observers_ran_frame
Total number of times observer was invoked.
Definition flecs.h:1235
float system_time_total
Total time spent in systems.
Definition flecs.h:1218
int64_t id_delete_total
Total number of times an id was deleted.
Definition flecs.h:1230
int64_t systems_ran_frame
Total number of systems ran in last frame.
Definition flecs.h:1234
float merge_time_total
Total time spent in merges.
Definition flecs.h:1220
int64_t discard_count
commands discarded, happens when entity is no longer alive when running the command
Definition flecs.h:1254
int64_t clear_count
clear commands processed
Definition flecs.h:1249
ecs_entity_t last_component_id
Last issued component entity id.
Definition flecs.h:1209
int32_t empty_table_count
Number of tables without entities.
Definition flecs.h:1242
int64_t frame_count_total
Total number of frames.
Definition flecs.h:1225
ecs_entity_t max_id
Last allowed entity id.
Definition flecs.h:1211
int64_t merge_count_total
Total number of merges.
Definition flecs.h:1226
int64_t other_count
other commands processed
Definition flecs.h:1253
int64_t batched_command_count
commands batched
Definition flecs.h:1256
int64_t table_delete_total
Total number of times a table was deleted.
Definition flecs.h:1232
int64_t delete_count
delete commands processed
Definition flecs.h:1248
int64_t rematch_count_total
Total number of rematches.
Definition flecs.h:1227
int64_t id_create_total
Total number of times a new id was created.
Definition flecs.h:1229
int64_t batched_entity_count
entities for which commands were batched
Definition flecs.h:1255
float time_scale
Time scale applied to delta_time.
Definition flecs.h:1215
int32_t pair_id_count
Number of pair ids in the world.
Definition flecs.h:1239
float rematch_time_total
Time spent on query rematching.
Definition flecs.h:1223
float target_fps
Target fps.
Definition flecs.h:1216
float emit_time_total
Total time spent notifying observers.
Definition flecs.h:1219
int64_t modified_count
modified commands processed
Definition flecs.h:1252
const char * name_prefix
Value set by ecs_set_name_prefix().
Definition flecs.h:1259
int64_t add_count
add commands processed
Definition flecs.h:1246
int64_t remove_count
remove commands processed
Definition flecs.h:1247