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
1875FLECS_API
1877 ecs_world_t *world,
1878 ecs_flags32_t flags);
1879
1956FLECS_API
1958 ecs_world_t *world,
1959 bool multi_threaded);
1960
1968FLECS_API
1970 ecs_world_t *world);
1971
1982FLECS_API
1984 ecs_world_t *world);
1985
1996FLECS_API
1998 ecs_world_t *world);
1999
2005FLECS_API
2007 const ecs_world_t *world);
2008
2017FLECS_API
2019 ecs_world_t *world);
2020
2030FLECS_API
2032 ecs_world_t *world);
2033
2039FLECS_API
2041 ecs_world_t *world);
2042
2059FLECS_API
2061 ecs_world_t *world,
2062 bool automerge);
2063
2077FLECS_API
2079 ecs_world_t *world,
2080 int32_t stages);
2081
2088FLECS_API
2090 const ecs_world_t *world);
2091
2099FLECS_API
2101 const ecs_world_t *world);
2102
2118FLECS_API
2120 const ecs_world_t *world,
2121 int32_t stage_id);
2122
2130FLECS_API
2132 const ecs_world_t *world);
2133
2152FLECS_API
2154 ecs_world_t *world);
2155
2162FLECS_API
2164 ecs_world_t *stage);
2165
2172FLECS_API
2174 ecs_world_t *stage);
2175
2191FLECS_API
2193 ecs_world_t *world,
2194 void *ctx,
2195 ecs_ctx_free_t ctx_free);
2196
2205FLECS_API
2207 ecs_world_t *world,
2208 void *ctx,
2209 ecs_ctx_free_t ctx_free);
2210
2218FLECS_API
2220 const ecs_world_t *world);
2221
2229FLECS_API
2231 const ecs_world_t *world);
2232
2237
2243FLECS_API
2245 const ecs_world_t *world);
2246
2255FLECS_API
2257 ecs_world_t *world,
2258 int32_t entity_count);
2259
2275FLECS_API
2277 ecs_world_t *world,
2278 ecs_entity_t id_start,
2279 ecs_entity_t id_end);
2280
2291FLECS_API
2293 ecs_world_t *world,
2294 bool enable);
2295
2300FLECS_API
2302 const ecs_world_t *world);
2303
2317FLECS_API
2319 ecs_world_t *world,
2320 ecs_flags32_t flags);
2321
2355FLECS_API
2357 ecs_world_t *world,
2358 ecs_id_t id,
2359 uint16_t clear_generation,
2360 uint16_t delete_generation,
2361 int32_t min_id_count,
2362 double time_budget_seconds);
2363
2369FLECS_API
2371 const ecs_poly_t *poly);
2372
2378FLECS_API
2380 const ecs_poly_t *poly);
2381
2395FLECS_API
2397 const ecs_poly_t *object,
2398 int32_t type);
2399
2400#define ecs_poly_is(object, type)\
2401 ecs_poly_is_(object, type##_magic)
2402
2410FLECS_API
2412 ecs_entity_t first,
2413 ecs_entity_t second);
2414
2441FLECS_API
2443 ecs_world_t *world);
2444
2462FLECS_API
2464 ecs_world_t *world);
2465
2474FLECS_API
2476 ecs_world_t *world,
2477 ecs_id_t id);
2478
2486FLECS_API
2488 ecs_world_t *world,
2489 ecs_table_t *table);
2490
2509FLECS_API
2511 ecs_world_t *world,
2512 const ecs_entity_desc_t *desc);
2513
2540FLECS_API
2542 ecs_world_t *world,
2543 const ecs_bulk_desc_t *desc);
2544
2554FLECS_API
2556 ecs_world_t *world,
2557 ecs_id_t id,
2558 int32_t count);
2559
2575FLECS_API
2577 ecs_world_t *world,
2578 ecs_entity_t dst,
2579 ecs_entity_t src,
2580 bool copy_value);
2581
2590FLECS_API
2592 ecs_world_t *world,
2593 ecs_entity_t entity);
2594
2602FLECS_API
2604 ecs_world_t *world,
2605 ecs_id_t id);
2606
2624FLECS_API
2626 ecs_world_t *world,
2627 ecs_entity_t entity,
2628 ecs_id_t id);
2629
2638FLECS_API
2640 ecs_world_t *world,
2641 ecs_entity_t entity,
2642 ecs_id_t id);
2643
2669FLECS_API
2671 ecs_world_t *world,
2672 ecs_entity_t entity,
2673 ecs_id_t id);
2674
2681FLECS_API
2683 ecs_world_t *world,
2684 ecs_entity_t entity);
2685
2693FLECS_API
2695 ecs_world_t *world,
2696 ecs_id_t id);
2697
2705FLECS_API
2707 ecs_world_t *world,
2708 ecs_id_t id);
2709
2716FLECS_API
2718 const ecs_world_t *world);
2719
2738FLECS_API
2740 ecs_world_t *world,
2741 ecs_entity_t entity,
2742 bool enabled);
2743
2757FLECS_API
2759 ecs_world_t *world,
2760 ecs_entity_t entity,
2761 ecs_id_t id,
2762 bool enable);
2763
2774FLECS_API
2776 const ecs_world_t *world,
2777 ecs_entity_t entity,
2778 ecs_id_t id);
2779
2801FLECS_API
2802const void* ecs_get_id(
2803 const ecs_world_t *world,
2804 ecs_entity_t entity,
2805 ecs_id_t id);
2806
2818FLECS_API
2820 const ecs_world_t *world,
2821 ecs_entity_t entity,
2822 ecs_id_t id);
2823
2838FLECS_API
2840 ecs_world_t *world,
2841 ecs_entity_t entity,
2842 ecs_id_t id);
2843
2855FLECS_API
2857 ecs_world_t *world,
2858 ecs_entity_t entity,
2859 ecs_id_t id);
2860
2871FLECS_API
2873 const ecs_world_t *world,
2874 ecs_entity_t entity,
2875 ecs_id_t id);
2876
2885FLECS_API
2887 const ecs_world_t *world,
2888 ecs_ref_t *ref,
2889 ecs_id_t id);
2890
2898FLECS_API
2900 const ecs_world_t *world,
2901 ecs_ref_t *ref);
2902
2921FLECS_API
2923 ecs_world_t *world,
2924 ecs_entity_t entity);
2925
2932FLECS_API
2934 ecs_record_t *record);
2935
2955FLECS_API
2957 ecs_world_t *world,
2958 ecs_entity_t entity);
2959
2965FLECS_API
2967 const ecs_record_t *record);
2968
2974FLECS_API
2976 const ecs_record_t *record);
2977
2991FLECS_API
2993 const ecs_world_t *world,
2994 const ecs_record_t *record,
2995 ecs_id_t id);
2996
3005FLECS_API
3007 ecs_world_t *world,
3008 ecs_record_t *record,
3009 ecs_id_t id);
3010
3017FLECS_API
3019 ecs_world_t *world,
3020 const ecs_record_t *record,
3021 ecs_id_t id);
3022
3036FLECS_API
3038 ecs_world_t *world,
3039 ecs_entity_t entity,
3040 ecs_id_t id);
3041
3051FLECS_API
3053 ecs_world_t *world,
3054 ecs_entity_t entity,
3055 ecs_id_t id);
3056
3073FLECS_API
3075 ecs_world_t *world,
3076 ecs_entity_t entity,
3077 ecs_id_t id,
3078 size_t size,
3079 const void *ptr);
3080
3108FLECS_API
3110 const ecs_world_t *world,
3111 ecs_entity_t e);
3112
3138FLECS_API
3140 const ecs_world_t *world,
3141 ecs_entity_t e);
3142
3148FLECS_API
3150 ecs_entity_t e);
3151
3163FLECS_API
3165 ecs_world_t *world,
3166 ecs_entity_t entity);
3167
3184FLECS_API
3186 const ecs_world_t *world,
3187 ecs_entity_t e);
3188
3209FLECS_API
3211 ecs_world_t *world,
3212 ecs_entity_t entity);
3213
3232FLECS_API
3234 ecs_world_t *world,
3235 ecs_id_t id);
3236
3244FLECS_API
3246 const ecs_world_t *world,
3247 ecs_entity_t entity);
3248
3264FLECS_API
3266 const ecs_world_t *world,
3267 ecs_entity_t entity);
3268
3275FLECS_API
3277 const ecs_world_t *world,
3278 ecs_entity_t entity);
3279
3287FLECS_API
3289 const ecs_world_t *world,
3290 const ecs_type_t* type);
3291
3300FLECS_API
3302 const ecs_world_t *world,
3303 const ecs_table_t *table);
3304
3316FLECS_API
3318 const ecs_world_t *world,
3319 ecs_entity_t entity);
3320
3329FLECS_API
3331 const ecs_world_t *world,
3332 ecs_entity_t entity,
3333 ecs_id_t id);
3334
3345FLECS_API
3347 const ecs_world_t *world,
3348 ecs_entity_t entity,
3349 ecs_id_t id);
3350
3365FLECS_API
3367 const ecs_world_t *world,
3368 ecs_entity_t entity,
3369 ecs_entity_t rel,
3370 int32_t index);
3371
3383FLECS_API
3385 const ecs_world_t *world,
3386 ecs_entity_t entity);
3387
3408FLECS_API
3410 const ecs_world_t *world,
3411 ecs_entity_t entity,
3412 ecs_entity_t rel,
3413 ecs_id_t id);
3414
3425FLECS_API
3427 const ecs_world_t *world,
3428 ecs_entity_t entity,
3429 ecs_entity_t rel);
3430
3431typedef struct ecs_flatten_desc_t {
3432 /* When true, the flatten operation will not remove names from entities in
3433 * the flattened tree. This may fail if entities from different subtrees
3434 * have the same name. */
3435 bool keep_names;
3436
3437 /* When true, the flattened tree won't contain information about the
3438 * original depth of the entities. This can reduce fragmentation, but may
3439 * cause existing code, such as cascade queries, to no longer work. */
3440 bool lose_depth;
3442
3467FLECS_API
3469 ecs_world_t *world,
3470 ecs_id_t pair,
3471 const ecs_flatten_desc_t *desc);
3472
3480FLECS_API
3482 const ecs_world_t *world,
3483 ecs_id_t entity);
3484
3502FLECS_API
3503const char* ecs_get_name(
3504 const ecs_world_t *world,
3505 ecs_entity_t entity);
3506
3514FLECS_API
3515const char* ecs_get_symbol(
3516 const ecs_world_t *world,
3517 ecs_entity_t entity);
3518
3530FLECS_API
3532 ecs_world_t *world,
3533 ecs_entity_t entity,
3534 const char *name);
3535
3547FLECS_API
3549 ecs_world_t *world,
3550 ecs_entity_t entity,
3551 const char *symbol);
3552
3564FLECS_API
3566 ecs_world_t *world,
3567 ecs_entity_t entity,
3568 const char *alias);
3569
3581FLECS_API
3583 const ecs_world_t *world,
3584 const char *path);
3585
3595FLECS_API
3597 const ecs_world_t *world,
3598 ecs_entity_t parent,
3599 const char *name);
3600
3619FLECS_API
3621 const ecs_world_t *world,
3622 ecs_entity_t parent,
3623 const char *path,
3624 const char *sep,
3625 const char *prefix,
3626 bool recursive);
3627
3641FLECS_API
3643 const ecs_world_t *world,
3644 const char *symbol,
3645 bool lookup_as_path,
3646 bool recursive);
3647
3667FLECS_API
3669 const ecs_world_t *world,
3670 ecs_entity_t parent,
3671 ecs_entity_t child,
3672 const char *sep,
3673 const char *prefix);
3674
3686 const ecs_world_t *world,
3687 ecs_entity_t parent,
3688 ecs_entity_t child,
3689 const char *sep,
3690 const char *prefix,
3691 ecs_strbuf_t *buf);
3692
3708FLECS_API
3710 ecs_world_t *world,
3711 ecs_entity_t parent,
3712 const char *path,
3713 const char *sep,
3714 const char *prefix);
3715
3730FLECS_API
3732 ecs_world_t *world,
3733 ecs_entity_t entity,
3734 ecs_entity_t parent,
3735 const char *path,
3736 const char *sep,
3737 const char *prefix);
3738
3750FLECS_API
3752 ecs_world_t *world,
3753 ecs_entity_t scope);
3754
3762FLECS_API
3764 const ecs_world_t *world);
3765
3775FLECS_API
3777 ecs_world_t *world,
3778 const char *prefix);
3779
3804FLECS_API
3806 ecs_world_t *world,
3807 const ecs_entity_t *lookup_path);
3808
3815FLECS_API
3817 const ecs_world_t *world);
3818
3843FLECS_API
3845 ecs_world_t *world,
3846 const ecs_component_desc_t *desc);
3847
3857FLECS_API
3859 const ecs_world_t *world,
3860 ecs_id_t id);
3861
3873FLECS_API
3875 ecs_world_t *world,
3876 ecs_entity_t id,
3877 const ecs_type_hooks_t *hooks);
3878
3885FLECS_API
3887 ecs_world_t *world,
3888 ecs_entity_t id);
3889
3913FLECS_API
3915 const ecs_world_t *world,
3916 ecs_id_t id);
3917
3930FLECS_API
3932 const ecs_world_t *world,
3933 ecs_id_t id);
3934
3943FLECS_API
3945 const ecs_world_t *world,
3946 ecs_id_t id);
3947
3967FLECS_API
3969 const ecs_world_t *world,
3970 ecs_id_t id);
3971
3979FLECS_API
3981 ecs_id_t id,
3982 ecs_id_t pattern);
3983
3989FLECS_API
3991 ecs_id_t id);
3992
3998FLECS_API
4000 ecs_id_t id);
4001
4015FLECS_API
4017 const ecs_world_t *world,
4018 ecs_id_t id);
4019
4028FLECS_API
4029ecs_flags32_t ecs_id_get_flags(
4030 const ecs_world_t *world,
4031 ecs_id_t id);
4032
4039FLECS_API
4041 ecs_id_t id_flags);
4042
4050FLECS_API
4052 const ecs_world_t *world,
4053 ecs_id_t id);
4054
4062FLECS_API
4064 const ecs_world_t *world,
4065 ecs_id_t id,
4066 ecs_strbuf_t *buf);
4067
4086FLECS_API
4087ecs_iter_t ecs_term_iter(
4088 const ecs_world_t *world,
4089 ecs_term_t *term);
4090
4099FLECS_API
4101 const ecs_iter_t *it,
4102 ecs_term_t *term);
4103
4113FLECS_API
4115 ecs_iter_t *it);
4116
4125FLECS_API
4126ecs_iter_t ecs_children(
4127 const ecs_world_t *world,
4128 ecs_entity_t parent);
4129
4136FLECS_API
4138 ecs_iter_t *it);
4139
4145FLECS_API
4147 const ecs_term_id_t *id);
4148
4160FLECS_API
4162 const ecs_term_t *term);
4163
4178FLECS_API
4180 const ecs_term_t *term);
4181
4194FLECS_API
4196 const ecs_term_t *term);
4197
4216FLECS_API
4218 const ecs_world_t *world,
4219 ecs_term_t *term);
4220
4229FLECS_API
4231 const ecs_term_t *src);
4232
4243FLECS_API
4245 ecs_term_t *src);
4246
4253FLECS_API
4255 ecs_term_t *term);
4256
4284FLECS_API
4286 ecs_world_t *world,
4287 const ecs_filter_desc_t *desc);
4288
4294FLECS_API
4296 ecs_filter_t *filter);
4297
4311FLECS_API
4313 const ecs_world_t *world,
4314 ecs_filter_t *filter);
4315
4327FLECS_API
4329 const ecs_filter_t *filter);
4330
4339FLECS_API
4341 const ecs_world_t *world,
4342 const ecs_term_t *term);
4343
4352FLECS_API
4354 const ecs_world_t *world,
4355 const ecs_filter_t *filter);
4356
4365FLECS_API
4367 const ecs_world_t *world,
4368 const ecs_filter_t *filter);
4369
4378FLECS_API
4380 const ecs_iter_t *it,
4381 const ecs_filter_t *filter);
4382
4402FLECS_API
4404 const ecs_world_t *world,
4405 const ecs_filter_t *filter);
4406
4416FLECS_API
4418 ecs_iter_t *it);
4419
4426FLECS_API
4428 ecs_iter_t *it);
4429
4435FLECS_API
4437 ecs_filter_t *dst,
4438 ecs_filter_t *src);
4439
4445FLECS_API
4447 ecs_filter_t *dst,
4448 const ecs_filter_t *src);
4449
4493FLECS_API
4495 ecs_world_t *world,
4496 const ecs_query_desc_t *desc);
4497
4505FLECS_API
4507 ecs_query_t *query);
4508
4516FLECS_API
4518 const ecs_query_t *query);
4519
4547FLECS_API
4549 const ecs_world_t *world,
4550 ecs_query_t *query);
4551
4561FLECS_API
4563 ecs_iter_t *iter);
4564
4571FLECS_API
4573 ecs_iter_t *iter);
4574
4585FLECS_API
4587 ecs_iter_t *iter);
4588
4610FLECS_API
4612 ecs_iter_t *iter,
4613 bool when_changed);
4614
4644FLECS_API
4646 ecs_query_t *query,
4647 const ecs_iter_t *it);
4648
4659FLECS_API
4661 ecs_iter_t *it);
4662
4685FLECS_API
4687 ecs_iter_t *it,
4688 uint64_t group_id);
4689
4698FLECS_API
4700 const ecs_query_t *query,
4701 uint64_t group_id);
4702
4711FLECS_API
4713 const ecs_query_t *query,
4714 uint64_t group_id);
4715
4724FLECS_API
4726 const ecs_query_t *query);
4727
4733FLECS_API
4735 const ecs_query_t *query);
4736
4742FLECS_API
4744 const ecs_query_t *query);
4745
4751FLECS_API
4753 const ecs_query_t *query);
4754
4762FLECS_API
4764 const ecs_query_t *query);
4765
4772FLECS_API
4774 const ecs_query_t *query);
4775
4782FLECS_API
4784 const ecs_query_t *query);
4785
4812FLECS_API
4814 ecs_world_t *world,
4815 ecs_event_desc_t *desc);
4816
4817FLECS_API
4818void ecs_enqueue(
4819 ecs_world_t *world,
4820 ecs_event_desc_t *desc);
4821
4831FLECS_API
4833 ecs_world_t *world,
4834 const ecs_observer_desc_t *desc);
4835
4845FLECS_API
4847 ecs_iter_t *it);
4848
4856FLECS_API
4858 const ecs_world_t *world,
4859 ecs_entity_t observer);
4860
4868FLECS_API
4870 const ecs_world_t *world,
4871 ecs_entity_t observer);
4872
4880FLECS_API
4882 const ecs_world_t *world,
4883 ecs_entity_t observer);
4884
4915FLECS_API
4917 const ecs_world_t *world,
4918 const ecs_poly_t *poly,
4919 ecs_iter_t *iter,
4920 ecs_term_t *filter);
4921
4935FLECS_API
4937 ecs_iter_t *it);
4938
4948FLECS_API
4950 ecs_iter_t *it);
4951
4963FLECS_API
4965 ecs_iter_t *it);
4966
4979FLECS_API
4981 ecs_iter_t *it);
4982
4990FLECS_API
4992 ecs_iter_t *it);
4993
5029FLECS_API
5031 ecs_iter_t *it,
5032 int32_t var_id,
5033 ecs_entity_t entity);
5034
5042FLECS_API
5044 ecs_iter_t *it,
5045 int32_t var_id,
5046 const ecs_table_t *table);
5047
5055FLECS_API
5057 ecs_iter_t *it,
5058 int32_t var_id,
5059 const ecs_table_range_t *range);
5060
5073FLECS_API
5075 ecs_iter_t *it,
5076 int32_t var_id);
5077
5091FLECS_API
5093 ecs_iter_t *it,
5094 int32_t var_id);
5095
5109FLECS_API
5111 ecs_iter_t *it,
5112 int32_t var_id);
5113
5125FLECS_API
5127 ecs_iter_t *it,
5128 int32_t var_id);
5129
5141FLECS_API
5143 const ecs_iter_t *it);
5144
5160FLECS_API
5161ecs_iter_t ecs_page_iter(
5162 const ecs_iter_t *it,
5163 int32_t offset,
5164 int32_t limit);
5165
5172FLECS_API
5174 ecs_iter_t *it);
5175
5196FLECS_API
5198 const ecs_iter_t *it,
5199 int32_t index,
5200 int32_t count);
5201
5208FLECS_API
5210 ecs_iter_t *it);
5211
5235FLECS_API
5237 const ecs_iter_t *it,
5238 size_t size,
5239 int32_t index);
5240
5249FLECS_API
5251 const ecs_iter_t *it,
5252 int32_t index);
5253
5264FLECS_API
5266 const ecs_iter_t *it,
5267 int32_t index);
5268
5275FLECS_API
5277 const ecs_iter_t *it,
5278 int32_t index);
5279
5286FLECS_API
5288 const ecs_iter_t *it,
5289 int32_t index);
5290
5299FLECS_API
5301 const ecs_iter_t *it,
5302 int32_t index);
5303
5311FLECS_API
5313 const ecs_iter_t *it,
5314 int32_t index);
5315
5323FLECS_API
5325 const ecs_iter_t *it,
5326 int32_t index);
5327
5341FLECS_API
5343 const ecs_iter_t *it,
5344 int32_t index);
5345
5361FLECS_API
5363 const ecs_table_t *table);
5364
5373FLECS_API
5375 const ecs_world_t *world,
5376 const ecs_table_t *table,
5377 ecs_id_t id);
5378
5388FLECS_API
5390 const ecs_world_t *world,
5391 const ecs_table_t *table,
5392 ecs_id_t id);
5393
5401FLECS_API
5403 const ecs_table_t *table);
5404
5416FLECS_API
5418 const ecs_table_t *table,
5419 int32_t index);
5420
5429FLECS_API
5431 const ecs_table_t *table,
5432 int32_t index);
5433
5442FLECS_API
5444 const ecs_table_t *table,
5445 int32_t index,
5446 int32_t offset);
5447
5456FLECS_API
5458 const ecs_world_t *world,
5459 const ecs_table_t *table,
5460 ecs_id_t id,
5461 int32_t offset);
5462
5470FLECS_API
5472 const ecs_table_t *table,
5473 int32_t index);
5474
5483FLECS_API
5485 const ecs_table_t *table);
5486
5495FLECS_API
5497 const ecs_world_t *world,
5498 const ecs_table_t *table,
5499 ecs_id_t id);
5500
5511FLECS_API
5513 const ecs_world_t *world,
5514 const ecs_table_t *table,
5515 ecs_entity_t rel);
5516
5526FLECS_API
5528 ecs_world_t *world,
5529 ecs_table_t *table,
5530 ecs_id_t id);
5531
5542FLECS_API
5544 ecs_world_t *world,
5545 const ecs_id_t *ids,
5546 int32_t id_count);
5547
5557FLECS_API
5559 ecs_world_t *world,
5560 ecs_table_t *table,
5561 ecs_id_t id);
5562
5578FLECS_API
5580 ecs_world_t *world,
5581 ecs_table_t *table);
5582
5589FLECS_API
5591 ecs_world_t *world,
5592 ecs_table_t *table);
5593
5603FLECS_API
5605 ecs_table_t *table,
5606 ecs_flags32_t flags);
5607
5615FLECS_API
5617 ecs_world_t* world,
5618 ecs_table_t* table,
5619 int32_t row_1,
5620 int32_t row_2);
5621
5644FLECS_API
5646 ecs_world_t *world,
5647 ecs_entity_t entity,
5648 ecs_record_t *record,
5649 ecs_table_t *table,
5650 const ecs_type_t *added,
5651 const ecs_type_t *removed);
5652
5654FLECS_API
5656 const ecs_world_t *world,
5657 ecs_entity_t entity);
5658
5660FLECS_API
5662 const ecs_record_t *r,
5663 int32_t column,
5664 size_t c_size);
5665
5681FLECS_API
5683 const ecs_world_t *world,
5684 const ecs_table_t *table,
5685 ecs_id_t id,
5686 ecs_id_t *id_out);
5687
5720FLECS_API
5722 const ecs_world_t *world,
5723 const ecs_table_t *table,
5724 int32_t offset,
5725 ecs_id_t id,
5726 ecs_id_t *id_out);
5727
5766FLECS_API
5768 const ecs_world_t *world,
5769 const ecs_table_t *table,
5770 int32_t offset,
5771 ecs_id_t id,
5772 ecs_entity_t rel,
5773 ecs_flags32_t flags, /* EcsSelf and/or EcsUp */
5774 ecs_entity_t *subject_out,
5775 ecs_id_t *id_out,
5776 struct ecs_table_record_t **tr_out);
5777
5794FLECS_API
5796 const ecs_world_t *world,
5797 ecs_entity_t type,
5798 void *ptr);
5799
5807FLECS_API
5809 const ecs_world_t *world,
5810 const ecs_type_info_t *ti,
5811 void *ptr);
5812
5819FLECS_API
5821 ecs_world_t *world,
5822 ecs_entity_t type);
5823
5831 ecs_world_t *world,
5832 const ecs_type_info_t *ti);
5833
5842 const ecs_world_t *world,
5843 const ecs_type_info_t *ti,
5844 void *ptr);
5845
5853FLECS_API
5855 const ecs_world_t *world,
5856 ecs_entity_t type,
5857 void* ptr);
5858
5865FLECS_API
5867 ecs_world_t *world,
5868 ecs_entity_t type,
5869 void* ptr);
5870
5879FLECS_API
5881 const ecs_world_t *world,
5882 const ecs_type_info_t *ti,
5883 void* dst,
5884 const void *src);
5885
5894FLECS_API
5896 const ecs_world_t *world,
5897 ecs_entity_t type,
5898 void* dst,
5899 const void *src);
5900
5910 const ecs_world_t *world,
5911 const ecs_type_info_t *ti,
5912 void* dst,
5913 void *src);
5914
5924 const ecs_world_t *world,
5925 ecs_entity_t type,
5926 void* dst,
5927 void *src);
5928
5938 const ecs_world_t *world,
5939 const ecs_type_info_t *ti,
5940 void* dst,
5941 void *src);
5942
5952 const ecs_world_t *world,
5953 ecs_entity_t type,
5954 void* dst,
5955 void *src);
5956
5970#include "flecs/addons/flecs_c.h"
5971
5972#ifdef __cplusplus
5973}
5974#endif
5975
5976#include "flecs/private/addons.h"
5977
5978#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_set_default_query_flags(ecs_world_t *world, ecs_flags32_t flags)
Set default query flags.
void ecs_quit(ecs_world_t *world)
Signal exit This operation signals that the application should quit.
void ecs_measure_frame_time(ecs_world_t *world, bool enable)
Measure frame time.
void ecs_frame_end(ecs_world_t *world)
End frame.
ecs_entity_t ecs_get_entity(const ecs_poly_t *poly)
Get entity from poly.
ecs_id_t ecs_make_pair(ecs_entity_t first, ecs_entity_t second)
Make a pair id.
const ecs_build_info_t * ecs_get_build_info(void)
Get build info.
bool 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