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
33/* Flecs version macro */
34#define FLECS_VERSION_MAJOR 3
35#define FLECS_VERSION_MINOR 2
36#define FLECS_VERSION_PATCH 12
37#define FLECS_VERSION FLECS_VERSION_IMPL(\
38 FLECS_VERSION_MAJOR, FLECS_VERSION_MINOR, FLECS_VERSION_PATCH)
39
43#ifdef FLECS_CONFIG_HEADER
44#include "flecs_config.h"
45#endif
46
49#ifndef ecs_float_t
50#define ecs_float_t float
51#endif
52
56#ifndef ecs_ftime_t
57#define ecs_ftime_t ecs_float_t
58#endif
59
63// #define FLECS_LEGACY
64
68#define FLECS_NO_DEPRECATED_WARNINGS
69
75// #define FLECS_ACCURATE_COUNTERS
76
77/* Make sure provided configuration is valid */
78#if defined(FLECS_DEBUG) && defined(FLECS_NDEBUG)
79#error "invalid configuration: cannot both define FLECS_DEBUG and FLECS_NDEBUG"
80#endif
81#if defined(FLECS_DEBUG) && defined(NDEBUG)
82#error "invalid configuration: cannot both define FLECS_DEBUG and NDEBUG"
83#endif
84
89#if !defined(FLECS_DEBUG) && !defined(FLECS_NDEBUG)
90#if defined(NDEBUG)
91#define FLECS_NDEBUG
92#else
93#define FLECS_DEBUG
94#endif
95#endif
96
101#ifdef FLECS_SANITIZE
102#ifndef FLECS_DEBUG
103#define FLECS_DEBUG /* If sanitized mode is enabled, so is debug mode */
104#endif
105#endif
106
107/* Tip: if you see weird behavior that you think might be a bug, make sure to
108 * test with the FLECS_DEBUG or FLECS_SANITIZE flags enabled. There's a good
109 * chance that this gives you more information about the issue! */
110
124// #define FLECS_SOFT_ASSERT
125
131// #define FLECS_KEEP_ASSERT
132
160// #define FLECS_CUSTOM_BUILD
161
170// #define FLECS_CPP_NO_AUTO_REGISTRATION
171
172#ifndef FLECS_CUSTOM_BUILD
173// #define FLECS_C /**< C API convenience macros, always enabled */
174#define FLECS_CPP
175#define FLECS_MODULE
176#define FLECS_PARSER
177#define FLECS_PLECS
178#define FLECS_RULES
179#define FLECS_SNAPSHOT
180#define FLECS_STATS
181#define FLECS_MONITOR
182#define FLECS_METRICS
183#define FLECS_ALERTS
184#define FLECS_SYSTEM
185#define FLECS_PIPELINE
186#define FLECS_TIMER
187#define FLECS_META
188#define FLECS_META_C
189#define FLECS_UNITS
190#define FLECS_EXPR
191#define FLECS_JSON
192#define FLECS_DOC
193#define FLECS_LOG
194#define FLECS_APP
195#define FLECS_OS_API_IMPL
196#define FLECS_HTTP
197#define FLECS_REST
198// #define FLECS_JOURNAL /**< Journaling addon (disabled by default) */
199#endif // ifndef FLECS_CUSTOM_BUILD
200
204// #define FLECS_LOW_FOOTPRINT
205#ifdef FLECS_LOW_FOOTPRINT
206#define FLECS_HI_COMPONENT_ID (16)
207#define FLECS_HI_ID_RECORD_ID (16)
208#define FLECS_SPARSE_PAGE_BITS (6)
209#define FLECS_ENTITY_PAGE_BITS (6)
210#define FLECS_USE_OS_ALLOC
211#endif
212
223#ifndef FLECS_HI_COMPONENT_ID
224#define FLECS_HI_COMPONENT_ID (256)
225#endif
226
233#ifndef FLECS_HI_ID_RECORD_ID
234#define FLECS_HI_ID_RECORD_ID (1024)
235#endif
236
242#ifndef FLECS_SPARSE_PAGE_BITS
243#define FLECS_SPARSE_PAGE_BITS (12)
244#endif
245
248#ifndef FLECS_ENTITY_PAGE_BITS
249#define FLECS_ENTITY_PAGE_BITS (12)
250#endif
251
256// #define FLECS_USE_OS_ALLOC
257
260#ifndef FLECS_ID_DESC_MAX
261#define FLECS_ID_DESC_MAX (32)
262#endif
263
266#define FLECS_TERM_DESC_MAX (16)
267
270#define FLECS_EVENT_DESC_MAX (8)
271
274#define FLECS_VARIABLE_COUNT_MAX (64)
275
278#define FLECS_QUERY_SCOPE_NESTING_MAX (8)
279
282#include "flecs/private/api_defines.h"
283#include "flecs/private/vec.h" /* Vector datatype */
284#include "flecs/private/sparse.h" /* Sparse set */
285#include "flecs/private/block_allocator.h" /* Block allocator */
286#include "flecs/private/map.h" /* Map */
287#include "flecs/private/allocator.h" /* Allocator */
288#include "flecs/private/strbuf.h" /* String builder */
289#include "flecs/os_api.h" /* Abstraction for operating system functions */
290
291#ifdef __cplusplus
292extern "C" {
293#endif
294
311typedef uint64_t ecs_id_t;
312
319
335typedef struct {
336 ecs_id_t *array;
337 int32_t count;
338} ecs_type_t;
339
363
366
368typedef struct ecs_term_t ecs_term_t;
369
375
395
416typedef struct ecs_rule_t ecs_rule_t;
417
437
442
443/* Type used for iterating iterable objects.
444 * Iterators are a common interface across iterable objects (world, filters,
445 * rules, queries, systems, observers) to provide applications with information
446 * about the currently iterated result, and to store any state required for the
447 * iteration. */
448typedef struct ecs_iter_t ecs_iter_t;
449
458typedef struct ecs_ref_t ecs_ref_t;
459
464
469
472
475
478
501typedef void ecs_poly_t;
502
505
507typedef struct ecs_header_t {
508 int32_t magic; /* Magic number verifying it's a flecs object */
509 int32_t type; /* Magic number indicating which type of flecs object */
510 ecs_mixins_t *mixins; /* Table with offsets to (optional) mixins */
512
531typedef void (*ecs_run_action_t)(
532 ecs_iter_t *it);
533
540typedef void (*ecs_iter_action_t)(
541 ecs_iter_t *it);
542
555 const ecs_world_t *world,
556 const ecs_poly_t *iterable,
557 ecs_iter_t *it,
558 ecs_term_t *filter);
559
568 ecs_iter_t *it);
569
576 ecs_iter_t *it);
577
580 ecs_entity_t e1,
581 const void *ptr1,
582 ecs_entity_t e2,
583 const void *ptr2);
584
587 ecs_world_t* world,
588 ecs_table_t* table,
589 ecs_entity_t* entities,
590 void* ptr,
591 int32_t size,
592 int32_t lo,
593 int32_t hi,
594 ecs_order_by_action_t order_by);
595
597typedef uint64_t (*ecs_group_by_action_t)(
598 ecs_world_t *world,
599 ecs_table_t *table,
600 ecs_id_t group_id,
601 void *ctx);
602
603/* Callback invoked when a query creates a new group. */
604typedef void* (*ecs_group_create_action_t)(
605 ecs_world_t *world,
606 uint64_t group_id,
607 void *group_by_ctx); /* from ecs_query_desc_t */
608
609/* Callback invoked when a query deletes an existing group. */
610typedef void (*ecs_group_delete_action_t)(
611 ecs_world_t *world,
612 uint64_t group_id,
613 void *group_ctx, /* return value from ecs_group_create_action_t */
614 void *group_by_ctx); /* from ecs_query_desc_t */
615
617typedef void (*ecs_module_action_t)(
618 ecs_world_t *world);
619
621typedef void (*ecs_fini_action_t)(
622 ecs_world_t *world,
623 void *ctx);
624
626typedef void (*ecs_ctx_free_t)(
627 void *ctx);
628
630typedef int (*ecs_compare_action_t)(
631 const void *ptr1,
632 const void *ptr2);
633
635typedef uint64_t (*ecs_hash_value_action_t)(
636 const void *ptr);
637
639typedef void (*ecs_xtor_t)(
640 void *ptr,
641 int32_t count,
642 const ecs_type_info_t *type_info);
643
645typedef void (*ecs_copy_t)(
646 void *dst_ptr,
647 const void *src_ptr,
648 int32_t count,
649 const ecs_type_info_t *type_info);
650
652typedef void (*ecs_move_t)(
653 void *dst_ptr,
654 void *src_ptr,
655 int32_t count,
656 const ecs_type_info_t *type_info);
657
658/* Destructor function for poly objects */
659typedef void (*ecs_poly_dtor_t)(
660 ecs_poly_t *poly);
661
676
694
705
706/* Term id flags */
707#define EcsSelf (1u << 1)
708#define EcsUp (1u << 2)
709#define EcsDown (1u << 3)
710#define EcsTraverseAll (1u << 4)
711#define EcsCascade (1u << 5)
712#define EcsDesc (1u << 6)
713#define EcsParent (1u << 7)
714#define EcsIsVariable (1u << 8)
715#define EcsIsEntity (1u << 9)
716#define EcsIsName (1u << 10)
717#define EcsFilter (1u << 11)
718#define EcsTraverseFlags (EcsUp|EcsDown|EcsTraverseAll|EcsSelf|EcsCascade|EcsDesc|EcsParent)
719
720/* Term flags discovered & set during filter creation. Mostly used internally to
721 * store information relevant to queries. */
722#define EcsTermMatchAny (1u << 0)
723#define EcsTermMatchAnySrc (1u << 1)
724#define EcsTermSrcFirstEq (1u << 2)
725#define EcsTermSrcSecondEq (1u << 3)
726#define EcsTermTransitive (1u << 4)
727#define EcsTermReflexive (1u << 5)
728#define EcsTermIdInherited (1u << 6)
729#define EcsTermIsTrivial (1u << 7)
730#define EcsTermNoData (1u << 8)
731
732/* Term flags used for term iteration */
733#define EcsTermMatchDisabled (1u << 7)
734#define EcsTermMatchPrefab (1u << 8)
735
756
781
783FLECS_API extern ecs_filter_t ECS_FILTER_INIT;
784
787 ecs_header_t hdr;
788
789 int8_t term_count;
790 int8_t field_count;
791 ecs_flags32_t flags;
792 ecs_flags64_t data_fields;
795 char *variable_names[1];
796 int32_t *sizes;
799 int32_t eval_count;
801 /* Mixins */
804 ecs_poly_dtor_t dtor;
806};
807
808/* An observer reacts to events matching a filter */
810 ecs_header_t hdr;
811
814 /* Observer events */
816 int32_t event_count;
817
821 void *ctx;
829 int32_t *last_event_id;
830 int32_t last_event_id_storage;
831
833 int32_t term_index;
835 ecs_flags32_t flags;
837 /* Mixins */
838 ecs_poly_dtor_t dtor;
839};
840
891
903
904#include "flecs/private/api_types.h" /* Supporting API types */
905#include "flecs/private/api_support.h" /* Supporting API functions */
906#include "flecs/private/vec.h" /* Vector */
907#include "flecs/private/hashmap.h" /* Hashmap */
908
913typedef struct ecs_entity_desc_t {
914 int32_t _canary;
915
918 const char *name;
923 const char *sep;
927 const char *root_sep;
929 const char *symbol;
945
947 const char *add_expr;
949
979
993
998typedef struct ecs_filter_desc_t {
999 int32_t _canary;
1000
1004
1007
1010
1013
1020
1022 ecs_flags32_t flags;
1023
1025 const char *expr;
1026
1030
1099
1154
1159typedef struct ecs_event_desc_t {
1162
1167
1170
1174
1176 int32_t offset;
1177
1181 int32_t count;
1182
1185
1190 void *param;
1191
1192 /* Same as param, but with the guarantee that the value won't be modified.
1193 * When an event with a const parameter is enqueued, the value of the param
1194 * is copied to a temporary storage of the event type. */
1195 const void *const_param;
1196
1199
1201 ecs_flags32_t flags;
1203
1204
1212/* Utility to hold a value of a dynamic type */
1213typedef struct ecs_value_t {
1214 ecs_entity_t type;
1215 void *ptr;
1216} ecs_value_t;
1217
1219typedef struct ecs_build_info_t {
1220 const char *compiler;
1221 const char **addons;
1222 const char *version;
1226 bool debug;
1230
1289
1296
1307typedef struct EcsIdentifier {
1308 char *value;
1309 ecs_size_t length;
1310 uint64_t hash;
1311 uint64_t index_hash;
1312 ecs_hashmap_t *index;
1314
1316typedef struct EcsComponent {
1317 ecs_size_t size;
1318 ecs_size_t alignment;
1320
1325
1327typedef struct EcsFlattenTarget {
1328 int32_t count;
1329 ecs_record_t *target;
1331
1334
1338/* Only include deprecated definitions if deprecated addon is required */
1339#ifdef FLECS_DEPRECATED
1341#endif
1342
1358FLECS_API extern const ecs_id_t ECS_PAIR;
1359
1361FLECS_API extern const ecs_id_t ECS_OVERRIDE;
1362
1364FLECS_API extern const ecs_id_t ECS_TOGGLE;
1365
1367FLECS_API extern const ecs_id_t ECS_AND;
1368
1376/* Builtin component ids */
1377FLECS_API extern const ecs_entity_t ecs_id(EcsComponent);
1378FLECS_API extern const ecs_entity_t ecs_id(EcsIdentifier);
1379FLECS_API extern const ecs_entity_t ecs_id(EcsIterable);
1380FLECS_API extern const ecs_entity_t ecs_id(EcsPoly);
1381
1382FLECS_API extern const ecs_entity_t EcsQuery;
1383FLECS_API extern const ecs_entity_t EcsObserver;
1384
1385/* System module component ids */
1386FLECS_API extern const ecs_entity_t EcsSystem;
1387FLECS_API extern const ecs_entity_t ecs_id(EcsTickSource);
1388
1389/* Pipeline module component ids */
1390FLECS_API extern const ecs_entity_t ecs_id(EcsPipelineQuery);
1391
1392/* Timer module component ids */
1393FLECS_API extern const ecs_entity_t ecs_id(EcsTimer);
1394FLECS_API extern const ecs_entity_t ecs_id(EcsRateFilter);
1395
1397FLECS_API extern const ecs_entity_t EcsFlecs;
1398
1400FLECS_API extern const ecs_entity_t EcsFlecsCore;
1401
1403FLECS_API extern const ecs_entity_t EcsWorld;
1404
1406FLECS_API extern const ecs_entity_t EcsWildcard;
1407
1409FLECS_API extern const ecs_entity_t EcsAny;
1410
1412FLECS_API extern const ecs_entity_t EcsThis;
1413
1415FLECS_API extern const ecs_entity_t EcsVariable;
1416
1421FLECS_API extern const ecs_entity_t EcsTransitive;
1422
1427FLECS_API extern const ecs_entity_t EcsReflexive;
1428
1436FLECS_API extern const ecs_entity_t EcsFinal;
1437
1443FLECS_API extern const ecs_entity_t EcsDontInherit;
1444
1450FLECS_API extern const ecs_entity_t EcsAlwaysOverride;
1451
1456FLECS_API extern const ecs_entity_t EcsSymmetric;
1457
1464FLECS_API extern const ecs_entity_t EcsExclusive;
1465
1467FLECS_API extern const ecs_entity_t EcsAcyclic;
1468
1471FLECS_API extern const ecs_entity_t EcsTraversable;
1472
1479FLECS_API extern const ecs_entity_t EcsWith;
1480
1487FLECS_API extern const ecs_entity_t EcsOneOf;
1488
1491FLECS_API extern const ecs_entity_t EcsTag;
1492
1496FLECS_API extern const ecs_entity_t EcsTrait;
1497
1504FLECS_API extern const ecs_entity_t EcsRelationship;
1505
1512FLECS_API extern const ecs_entity_t EcsTarget;
1513
1517FLECS_API extern const ecs_entity_t EcsUnion;
1518
1520FLECS_API extern const ecs_entity_t EcsName;
1521
1523FLECS_API extern const ecs_entity_t EcsSymbol;
1524
1526FLECS_API extern const ecs_entity_t EcsAlias;
1527
1529FLECS_API extern const ecs_entity_t EcsChildOf;
1530
1532FLECS_API extern const ecs_entity_t EcsIsA;
1533
1535FLECS_API extern const ecs_entity_t EcsDependsOn;
1536
1538FLECS_API extern const ecs_entity_t EcsSlotOf;
1539
1541FLECS_API extern const ecs_entity_t EcsModule;
1542
1544FLECS_API extern const ecs_entity_t EcsPrivate;
1545
1548FLECS_API extern const ecs_entity_t EcsPrefab;
1549
1552FLECS_API extern const ecs_entity_t EcsDisabled;
1553
1555FLECS_API extern const ecs_entity_t EcsOnAdd;
1556
1558FLECS_API extern const ecs_entity_t EcsOnRemove;
1559
1561FLECS_API extern const ecs_entity_t EcsOnSet;
1562
1564FLECS_API extern const ecs_entity_t EcsUnSet;
1565
1567FLECS_API extern const ecs_entity_t EcsMonitor;
1568
1570FLECS_API extern const ecs_entity_t EcsOnTableCreate;
1571
1573FLECS_API extern const ecs_entity_t EcsOnTableDelete;
1574
1576FLECS_API extern const ecs_entity_t EcsOnTableEmpty;
1577
1579FLECS_API extern const ecs_entity_t EcsOnTableFill;
1580
1582FLECS_API extern const ecs_entity_t EcsOnDelete;
1583
1586FLECS_API extern const ecs_entity_t EcsOnDeleteTarget;
1587
1590FLECS_API extern const ecs_entity_t EcsRemove;
1591
1594FLECS_API extern const ecs_entity_t EcsDelete;
1595
1598FLECS_API extern const ecs_entity_t EcsPanic;
1599
1601FLECS_API extern const ecs_entity_t ecs_id(EcsFlattenTarget);
1602
1605FLECS_API extern const ecs_entity_t EcsFlatten;
1606
1612FLECS_API extern const ecs_entity_t EcsDefaultChildComponent;
1613
1614/* Builtin predicates for comparing entity ids in queries. Only supported by rules */
1615FLECS_API extern const ecs_entity_t EcsPredEq;
1616FLECS_API extern const ecs_entity_t EcsPredMatch;
1617FLECS_API extern const ecs_entity_t EcsPredLookup;
1618
1619/* Builtin marker entities for opening/closing query scopes */
1620FLECS_API extern const ecs_entity_t EcsScopeOpen;
1621FLECS_API extern const ecs_entity_t EcsScopeClose;
1622
1624FLECS_API extern const ecs_entity_t EcsEmpty;
1625
1626/* Pipeline module tags */
1627FLECS_API extern const ecs_entity_t ecs_id(EcsPipeline);
1628FLECS_API extern const ecs_entity_t EcsOnStart;
1629FLECS_API extern const ecs_entity_t EcsPreFrame;
1630FLECS_API extern const ecs_entity_t EcsOnLoad;
1631FLECS_API extern const ecs_entity_t EcsPostLoad;
1632FLECS_API extern const ecs_entity_t EcsPreUpdate;
1633FLECS_API extern const ecs_entity_t EcsOnUpdate;
1634FLECS_API extern const ecs_entity_t EcsOnValidate;
1635FLECS_API extern const ecs_entity_t EcsPostUpdate;
1636FLECS_API extern const ecs_entity_t EcsPreStore;
1637FLECS_API extern const ecs_entity_t EcsOnStore;
1638FLECS_API extern const ecs_entity_t EcsPostFrame;
1639FLECS_API extern const ecs_entity_t EcsPhase;
1640
1643#define EcsLastInternalComponentId (ecs_id(EcsPoly))
1644
1647#define EcsFirstUserComponentId (8)
1648
1651#define EcsFirstUserEntityId (FLECS_HI_COMPONENT_ID + 128)
1652
1653/* When visualized the reserved id ranges look like this:
1654 * [1..8]: Builtin components
1655 * [9..FLECS_HI_COMPONENT_ID]: Low ids reserved for application components
1656 * [FLECS_HI_COMPONENT_ID + 1..EcsFirstUserEntityId]: Builtin entities
1657 */
1658
1680FLECS_API
1682
1689FLECS_API
1691
1699FLECS_API
1701 int argc,
1702 char *argv[]);
1703
1710FLECS_API
1712 ecs_world_t *world);
1713
1721FLECS_API
1723 const ecs_world_t *world);
1724
1732FLECS_API
1734 ecs_world_t *world,
1735 ecs_fini_action_t action,
1736 void *ctx);
1737
1763FLECS_API
1765 ecs_world_t *world,
1766 ecs_ftime_t delta_time);
1767
1774FLECS_API
1776 ecs_world_t *world);
1777
1785FLECS_API
1787 ecs_world_t *world,
1788 ecs_fini_action_t action,
1789 void *ctx);
1790
1797FLECS_API
1799 ecs_world_t *world);
1800
1805FLECS_API
1807 const ecs_world_t *world);
1808
1821 ecs_world_t *world,
1822 bool enable);
1823
1835 ecs_world_t *world,
1836 bool enable);
1837
1853FLECS_API
1855 ecs_world_t *world,
1856 ecs_ftime_t fps);
1857
1934FLECS_API
1936 ecs_world_t *world,
1937 bool multi_threaded);
1938
1946FLECS_API
1948 ecs_world_t *world);
1949
1960FLECS_API
1962 ecs_world_t *world);
1963
1974FLECS_API
1976 ecs_world_t *world);
1977
1983FLECS_API
1985 const ecs_world_t *world);
1986
1995FLECS_API
1997 ecs_world_t *world);
1998
2008FLECS_API
2010 ecs_world_t *world);
2011
2017FLECS_API
2019 ecs_world_t *world);
2020
2037FLECS_API
2039 ecs_world_t *world,
2040 bool automerge);
2041
2055FLECS_API
2057 ecs_world_t *world,
2058 int32_t stages);
2059
2066FLECS_API
2068 const ecs_world_t *world);
2069
2077FLECS_API
2079 const ecs_world_t *world);
2080
2096FLECS_API
2098 const ecs_world_t *world,
2099 int32_t stage_id);
2100
2108FLECS_API
2110 const ecs_world_t *world);
2111
2130FLECS_API
2132 ecs_world_t *world);
2133
2140FLECS_API
2142 ecs_world_t *stage);
2143
2150FLECS_API
2152 ecs_world_t *stage);
2153
2169FLECS_API
2171 ecs_world_t *world,
2172 void *ctx,
2173 ecs_ctx_free_t ctx_free);
2174
2183FLECS_API
2185 ecs_world_t *world,
2186 void *ctx,
2187 ecs_ctx_free_t ctx_free);
2188
2196FLECS_API
2198 const ecs_world_t *world);
2199
2207FLECS_API
2209 const ecs_world_t *world);
2210
2215
2221FLECS_API
2223 const ecs_world_t *world);
2224
2233FLECS_API
2235 ecs_world_t *world,
2236 int32_t entity_count);
2237
2253FLECS_API
2255 ecs_world_t *world,
2256 ecs_entity_t id_start,
2257 ecs_entity_t id_end);
2258
2269FLECS_API
2271 ecs_world_t *world,
2272 bool enable);
2273
2278FLECS_API
2280 const ecs_world_t *world);
2281
2295FLECS_API
2297 ecs_world_t *world,
2298 ecs_flags32_t flags);
2299
2333FLECS_API
2335 ecs_world_t *world,
2336 ecs_id_t id,
2337 uint16_t clear_generation,
2338 uint16_t delete_generation,
2339 int32_t min_id_count,
2340 double time_budget_seconds);
2341
2347FLECS_API
2349 const ecs_poly_t *poly);
2350
2356FLECS_API
2358 const ecs_poly_t *poly);
2359
2373FLECS_API
2375 const ecs_poly_t *object,
2376 int32_t type);
2377
2378#define ecs_poly_is(object, type)\
2379 ecs_poly_is_(object, type##_magic)
2380
2388FLECS_API
2390 ecs_entity_t first,
2391 ecs_entity_t second);
2392
2419FLECS_API
2421 ecs_world_t *world);
2422
2440FLECS_API
2442 ecs_world_t *world);
2443
2452FLECS_API
2454 ecs_world_t *world,
2455 ecs_id_t id);
2456
2464FLECS_API
2466 ecs_world_t *world,
2467 ecs_table_t *table);
2468
2487FLECS_API
2489 ecs_world_t *world,
2490 const ecs_entity_desc_t *desc);
2491
2518FLECS_API
2520 ecs_world_t *world,
2521 const ecs_bulk_desc_t *desc);
2522
2532FLECS_API
2534 ecs_world_t *world,
2535 ecs_id_t id,
2536 int32_t count);
2537
2553FLECS_API
2555 ecs_world_t *world,
2556 ecs_entity_t dst,
2557 ecs_entity_t src,
2558 bool copy_value);
2559
2568FLECS_API
2570 ecs_world_t *world,
2571 ecs_entity_t entity);
2572
2580FLECS_API
2582 ecs_world_t *world,
2583 ecs_id_t id);
2584
2602FLECS_API
2604 ecs_world_t *world,
2605 ecs_entity_t entity,
2606 ecs_id_t id);
2607
2616FLECS_API
2618 ecs_world_t *world,
2619 ecs_entity_t entity,
2620 ecs_id_t id);
2621
2647FLECS_API
2649 ecs_world_t *world,
2650 ecs_entity_t entity,
2651 ecs_id_t id);
2652
2659FLECS_API
2661 ecs_world_t *world,
2662 ecs_entity_t entity);
2663
2671FLECS_API
2673 ecs_world_t *world,
2674 ecs_id_t id);
2675
2683FLECS_API
2685 ecs_world_t *world,
2686 ecs_id_t id);
2687
2694FLECS_API
2696 const ecs_world_t *world);
2697
2716FLECS_API
2718 ecs_world_t *world,
2719 ecs_entity_t entity,
2720 bool enabled);
2721
2735FLECS_API
2737 ecs_world_t *world,
2738 ecs_entity_t entity,
2739 ecs_id_t id,
2740 bool enable);
2741
2752FLECS_API
2754 const ecs_world_t *world,
2755 ecs_entity_t entity,
2756 ecs_id_t id);
2757
2779FLECS_API
2780const void* ecs_get_id(
2781 const ecs_world_t *world,
2782 ecs_entity_t entity,
2783 ecs_id_t id);
2784
2796FLECS_API
2798 const ecs_world_t *world,
2799 ecs_entity_t entity,
2800 ecs_id_t id);
2801
2816FLECS_API
2818 ecs_world_t *world,
2819 ecs_entity_t entity,
2820 ecs_id_t id);
2821
2833FLECS_API
2835 ecs_world_t *world,
2836 ecs_entity_t entity,
2837 ecs_id_t id);
2838
2849FLECS_API
2851 const ecs_world_t *world,
2852 ecs_entity_t entity,
2853 ecs_id_t id);
2854
2863FLECS_API
2865 const ecs_world_t *world,
2866 ecs_ref_t *ref,
2867 ecs_id_t id);
2868
2876FLECS_API
2878 const ecs_world_t *world,
2879 ecs_ref_t *ref);
2880
2899FLECS_API
2901 ecs_world_t *world,
2902 ecs_entity_t entity);
2903
2910FLECS_API
2912 ecs_record_t *record);
2913
2933FLECS_API
2935 ecs_world_t *world,
2936 ecs_entity_t entity);
2937
2943FLECS_API
2945 const ecs_record_t *record);
2946
2952FLECS_API
2954 const ecs_record_t *record);
2955
2969FLECS_API
2971 const ecs_world_t *world,
2972 const ecs_record_t *record,
2973 ecs_id_t id);
2974
2983FLECS_API
2985 ecs_world_t *world,
2986 ecs_record_t *record,
2987 ecs_id_t id);
2988
2995FLECS_API
2997 ecs_world_t *world,
2998 const ecs_record_t *record,
2999 ecs_id_t id);
3000
3014FLECS_API
3016 ecs_world_t *world,
3017 ecs_entity_t entity,
3018 ecs_id_t id);
3019
3029FLECS_API
3031 ecs_world_t *world,
3032 ecs_entity_t entity,
3033 ecs_id_t id);
3034
3051FLECS_API
3053 ecs_world_t *world,
3054 ecs_entity_t entity,
3055 ecs_id_t id,
3056 size_t size,
3057 const void *ptr);
3058
3086FLECS_API
3088 const ecs_world_t *world,
3089 ecs_entity_t e);
3090
3116FLECS_API
3118 const ecs_world_t *world,
3119 ecs_entity_t e);
3120
3126FLECS_API
3128 ecs_entity_t e);
3129
3141FLECS_API
3143 ecs_world_t *world,
3144 ecs_entity_t entity);
3145
3162FLECS_API
3164 const ecs_world_t *world,
3165 ecs_entity_t e);
3166
3187FLECS_API
3189 ecs_world_t *world,
3190 ecs_entity_t entity);
3191
3210FLECS_API
3212 ecs_world_t *world,
3213 ecs_id_t id);
3214
3222FLECS_API
3224 const ecs_world_t *world,
3225 ecs_entity_t entity);
3226
3242FLECS_API
3244 const ecs_world_t *world,
3245 ecs_entity_t entity);
3246
3253FLECS_API
3255 const ecs_world_t *world,
3256 ecs_entity_t entity);
3257
3265FLECS_API
3267 const ecs_world_t *world,
3268 const ecs_type_t* type);
3269
3278FLECS_API
3280 const ecs_world_t *world,
3281 const ecs_table_t *table);
3282
3294FLECS_API
3296 const ecs_world_t *world,
3297 ecs_entity_t entity);
3298
3307FLECS_API
3309 const ecs_world_t *world,
3310 ecs_entity_t entity,
3311 ecs_id_t id);
3312
3323FLECS_API
3325 const ecs_world_t *world,
3326 ecs_entity_t entity,
3327 ecs_id_t id);
3328
3343FLECS_API
3345 const ecs_world_t *world,
3346 ecs_entity_t entity,
3347 ecs_entity_t rel,
3348 int32_t index);
3349
3361FLECS_API
3363 const ecs_world_t *world,
3364 ecs_entity_t entity);
3365
3386FLECS_API
3388 const ecs_world_t *world,
3389 ecs_entity_t entity,
3390 ecs_entity_t rel,
3391 ecs_id_t id);
3392
3403FLECS_API
3405 const ecs_world_t *world,
3406 ecs_entity_t entity,
3407 ecs_entity_t rel);
3408
3409typedef struct ecs_flatten_desc_t {
3410 /* When true, the flatten operation will not remove names from entities in
3411 * the flattened tree. This may fail if entities from different subtrees
3412 * have the same name. */
3413 bool keep_names;
3414
3415 /* When true, the flattened tree won't contain information about the
3416 * original depth of the entities. This can reduce fragmentation, but may
3417 * cause existing code, such as cascade queries, to no longer work. */
3418 bool lose_depth;
3420
3445FLECS_API
3447 ecs_world_t *world,
3448 ecs_id_t pair,
3449 const ecs_flatten_desc_t *desc);
3450
3458FLECS_API
3460 const ecs_world_t *world,
3461 ecs_id_t entity);
3462
3480FLECS_API
3481const char* ecs_get_name(
3482 const ecs_world_t *world,
3483 ecs_entity_t entity);
3484
3492FLECS_API
3493const char* ecs_get_symbol(
3494 const ecs_world_t *world,
3495 ecs_entity_t entity);
3496
3508FLECS_API
3510 ecs_world_t *world,
3511 ecs_entity_t entity,
3512 const char *name);
3513
3525FLECS_API
3527 ecs_world_t *world,
3528 ecs_entity_t entity,
3529 const char *symbol);
3530
3542FLECS_API
3544 ecs_world_t *world,
3545 ecs_entity_t entity,
3546 const char *alias);
3547
3559FLECS_API
3561 const ecs_world_t *world,
3562 const char *path);
3563
3573FLECS_API
3575 const ecs_world_t *world,
3576 ecs_entity_t parent,
3577 const char *name);
3578
3597FLECS_API
3599 const ecs_world_t *world,
3600 ecs_entity_t parent,
3601 const char *path,
3602 const char *sep,
3603 const char *prefix,
3604 bool recursive);
3605
3619FLECS_API
3621 const ecs_world_t *world,
3622 const char *symbol,
3623 bool lookup_as_path,
3624 bool recursive);
3625
3645FLECS_API
3647 const ecs_world_t *world,
3648 ecs_entity_t parent,
3649 ecs_entity_t child,
3650 const char *sep,
3651 const char *prefix);
3652
3664 const ecs_world_t *world,
3665 ecs_entity_t parent,
3666 ecs_entity_t child,
3667 const char *sep,
3668 const char *prefix,
3669 ecs_strbuf_t *buf);
3670
3686FLECS_API
3688 ecs_world_t *world,
3689 ecs_entity_t parent,
3690 const char *path,
3691 const char *sep,
3692 const char *prefix);
3693
3708FLECS_API
3710 ecs_world_t *world,
3711 ecs_entity_t entity,
3712 ecs_entity_t parent,
3713 const char *path,
3714 const char *sep,
3715 const char *prefix);
3716
3728FLECS_API
3730 ecs_world_t *world,
3731 ecs_entity_t scope);
3732
3740FLECS_API
3742 const ecs_world_t *world);
3743
3753FLECS_API
3755 ecs_world_t *world,
3756 const char *prefix);
3757
3782FLECS_API
3784 ecs_world_t *world,
3785 const ecs_entity_t *lookup_path);
3786
3793FLECS_API
3795 const ecs_world_t *world);
3796
3821FLECS_API
3823 ecs_world_t *world,
3824 const ecs_component_desc_t *desc);
3825
3835FLECS_API
3837 const ecs_world_t *world,
3838 ecs_id_t id);
3839
3851FLECS_API
3853 ecs_world_t *world,
3854 ecs_entity_t id,
3855 const ecs_type_hooks_t *hooks);
3856
3863FLECS_API
3865 ecs_world_t *world,
3866 ecs_entity_t id);
3867
3891FLECS_API
3893 const ecs_world_t *world,
3894 ecs_id_t id);
3895
3908FLECS_API
3910 const ecs_world_t *world,
3911 ecs_id_t id);
3912
3921FLECS_API
3923 const ecs_world_t *world,
3924 ecs_id_t id);
3925
3945FLECS_API
3947 const ecs_world_t *world,
3948 ecs_id_t id);
3949
3957FLECS_API
3959 ecs_id_t id,
3960 ecs_id_t pattern);
3961
3967FLECS_API
3969 ecs_id_t id);
3970
3976FLECS_API
3978 ecs_id_t id);
3979
3993FLECS_API
3995 const ecs_world_t *world,
3996 ecs_id_t id);
3997
4006FLECS_API
4007ecs_flags32_t ecs_id_get_flags(
4008 const ecs_world_t *world,
4009 ecs_id_t id);
4010
4017FLECS_API
4019 ecs_id_t id_flags);
4020
4028FLECS_API
4030 const ecs_world_t *world,
4031 ecs_id_t id);
4032
4040FLECS_API
4042 const ecs_world_t *world,
4043 ecs_id_t id,
4044 ecs_strbuf_t *buf);
4045
4064FLECS_API
4065ecs_iter_t ecs_term_iter(
4066 const ecs_world_t *world,
4067 ecs_term_t *term);
4068
4077FLECS_API
4079 const ecs_iter_t *it,
4080 ecs_term_t *term);
4081
4091FLECS_API
4093 ecs_iter_t *it);
4094
4103FLECS_API
4104ecs_iter_t ecs_children(
4105 const ecs_world_t *world,
4106 ecs_entity_t parent);
4107
4114FLECS_API
4116 ecs_iter_t *it);
4117
4123FLECS_API
4125 const ecs_term_id_t *id);
4126
4138FLECS_API
4140 const ecs_term_t *term);
4141
4156FLECS_API
4158 const ecs_term_t *term);
4159
4172FLECS_API
4174 const ecs_term_t *term);
4175
4194FLECS_API
4196 const ecs_world_t *world,
4197 ecs_term_t *term);
4198
4207FLECS_API
4209 const ecs_term_t *src);
4210
4221FLECS_API
4223 ecs_term_t *src);
4224
4231FLECS_API
4233 ecs_term_t *term);
4234
4262FLECS_API
4264 ecs_world_t *world,
4265 const ecs_filter_desc_t *desc);
4266
4272FLECS_API
4274 ecs_filter_t *filter);
4275
4289FLECS_API
4291 const ecs_world_t *world,
4292 ecs_filter_t *filter);
4293
4305FLECS_API
4307 const ecs_filter_t *filter);
4308
4317FLECS_API
4319 const ecs_world_t *world,
4320 const ecs_term_t *term);
4321
4330FLECS_API
4332 const ecs_world_t *world,
4333 const ecs_filter_t *filter);
4334
4343FLECS_API
4345 const ecs_world_t *world,
4346 const ecs_filter_t *filter);
4347
4356FLECS_API
4358 const ecs_iter_t *it,
4359 const ecs_filter_t *filter);
4360
4380FLECS_API
4382 const ecs_world_t *world,
4383 const ecs_filter_t *filter);
4384
4394FLECS_API
4396 ecs_iter_t *it);
4397
4404FLECS_API
4406 ecs_iter_t *it);
4407
4413FLECS_API
4415 ecs_filter_t *dst,
4416 ecs_filter_t *src);
4417
4423FLECS_API
4425 ecs_filter_t *dst,
4426 const ecs_filter_t *src);
4427
4471FLECS_API
4473 ecs_world_t *world,
4474 const ecs_query_desc_t *desc);
4475
4483FLECS_API
4485 ecs_query_t *query);
4486
4494FLECS_API
4496 const ecs_query_t *query);
4497
4525FLECS_API
4527 const ecs_world_t *world,
4528 ecs_query_t *query);
4529
4539FLECS_API
4541 ecs_iter_t *iter);
4542
4549FLECS_API
4551 ecs_iter_t *iter);
4552
4563FLECS_API
4565 ecs_iter_t *iter);
4566
4588FLECS_API
4590 ecs_iter_t *iter,
4591 bool when_changed);
4592
4622FLECS_API
4624 ecs_query_t *query,
4625 const ecs_iter_t *it);
4626
4637FLECS_API
4639 ecs_iter_t *it);
4640
4663FLECS_API
4665 ecs_iter_t *it,
4666 uint64_t group_id);
4667
4676FLECS_API
4678 const ecs_query_t *query,
4679 uint64_t group_id);
4680
4689FLECS_API
4691 const ecs_query_t *query,
4692 uint64_t group_id);
4693
4702FLECS_API
4704 const ecs_query_t *query);
4705
4711FLECS_API
4713 const ecs_query_t *query);
4714
4720FLECS_API
4722 const ecs_query_t *query);
4723
4729FLECS_API
4731 const ecs_query_t *query);
4732
4740FLECS_API
4742 const ecs_query_t *query);
4743
4750FLECS_API
4752 const ecs_query_t *query);
4753
4760FLECS_API
4762 const ecs_query_t *query);
4763
4790FLECS_API
4792 ecs_world_t *world,
4793 ecs_event_desc_t *desc);
4794
4795FLECS_API
4796void ecs_enqueue(
4797 ecs_world_t *world,
4798 ecs_event_desc_t *desc);
4799
4809FLECS_API
4811 ecs_world_t *world,
4812 const ecs_observer_desc_t *desc);
4813
4823FLECS_API
4825 ecs_iter_t *it);
4826
4834FLECS_API
4836 const ecs_world_t *world,
4837 ecs_entity_t observer);
4838
4846FLECS_API
4848 const ecs_world_t *world,
4849 ecs_entity_t observer);
4850
4858FLECS_API
4860 const ecs_world_t *world,
4861 ecs_entity_t observer);
4862
4893FLECS_API
4895 const ecs_world_t *world,
4896 const ecs_poly_t *poly,
4897 ecs_iter_t *iter,
4898 ecs_term_t *filter);
4899
4913FLECS_API
4915 ecs_iter_t *it);
4916
4926FLECS_API
4928 ecs_iter_t *it);
4929
4941FLECS_API
4943 ecs_iter_t *it);
4944
4957FLECS_API
4959 ecs_iter_t *it);
4960
4968FLECS_API
4970 ecs_iter_t *it);
4971
5007FLECS_API
5009 ecs_iter_t *it,
5010 int32_t var_id,
5011 ecs_entity_t entity);
5012
5020FLECS_API
5022 ecs_iter_t *it,
5023 int32_t var_id,
5024 const ecs_table_t *table);
5025
5033FLECS_API
5035 ecs_iter_t *it,
5036 int32_t var_id,
5037 const ecs_table_range_t *range);
5038
5051FLECS_API
5053 ecs_iter_t *it,
5054 int32_t var_id);
5055
5069FLECS_API
5071 ecs_iter_t *it,
5072 int32_t var_id);
5073
5087FLECS_API
5089 ecs_iter_t *it,
5090 int32_t var_id);
5091
5103FLECS_API
5105 ecs_iter_t *it,
5106 int32_t var_id);
5107
5119FLECS_API
5121 const ecs_iter_t *it);
5122
5138FLECS_API
5139ecs_iter_t ecs_page_iter(
5140 const ecs_iter_t *it,
5141 int32_t offset,
5142 int32_t limit);
5143
5150FLECS_API
5152 ecs_iter_t *it);
5153
5174FLECS_API
5176 const ecs_iter_t *it,
5177 int32_t index,
5178 int32_t count);
5179
5186FLECS_API
5188 ecs_iter_t *it);
5189
5213FLECS_API
5215 const ecs_iter_t *it,
5216 size_t size,
5217 int32_t index);
5218
5227FLECS_API
5229 const ecs_iter_t *it,
5230 int32_t index);
5231
5242FLECS_API
5244 const ecs_iter_t *it,
5245 int32_t index);
5246
5253FLECS_API
5255 const ecs_iter_t *it,
5256 int32_t index);
5257
5264FLECS_API
5266 const ecs_iter_t *it,
5267 int32_t index);
5268
5277FLECS_API
5279 const ecs_iter_t *it,
5280 int32_t index);
5281
5289FLECS_API
5291 const ecs_iter_t *it,
5292 int32_t index);
5293
5301FLECS_API
5303 const ecs_iter_t *it,
5304 int32_t index);
5305
5319FLECS_API
5321 const ecs_iter_t *it,
5322 int32_t index);
5323
5339FLECS_API
5341 const ecs_table_t *table);
5342
5351FLECS_API
5353 const ecs_world_t *world,
5354 const ecs_table_t *table,
5355 ecs_id_t id);
5356
5366FLECS_API
5368 const ecs_world_t *world,
5369 const ecs_table_t *table,
5370 ecs_id_t id);
5371
5379FLECS_API
5381 const ecs_table_t *table);
5382
5394FLECS_API
5396 const ecs_table_t *table,
5397 int32_t index);
5398
5407FLECS_API
5409 const ecs_table_t *table,
5410 int32_t index);
5411
5420FLECS_API
5422 const ecs_table_t *table,
5423 int32_t index,
5424 int32_t offset);
5425
5434FLECS_API
5436 const ecs_world_t *world,
5437 const ecs_table_t *table,
5438 ecs_id_t id,
5439 int32_t offset);
5440
5448FLECS_API
5450 const ecs_table_t *table,
5451 int32_t index);
5452
5461FLECS_API
5463 const ecs_table_t *table);
5464
5473FLECS_API
5475 const ecs_world_t *world,
5476 const ecs_table_t *table,
5477 ecs_id_t id);
5478
5489FLECS_API
5491 const ecs_world_t *world,
5492 const ecs_table_t *table,
5493 ecs_entity_t rel);
5494
5504FLECS_API
5506 ecs_world_t *world,
5507 ecs_table_t *table,
5508 ecs_id_t id);
5509
5520FLECS_API
5522 ecs_world_t *world,
5523 const ecs_id_t *ids,
5524 int32_t id_count);
5525
5535FLECS_API
5537 ecs_world_t *world,
5538 ecs_table_t *table,
5539 ecs_id_t id);
5540
5556FLECS_API
5558 ecs_world_t *world,
5559 ecs_table_t *table);
5560
5567FLECS_API
5569 ecs_world_t *world,
5570 ecs_table_t *table);
5571
5581FLECS_API
5583 ecs_table_t *table,
5584 ecs_flags32_t flags);
5585
5593FLECS_API
5595 ecs_world_t* world,
5596 ecs_table_t* table,
5597 int32_t row_1,
5598 int32_t row_2);
5599
5622FLECS_API
5624 ecs_world_t *world,
5625 ecs_entity_t entity,
5626 ecs_record_t *record,
5627 ecs_table_t *table,
5628 const ecs_type_t *added,
5629 const ecs_type_t *removed);
5630
5632FLECS_API
5634 const ecs_world_t *world,
5635 ecs_entity_t entity);
5636
5638FLECS_API
5640 const ecs_record_t *r,
5641 int32_t column,
5642 size_t c_size);
5643
5659FLECS_API
5661 const ecs_world_t *world,
5662 const ecs_table_t *table,
5663 ecs_id_t id,
5664 ecs_id_t *id_out);
5665
5698FLECS_API
5700 const ecs_world_t *world,
5701 const ecs_table_t *table,
5702 int32_t offset,
5703 ecs_id_t id,
5704 ecs_id_t *id_out);
5705
5744FLECS_API
5746 const ecs_world_t *world,
5747 const ecs_table_t *table,
5748 int32_t offset,
5749 ecs_id_t id,
5750 ecs_entity_t rel,
5751 ecs_flags32_t flags, /* EcsSelf and/or EcsUp */
5752 ecs_entity_t *subject_out,
5753 ecs_id_t *id_out,
5754 struct ecs_table_record_t **tr_out);
5755
5772FLECS_API
5774 const ecs_world_t *world,
5775 ecs_entity_t type,
5776 void *ptr);
5777
5785FLECS_API
5787 const ecs_world_t *world,
5788 const ecs_type_info_t *ti,
5789 void *ptr);
5790
5797FLECS_API
5799 ecs_world_t *world,
5800 ecs_entity_t type);
5801
5809 ecs_world_t *world,
5810 const ecs_type_info_t *ti);
5811
5820 const ecs_world_t *world,
5821 const ecs_type_info_t *ti,
5822 void *ptr);
5823
5831FLECS_API
5833 const ecs_world_t *world,
5834 ecs_entity_t type,
5835 void* ptr);
5836
5843FLECS_API
5845 ecs_world_t *world,
5846 ecs_entity_t type,
5847 void* ptr);
5848
5857FLECS_API
5859 const ecs_world_t *world,
5860 const ecs_type_info_t *ti,
5861 void* dst,
5862 const void *src);
5863
5872FLECS_API
5874 const ecs_world_t *world,
5875 ecs_entity_t type,
5876 void* dst,
5877 const void *src);
5878
5888 const ecs_world_t *world,
5889 const ecs_type_info_t *ti,
5890 void* dst,
5891 void *src);
5892
5902 const ecs_world_t *world,
5903 ecs_entity_t type,
5904 void* dst,
5905 void *src);
5906
5916 const ecs_world_t *world,
5917 const ecs_type_info_t *ti,
5918 void* dst,
5919 void *src);
5920
5930 const ecs_world_t *world,
5931 ecs_entity_t type,
5932 void* dst,
5933 void *src);
5934
5948#include "flecs/addons/flecs_c.h"
5949
5950#ifdef __cplusplus
5951}
5952#endif
5953
5954#include "flecs/private/addons.h"
5955
5956#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 EcsIdentifier EcsIdentifier
A (string) identifier.
ecs_iterable_t EcsIterable
Component for iterable entities.
Definition flecs.h:1333
struct EcsPoly EcsPoly
Component for storing a poly object.
struct EcsFlattenTarget EcsFlattenTarget
Target data for flattened relationships.
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 EcsTrait
Can be added to components to indicate it is a trait.
const ecs_entity_t EcsEmpty
Tag used to indicate query is empty.
const ecs_entity_t EcsOneOf
Ensure that relationship target is child of specified entity.
const ecs_entity_t EcsOnTableDelete
Event that triggers when a table is deleted.
const ecs_entity_t EcsOnTableCreate
Event that triggers when a table is created.
const ecs_entity_t EcsRelationship
Ensure that an entity is always used in pair as relationship.
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 EcsTarget
Ensure that an entity is always used in pair as target.
const ecs_entity_t EcsWith
Ensure that a component always is added together with another component.
const ecs_entity_t 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.
bool ecs_readonly_begin(ecs_world_t *world, bool multi_threaded)
Begin readonly mode.
void ecs_defer_resume(ecs_world_t *world)
Resume deferring.
bool ecs_defer_begin(ecs_world_t *world)
Defer operations until end of frame.
void ecs_defer_suspend(ecs_world_t *world)
Suspend deferring but do not flush queue.
bool ecs_is_deferred(const ecs_world_t *world)
Test if deferring is enabled for current stage.
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.
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:458
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:318
struct ecs_rule_t ecs_rule_t
A rule is a query with advanced graph traversal features.
Definition flecs.h:416
struct ecs_table_record_t ecs_table_record_t
Information about where in a table a specific (component) id is stored.
Definition flecs.h:477
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:474
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition flecs.h:362
struct ecs_mixins_t ecs_mixins_t
Type that stores poly mixins.
Definition flecs.h:504
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
Definition flecs.h:311
struct ecs_query_t ecs_query_t
A query that caches its results.
Definition flecs.h:394
struct ecs_observable_t ecs_observable_t
An observable produces events that can be listened for by an observer.
Definition flecs.h:441
struct ecs_record_t ecs_record_t
Information about an entity, like its table and row.
Definition flecs.h:471
struct ecs_table_t ecs_table_t
A table stores entities and components for a specific type.
Definition flecs.h:365
void ecs_poly_t
A poly object.
Definition flecs.h:501
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:617
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:597
uint64_t(* ecs_hash_value_action_t)(const void *ptr)
Callback used for hashing values.
Definition flecs.h:635
void(* ecs_iter_fini_action_t)(ecs_iter_t *it)
Function prototype for freeing an iterator.
Definition flecs.h:575
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:586
bool(* ecs_iter_next_action_t)(ecs_iter_t *it)
Function prototype for iterating an iterator.
Definition flecs.h:567
void(* ecs_iter_action_t)(ecs_iter_t *it)
Function prototype for iterables.
Definition flecs.h:540
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:645
int(* ecs_compare_action_t)(const void *ptr1, const void *ptr2)
Callback used for sorting values.
Definition flecs.h:630
void(* ecs_fini_action_t)(ecs_world_t *world, void *ctx)
Action callback on world exit.
Definition flecs.h:621
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:652
void(* ecs_run_action_t)(ecs_iter_t *it)
Function prototype for runnables (systems, observers).
Definition flecs.h:531
void(* ecs_ctx_free_t)(void *ctx)
Function to cleanup context data.
Definition flecs.h:626
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:579
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:554
void(* ecs_xtor_t)(void *ptr, int32_t count, const ecs_type_info_t *type_info)
Constructor/destructor callback.
Definition flecs.h:639
void * ecs_emplace_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Emplace a component.
void * ecs_get_mut_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Get a mutable pointer to a component.
ecs_ref_t ecs_ref_init_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Create a component ref.
ecs_entity_t ecs_record_get_entity(const ecs_record_t *record)
Get entity corresponding with record.
void ecs_ref_update(const ecs_world_t *world, ecs_ref_t *ref)
Update ref.
const void * ecs_record_get_id(const ecs_world_t *world, const ecs_record_t *record, ecs_id_t id)
Get component from entity record.
void ecs_read_end(const ecs_record_t *record)
End read access to entity.
void * ecs_ensure_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Get a mutable pointer to a component.
void ecs_write_end(ecs_record_t *record)
End exclusive write access to entity.
void * ecs_ensure_modified_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Combines ensure + modified in single operation.
void * ecs_ref_get_id(const ecs_world_t *world, ecs_ref_t *ref, ecs_id_t id)
Get component from ref.
bool ecs_record_has_id(ecs_world_t *world, const ecs_record_t *record, ecs_id_t id)
Test if entity for record has component.
void * ecs_record_ensure_id(ecs_world_t *world, ecs_record_t *record, ecs_id_t id)
Same as ecs_record_get_id(), but returns a mutable pointer.
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.
const ecs_record_t * ecs_read_begin(ecs_world_t *world, ecs_entity_t entity)
Begin read access to entity.
const ecs_id_t ECS_PAIR
Indicates that the id is a pair.
const ecs_id_t ECS_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.
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.
void ecs_make_alive(ecs_world_t *world, ecs_entity_t entity)
Ensure id is alive.
void ecs_make_alive_id(ecs_world_t *world, ecs_id_t id)
Same as ecs_make_alive(), but for (component) ids.
ecs_entity_t ecs_get_alive(const ecs_world_t *world, ecs_entity_t e)
Get alive identifier.
bool ecs_exists(const ecs_world_t *world, ecs_entity_t entity)
Test whether an entity exists.
bool ecs_is_alive(const ecs_world_t *world, ecs_entity_t e)
Test whether an entity is alive.
struct ecs_world_info_t ecs_world_info_t
Type that contains information about the world.
struct ecs_query_group_info_t ecs_query_group_info_t
Type that contains information about a query group.
struct ecs_build_info_t ecs_build_info_t
Type with information about the current Flecs build.
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.
const ecs_filter_t * ecs_observer_get_filter(const ecs_world_t *world, ecs_entity_t observer)
Get observer query.
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:266
#define FLECS_EVENT_DESC_MAX
Maximum number of events in ecs_observer_desc_t.
Definition flecs.h:270
#define ecs_ftime_t
Customizable precision for scalar time values.
Definition flecs.h:57
#define FLECS_ID_DESC_MAX
Maximum number of ids to add ecs_entity_desc_t / ecs_bulk_desc_t.
Definition flecs.h:261
char * ecs_get_path_w_sep(const ecs_world_t *world, ecs_entity_t parent, ecs_entity_t child, const char *sep, const char *prefix)
Get a path identifier for an entity.
ecs_entity_t ecs_new_from_path_w_sep(ecs_world_t *world, ecs_entity_t parent, const char *path, const char *sep, const char *prefix)
Find or create entity from path.
ecs_entity_t ecs_lookup_symbol(const ecs_world_t *world, const char *symbol, bool lookup_as_path, bool recursive)
Lookup an entity by its symbol name.
void ecs_set_alias(ecs_world_t *world, ecs_entity_t entity, const char *alias)
Set alias for entity.
ecs_entity_t ecs_lookup(const ecs_world_t *world, const char *path)
Lookup an entity by it's path.
void ecs_get_path_w_sep_buf(const ecs_world_t *world, ecs_entity_t parent, ecs_entity_t child, const char *sep, const char *prefix, ecs_strbuf_t *buf)
Write path identifier to buffer.
ecs_entity_t ecs_get_scope(const ecs_world_t *world)
Get the current scope.
ecs_entity_t * ecs_set_lookup_path(ecs_world_t *world, const ecs_entity_t *lookup_path)
Set search path for lookup operations.
ecs_entity_t ecs_set_name(ecs_world_t *world, ecs_entity_t entity, const char *name)
Set the name of an entity.
const char * ecs_get_symbol(const ecs_world_t *world, ecs_entity_t entity)
Get the symbol of an entity.
ecs_entity_t ecs_lookup_path_w_sep(const ecs_world_t *world, ecs_entity_t parent, const char *path, const char *sep, const char *prefix, bool recursive)
Lookup an entity from a path.
ecs_entity_t ecs_set_symbol(ecs_world_t *world, ecs_entity_t entity, const char *symbol)
Set the symbol of an entity.
ecs_entity_t ecs_lookup_child(const ecs_world_t *world, ecs_entity_t parent, const char *name)
Lookup a child entity by name.
const char * ecs_get_name(const ecs_world_t *world, ecs_entity_t entity)
Get the name of an entity.
ecs_entity_t ecs_add_path_w_sep(ecs_world_t *world, ecs_entity_t entity, ecs_entity_t parent, const char *path, const char *sep, const char *prefix)
Add specified path to entity.
ecs_entity_t * ecs_get_lookup_path(const ecs_world_t *world)
Get current lookup path.
ecs_entity_t ecs_set_scope(ecs_world_t *world, ecs_entity_t scope)
Set the current scope.
const char * ecs_set_name_prefix(ecs_world_t *world, const char *prefix)
Set a name prefix for newly created entities.
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:687
ecs_oper_kind_t
Specify operator for term.
Definition flecs.h:696
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:692
@ EcsInOut
Term is both read and written.
Definition flecs.h:690
@ EcsInOutDefault
InOut for regular terms, In for shared terms.
Definition flecs.h:688
@ EcsInOutNone
Term is neither read nor written.
Definition flecs.h:689
@ EcsIn
Term is only read.
Definition flecs.h:691
@ EcsNot
The term must not match.
Definition flecs.h:699
@ EcsOptional
The term may match.
Definition flecs.h:700
@ EcsOr
One of the terms in an or chain must match.
Definition flecs.h:698
@ EcsOrFrom
Term must match at least one component from term id.
Definition flecs.h:702
@ EcsAnd
The term must match.
Definition flecs.h:697
@ EcsNotFrom
Term must match none of the components from term id.
Definition flecs.h:703
@ EcsAndFrom
Term must match all components from term id.
Definition flecs.h:701
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.
const ecs_build_info_t * ecs_get_build_info(void)
Get build info.
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:1316
ecs_size_t size
Component size.
Definition flecs.h:1317
ecs_size_t alignment
Component alignment.
Definition flecs.h:1318
Target data for flattened relationships.
Definition flecs.h:1327
A (string) identifier.
Definition flecs.h:1307
ecs_size_t length
Length of identifier.
Definition flecs.h:1309
char * value
Identifier string.
Definition flecs.h:1308
ecs_hashmap_t * index
Current index.
Definition flecs.h:1312
uint64_t hash
Hash of current value.
Definition flecs.h:1310
uint64_t index_hash
Hash of existing record in current index.
Definition flecs.h:1311
Component for storing a poly object.
Definition flecs.h:1322
ecs_poly_t * poly
Pointer to poly object.
Definition flecs.h:1323
Apply a rate filter to a tick source.
Definition timer.h:45
Component used to provide a tick source to systems.
Definition system.h:32
Component used for one shot/interval timer functionality.
Definition timer.h:35
Type with information about the current Flecs build.
Definition flecs.h:1219
int16_t version_major
Major flecs version.
Definition flecs.h:1223
const char ** addons
Addons included in build.
Definition flecs.h:1221
const char * version
Stringified version.
Definition flecs.h:1222
const char * compiler
Compiler used to compile flecs.
Definition flecs.h:1220
bool sanitize
Is this a sanitize build.
Definition flecs.h:1227
bool perf_trace
Is this a perf tracing build.
Definition flecs.h:1228
int16_t version_minor
Minor flecs version.
Definition flecs.h:1224
bool debug
Is this a debug build.
Definition flecs.h:1226
int16_t version_patch
Patch flecs version.
Definition flecs.h:1225
Used with ecs_bulk_init().
Definition flecs.h:954
void ** data
Array with component data to insert.
Definition flecs.h:966
ecs_id_t ids[(32)]
Ids to create the entities with.
Definition flecs.h:964
int32_t count
Number of entities to create/populate.
Definition flecs.h:962
ecs_entity_t * entities
Entities to bulk insert.
Definition flecs.h:957
ecs_table_t * table
Table to insert the entities into.
Definition flecs.h:973
Used with ecs_component_init().
Definition flecs.h:984
ecs_type_info_t type
Parameters for type (size, hooks, ...)
Definition flecs.h:991
ecs_entity_t entity
Existing entity to associate with observer (optional)
Definition flecs.h:988
Used with ecs_entity_init().
Definition flecs.h:913
const char * sep
Optional custom separator for hierarchical names.
Definition flecs.h:923
const char * root_sep
Optional, used for identifiers relative to root.
Definition flecs.h:927
const char * name
Name of the entity.
Definition flecs.h:918
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:939
ecs_id_t add[(32)]
Array of ids to add to the new or existing entity.
Definition flecs.h:944
const char * symbol
Optional entity symbol.
Definition flecs.h:929
const char * add_expr
String expression with components to add.
Definition flecs.h:947
ecs_entity_t id
Set to modify existing entity (optional)
Definition flecs.h:916
Used with ecs_emit().
Definition flecs.h:1159
ecs_entity_t entity
Single-entity alternative to setting table / offset / count.
Definition flecs.h:1184
ecs_table_t * table
The table for which to notify.
Definition flecs.h:1169
int32_t count
Limit number of notified entities to count.
Definition flecs.h:1181
ecs_table_t * other_table
Optional 2nd table to notify.
Definition flecs.h:1173
int32_t offset
Limit notified entities to ones starting from offset (row) in table.
Definition flecs.h:1176
const ecs_type_t * ids
Component ids.
Definition flecs.h:1166
ecs_poly_t * observable
Observable (usually the world)
Definition flecs.h:1198
ecs_entity_t event
The event id.
Definition flecs.h:1161
ecs_flags32_t flags
Event flags.
Definition flecs.h:1201
void * param
Optional context.
Definition flecs.h:1190
Used with ecs_filter_init().
Definition flecs.h:998
ecs_term_t * terms_buffer
For filters with lots of terms an outside array can be provided.
Definition flecs.h:1006
bool instanced
When true, terms returned by an iterator may either contain 1 or N elements, where terms with N eleme...
Definition flecs.h:1019
ecs_term_t terms[(16)]
Terms of the filter.
Definition flecs.h:1003
int32_t terms_buffer_count
Number of terms in array provided in terms_buffer.
Definition flecs.h:1009
ecs_entity_t entity
Entity associated with query (optional)
Definition flecs.h:1028
ecs_flags32_t flags
Flags for advanced usage.
Definition flecs.h:1022
ecs_filter_t * storage
External storage to prevent allocation of the filter object.
Definition flecs.h:1012
const char * expr
Filter expression.
Definition flecs.h:1025
Filters allow for ad-hoc quick filtering of entity tables.
Definition flecs.h:786
ecs_term_t * terms
Array containing terms for filter.
Definition flecs.h:794
ecs_id_t * ids
Array with field ids.
Definition flecs.h:797
int32_t * sizes
Field size (same for each result)
Definition flecs.h:796
int8_t term_count
Number of elements in terms array.
Definition flecs.h:789
ecs_flags64_t data_fields
Bitset with fields that have data.
Definition flecs.h:792
ecs_flags32_t flags
Filter flags.
Definition flecs.h:791
ecs_world_t * world
World mixin.
Definition flecs.h:805
int8_t field_count
Number of fields in iterator for filter.
Definition flecs.h:790
char * variable_names[1]
Placeholder variable names array.
Definition flecs.h:795
ecs_poly_dtor_t dtor
Dtor mixin.
Definition flecs.h:804
ecs_entity_t entity
Entity associated with filter (optional)
Definition flecs.h:802
ecs_iterable_t iterable
Iterable mixin.
Definition flecs.h:803
int32_t eval_count
Number of times query is evaluated.
Definition flecs.h:799
Header for ecs_poly_t objects.
Definition flecs.h:507
Iterable mixin.
Definition flecs.h:673
ecs_iter_init_action_t init
Callback that creates iterator.
Definition flecs.h:674
Used with ecs_observer_init().
Definition flecs.h:1104
void * binding_ctx
Context to be used for language bindings.
Definition flecs.h:1136
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:1139
ecs_entity_t entity
Existing entity to associate with observer (optional)
Definition flecs.h:1108
ecs_filter_desc_t filter
Filter for observer.
Definition flecs.h:1111
int32_t term_index
Used for internal purposes.
Definition flecs.h:1152
ecs_entity_t events[(8)]
Events to observe (OnAdd, OnRemove, OnSet, UnSet)
Definition flecs.h:1114
int32_t * last_event_id
Optional shared last event id for multiple observers.
Definition flecs.h:1149
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:1142
void * ctx
User context to pass to callback.
Definition flecs.h:1133
ecs_poly_t * observable
Observable with which to register the observer.
Definition flecs.h:1145
ecs_iter_action_t callback
Callback to invoke on an event, invoked when the observer matches.
Definition flecs.h:1122
bool yield_existing
When observer is created, generate events from existing data.
Definition flecs.h:1119
ecs_run_action_t run
Callback invoked on an event.
Definition flecs.h:1130
ecs_iter_action_t callback
See ecs_observer_desc_t::callback.
Definition flecs.h:818
int32_t term_index
Index of the term in parent observer (single term observers only)
Definition flecs.h:833
ecs_observable_t * observable
Observable for observer.
Definition flecs.h:827
ecs_run_action_t run
See ecs_observer_desc_t::run.
Definition flecs.h:819
int32_t * last_event_id
Last handled event id.
Definition flecs.h:829
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:824
ecs_filter_t filter
Query for observer.
Definition flecs.h:812
void * ctx
Callback context.
Definition flecs.h:821
ecs_id_t register_id
Id observer is registered with (single term observers only)
Definition flecs.h:832
ecs_flags32_t flags
Observer flags.
Definition flecs.h:835
void * binding_ctx
Binding context (for language bindings)
Definition flecs.h:822
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:825
Used with ecs_query_init().
Definition flecs.h:1035
ecs_order_by_action_t order_by
Callback used for ordering query results.
Definition flecs.h:1047
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:1094
ecs_id_t group_by_id
Id to be used by group_by.
Definition flecs.h:1056
ecs_group_by_action_t group_by
Callback used for grouping results.
Definition flecs.h:1063
void * ctx
User context to pass to callback.
Definition flecs.h:1088
ecs_ctx_free_t group_by_ctx_free
Function to free group_by_ctx.
Definition flecs.h:1077
void * group_by_ctx
Context to pass to group_by.
Definition flecs.h:1074
void * binding_ctx
Context to be used for language bindings.
Definition flecs.h:1091
ecs_group_create_action_t on_group_create
Callback that is invoked when a new group is created.
Definition flecs.h:1067
ecs_query_t * parent
If set, the query will be created as a subquery.
Definition flecs.h:1085
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:1097
ecs_entity_t order_by_component
Component to be used by order_by.
Definition flecs.h:1042
ecs_filter_desc_t filter
Filter for the query.
Definition flecs.h:1039
ecs_group_delete_action_t on_group_delete
Callback that is invoked when an existing group is deleted.
Definition flecs.h:1071
ecs_sort_table_action_t sort_table
Callback used for ordering query results.
Definition flecs.h:1051
Type that contains information about a query group.
Definition flecs.h:1291
int32_t table_count
Number of tables in group.
Definition flecs.h:1293
void * ctx
Group context, returned by on_group_create.
Definition flecs.h:1294
int32_t match_count
How often tables have been matched/unmatched.
Definition flecs.h:1292
Type that describes a single identifier in a term.
Definition flecs.h:737
ecs_flags32_t flags
Term flags.
Definition flecs.h:754
ecs_entity_t trav
Relationship to traverse when looking for the component.
Definition flecs.h:750
const char * name
Name.
Definition flecs.h:744
ecs_entity_t id
Entity id.
Definition flecs.h:738
Type that describes a term (single element in a query)
Definition flecs.h:758
ecs_term_id_t second
Second element of pair.
Definition flecs.h:766
ecs_id_t id
Component id to be matched by term.
Definition flecs.h:759
char * name
Name of term.
Definition flecs.h:772
ecs_term_id_t src
Source of term.
Definition flecs.h:764
ecs_id_record_t * idr
Cached pointer to internal index.
Definition flecs.h:775
ecs_term_id_t first
Component or first element of pair.
Definition flecs.h:765
int32_t field_index
Index of field for term in iterator.
Definition flecs.h:774
ecs_id_t id_flags
Id flags of term id.
Definition flecs.h:771
bool move
Used by internals.
Definition flecs.h:779
ecs_flags16_t flags
Flags that help eval, set by ecs_filter_init.
Definition flecs.h:777
ecs_inout_kind_t inout
Access to contents matched by term.
Definition flecs.h:768
ecs_oper_kind_t oper
Operator of term.
Definition flecs.h:769
Type that contains component lifecycle callbacks.
Definition flecs.h:847
ecs_copy_t copy_ctor
Ctor + copy.
Definition flecs.h:854
void * ctx
User defined context.
Definition flecs.h:885
ecs_iter_action_t on_remove
Callback that is invoked when an instance of the component is removed.
Definition flecs.h:883
void * binding_ctx
Language binding context.
Definition flecs.h:886
ecs_move_t move_dtor
Move + dtor.
Definition flecs.h:869
ecs_copy_t copy
copy assignment
Definition flecs.h:850
ecs_iter_action_t on_set
Callback that is invoked when an instance of the component is set.
Definition flecs.h:878
ecs_move_t move
move assignment
Definition flecs.h:851
ecs_xtor_t ctor
ctor
Definition flecs.h:848
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:888
ecs_iter_action_t on_add
Callback that is invoked when an instance of a component is added.
Definition flecs.h:873
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:889
ecs_move_t move_ctor
Ctor + move.
Definition flecs.h:857
ecs_move_t ctor_move_dtor
Ctor + move + dtor (or move_ctor + dtor).
Definition flecs.h:863
ecs_xtor_t dtor
dtor
Definition flecs.h:849
Type that contains component information (passed to ctors/dtors/...)
Definition flecs.h:896
ecs_size_t alignment
Alignment of type.
Definition flecs.h:898
ecs_size_t size
Size of type.
Definition flecs.h:897
const char * name
Type name.
Definition flecs.h:901
ecs_entity_t component
Handle to component (do not set)
Definition flecs.h:900
ecs_type_hooks_t hooks
Type hooks.
Definition flecs.h:899
A type is a list of (component) ids.
Definition flecs.h:335
Type that contains information about the world.
Definition flecs.h:1232
float delta_time
Time passed to or computed by ecs_progress.
Definition flecs.h:1238
ecs_entity_t min_id
First allowed entity id.
Definition flecs.h:1234
int64_t set_count
Set commands processed.
Definition flecs.h:1274
float world_time_total
Time elapsed in simulation.
Definition flecs.h:1245
int32_t tag_id_count
Number of tag (no data) ids in the world.
Definition flecs.h:1261
int32_t component_id_count
Number of component (data) ids in the world.
Definition flecs.h:1262
int64_t pipeline_build_count_total
Total number of pipeline builds.
Definition flecs.h:1257
int32_t table_count
Number of tables.
Definition flecs.h:1265
float delta_time_raw
Raw delta time (no time scaling)
Definition flecs.h:1237
float frame_time_total
Total time spent processing a frame.
Definition flecs.h:1241
float world_time_total_raw
Time elapsed in simulation (no scaling)
Definition flecs.h:1246
int64_t table_create_total
Total number of times a table was created.
Definition flecs.h:1255
int64_t observers_ran_frame
Total number of times observer was invoked.
Definition flecs.h:1259
float system_time_total
Total time spent in systems.
Definition flecs.h:1242
int64_t id_delete_total
Total number of times an id was deleted.
Definition flecs.h:1254
int64_t systems_ran_frame
Total number of systems ran in last frame.
Definition flecs.h:1258
float merge_time_total
Total time spent in merges.
Definition flecs.h:1244
int64_t discard_count
Commands discarded, happens when entity is no longer alive when running the command.
Definition flecs.h:1277
int64_t clear_count
Clear commands processed.
Definition flecs.h:1273
ecs_entity_t last_component_id
Last issued component entity id.
Definition flecs.h:1233
int32_t empty_table_count
Number of tables without entities.
Definition flecs.h:1266
int64_t frame_count_total
Total number of frames.
Definition flecs.h:1249
ecs_entity_t max_id
Last allowed entity id.
Definition flecs.h:1235
int64_t merge_count_total
Total number of merges.
Definition flecs.h:1250
int64_t other_count
Other commands processed.
Definition flecs.h:1279
int64_t batched_command_count
Commands batched.
Definition flecs.h:1281
int64_t table_delete_total
Total number of times a table was deleted.
Definition flecs.h:1256
int64_t delete_count
Selete commands processed.
Definition flecs.h:1272
int64_t rematch_count_total
Total number of rematches.
Definition flecs.h:1251
int64_t id_create_total
Total number of times a new id was created.
Definition flecs.h:1253
int64_t batched_entity_count
Entities for which commands were batched.
Definition flecs.h:1280
float time_scale
Time scale applied to delta_time.
Definition flecs.h:1239
int32_t pair_id_count
Number of pair ids in the world.
Definition flecs.h:1263
float rematch_time_total
Time spent on query rematching.
Definition flecs.h:1247
int64_t ensure_count
Ensure/emplace commands processed.
Definition flecs.h:1275
float target_fps
Target fps.
Definition flecs.h:1240
float emit_time_total
Total time spent notifying observers.
Definition flecs.h:1243
int64_t modified_count
Modified commands processed.
Definition flecs.h:1276
const char * name_prefix
Value set by ecs_set_name_prefix().
Definition flecs.h:1284
int64_t event_count
Enqueued custom events.
Definition flecs.h:1278
int64_t add_count
Add commands processed.
Definition flecs.h:1270
int64_t remove_count
Remove commands processed.
Definition flecs.h:1271