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 EcsTarget {
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 EcsUnion;
1497
1499FLECS_API extern const ecs_entity_t EcsName;
1500
1502FLECS_API extern const ecs_entity_t EcsSymbol;
1503
1505FLECS_API extern const ecs_entity_t EcsAlias;
1506
1508FLECS_API extern const ecs_entity_t EcsChildOf;
1509
1511FLECS_API extern const ecs_entity_t EcsIsA;
1512
1514FLECS_API extern const ecs_entity_t EcsDependsOn;
1515
1517FLECS_API extern const ecs_entity_t EcsSlotOf;
1518
1520FLECS_API extern const ecs_entity_t EcsModule;
1521
1523FLECS_API extern const ecs_entity_t EcsPrivate;
1524
1527FLECS_API extern const ecs_entity_t EcsPrefab;
1528
1531FLECS_API extern const ecs_entity_t EcsDisabled;
1532
1534FLECS_API extern const ecs_entity_t EcsOnAdd;
1535
1537FLECS_API extern const ecs_entity_t EcsOnRemove;
1538
1540FLECS_API extern const ecs_entity_t EcsOnSet;
1541
1543FLECS_API extern const ecs_entity_t EcsUnSet;
1544
1546FLECS_API extern const ecs_entity_t EcsMonitor;
1547
1549FLECS_API extern const ecs_entity_t EcsOnTableCreate;
1550
1552FLECS_API extern const ecs_entity_t EcsOnTableDelete;
1553
1555FLECS_API extern const ecs_entity_t EcsOnTableEmpty;
1556
1558FLECS_API extern const ecs_entity_t EcsOnTableFill;
1559
1561FLECS_API extern const ecs_entity_t EcsOnDelete;
1562
1565FLECS_API extern const ecs_entity_t EcsOnDeleteTarget;
1566
1569FLECS_API extern const ecs_entity_t EcsRemove;
1570
1573FLECS_API extern const ecs_entity_t EcsDelete;
1574
1577FLECS_API extern const ecs_entity_t EcsPanic;
1578
1580FLECS_API extern const ecs_entity_t ecs_id(EcsTarget);
1581
1584FLECS_API extern const ecs_entity_t EcsFlatten;
1585
1591FLECS_API extern const ecs_entity_t EcsDefaultChildComponent;
1592
1593/* Builtin predicates for comparing entity ids in queries. Only supported by rules */
1594FLECS_API extern const ecs_entity_t EcsPredEq;
1595FLECS_API extern const ecs_entity_t EcsPredMatch;
1596FLECS_API extern const ecs_entity_t EcsPredLookup;
1597
1598/* Builtin marker entities for opening/closing query scopes */
1599FLECS_API extern const ecs_entity_t EcsScopeOpen;
1600FLECS_API extern const ecs_entity_t EcsScopeClose;
1601
1603FLECS_API extern const ecs_entity_t EcsEmpty;
1604
1605/* Pipeline module tags */
1606FLECS_API extern const ecs_entity_t ecs_id(EcsPipeline);
1607FLECS_API extern const ecs_entity_t EcsOnStart;
1608FLECS_API extern const ecs_entity_t EcsPreFrame;
1609FLECS_API extern const ecs_entity_t EcsOnLoad;
1610FLECS_API extern const ecs_entity_t EcsPostLoad;
1611FLECS_API extern const ecs_entity_t EcsPreUpdate;
1612FLECS_API extern const ecs_entity_t EcsOnUpdate;
1613FLECS_API extern const ecs_entity_t EcsOnValidate;
1614FLECS_API extern const ecs_entity_t EcsPostUpdate;
1615FLECS_API extern const ecs_entity_t EcsPreStore;
1616FLECS_API extern const ecs_entity_t EcsOnStore;
1617FLECS_API extern const ecs_entity_t EcsPostFrame;
1618FLECS_API extern const ecs_entity_t EcsPhase;
1619
1622#define EcsLastInternalComponentId (ecs_id(EcsPoly))
1623
1626#define EcsFirstUserComponentId (8)
1627
1630#define EcsFirstUserEntityId (FLECS_HI_COMPONENT_ID + 128)
1631
1632/* When visualized the reserved id ranges look like this:
1633 * [1..8]: Builtin components
1634 * [9..FLECS_HI_COMPONENT_ID]: Low ids reserved for application components
1635 * [FLECS_HI_COMPONENT_ID + 1..EcsFirstUserEntityId]: Builtin entities
1636 */
1637
1659FLECS_API
1661
1668FLECS_API
1670
1678FLECS_API
1680 int argc,
1681 char *argv[]);
1682
1689FLECS_API
1691 ecs_world_t *world);
1692
1700FLECS_API
1702 const ecs_world_t *world);
1703
1711FLECS_API
1713 ecs_world_t *world,
1714 ecs_fini_action_t action,
1715 void *ctx);
1716
1742FLECS_API
1744 ecs_world_t *world,
1745 ecs_ftime_t delta_time);
1746
1753FLECS_API
1755 ecs_world_t *world);
1756
1764FLECS_API
1766 ecs_world_t *world,
1767 ecs_fini_action_t action,
1768 void *ctx);
1769
1776FLECS_API
1778 ecs_world_t *world);
1779
1784FLECS_API
1786 const ecs_world_t *world);
1787
1800 ecs_world_t *world,
1801 bool enable);
1802
1814 ecs_world_t *world,
1815 bool enable);
1816
1832FLECS_API
1834 ecs_world_t *world,
1835 ecs_ftime_t fps);
1836
1913FLECS_API
1915 ecs_world_t *world,
1916 bool multi_threaded);
1917
1925FLECS_API
1927 ecs_world_t *world);
1928
1939FLECS_API
1941 ecs_world_t *world);
1942
1953FLECS_API
1955 ecs_world_t *world);
1956
1962FLECS_API
1964 const ecs_world_t *world);
1965
1974FLECS_API
1976 ecs_world_t *world);
1977
1987FLECS_API
1989 ecs_world_t *world);
1990
1996FLECS_API
1998 ecs_world_t *world);
1999
2016FLECS_API
2018 ecs_world_t *world,
2019 bool automerge);
2020
2034FLECS_API
2036 ecs_world_t *world,
2037 int32_t stages);
2038
2045FLECS_API
2047 const ecs_world_t *world);
2048
2056FLECS_API
2058 const ecs_world_t *world);
2059
2075FLECS_API
2077 const ecs_world_t *world,
2078 int32_t stage_id);
2079
2087FLECS_API
2089 const ecs_world_t *world);
2090
2109FLECS_API
2111 ecs_world_t *world);
2112
2119FLECS_API
2121 ecs_world_t *stage);
2122
2129FLECS_API
2131 ecs_world_t *stage);
2132
2148FLECS_API
2150 ecs_world_t *world,
2151 void *ctx,
2152 ecs_ctx_free_t ctx_free);
2153
2162FLECS_API
2164 ecs_world_t *world,
2165 void *ctx,
2166 ecs_ctx_free_t ctx_free);
2167
2175FLECS_API
2177 const ecs_world_t *world);
2178
2186FLECS_API
2188 const ecs_world_t *world);
2189
2194
2200FLECS_API
2202 const ecs_world_t *world);
2203
2212FLECS_API
2214 ecs_world_t *world,
2215 int32_t entity_count);
2216
2232FLECS_API
2234 ecs_world_t *world,
2235 ecs_entity_t id_start,
2236 ecs_entity_t id_end);
2237
2248FLECS_API
2250 ecs_world_t *world,
2251 bool enable);
2252
2257FLECS_API
2259 const ecs_world_t *world);
2260
2274FLECS_API
2276 ecs_world_t *world,
2277 ecs_flags32_t flags);
2278
2312FLECS_API
2314 ecs_world_t *world,
2315 ecs_id_t id,
2316 uint16_t clear_generation,
2317 uint16_t delete_generation,
2318 int32_t min_id_count,
2319 double time_budget_seconds);
2320
2326FLECS_API
2328 const ecs_poly_t *poly);
2329
2335FLECS_API
2337 const ecs_poly_t *poly);
2338
2352FLECS_API
2354 const ecs_poly_t *object,
2355 int32_t type);
2356
2357#define ecs_poly_is(object, type)\
2358 ecs_poly_is_(object, type##_magic)
2359
2367FLECS_API
2369 ecs_entity_t first,
2370 ecs_entity_t second);
2371
2398FLECS_API
2400 ecs_world_t *world);
2401
2419FLECS_API
2421 ecs_world_t *world);
2422
2431FLECS_API
2433 ecs_world_t *world,
2434 ecs_id_t id);
2435
2443FLECS_API
2445 ecs_world_t *world,
2446 ecs_table_t *table);
2447
2466FLECS_API
2468 ecs_world_t *world,
2469 const ecs_entity_desc_t *desc);
2470
2497FLECS_API
2499 ecs_world_t *world,
2500 const ecs_bulk_desc_t *desc);
2501
2511FLECS_API
2513 ecs_world_t *world,
2514 ecs_id_t id,
2515 int32_t count);
2516
2532FLECS_API
2534 ecs_world_t *world,
2535 ecs_entity_t dst,
2536 ecs_entity_t src,
2537 bool copy_value);
2538
2547FLECS_API
2549 ecs_world_t *world,
2550 ecs_entity_t entity);
2551
2559FLECS_API
2561 ecs_world_t *world,
2562 ecs_id_t id);
2563
2581FLECS_API
2583 ecs_world_t *world,
2584 ecs_entity_t entity,
2585 ecs_id_t id);
2586
2595FLECS_API
2597 ecs_world_t *world,
2598 ecs_entity_t entity,
2599 ecs_id_t id);
2600
2626FLECS_API
2628 ecs_world_t *world,
2629 ecs_entity_t entity,
2630 ecs_id_t id);
2631
2638FLECS_API
2640 ecs_world_t *world,
2641 ecs_entity_t entity);
2642
2650FLECS_API
2652 ecs_world_t *world,
2653 ecs_id_t id);
2654
2662FLECS_API
2664 ecs_world_t *world,
2665 ecs_id_t id);
2666
2673FLECS_API
2675 const ecs_world_t *world);
2676
2695FLECS_API
2697 ecs_world_t *world,
2698 ecs_entity_t entity,
2699 bool enabled);
2700
2714FLECS_API
2716 ecs_world_t *world,
2717 ecs_entity_t entity,
2718 ecs_id_t id,
2719 bool enable);
2720
2731FLECS_API
2733 const ecs_world_t *world,
2734 ecs_entity_t entity,
2735 ecs_id_t id);
2736
2758FLECS_API
2759const void* ecs_get_id(
2760 const ecs_world_t *world,
2761 ecs_entity_t entity,
2762 ecs_id_t id);
2763
2775FLECS_API
2777 const ecs_world_t *world,
2778 ecs_entity_t entity,
2779 ecs_id_t id);
2780
2795FLECS_API
2797 ecs_world_t *world,
2798 ecs_entity_t entity,
2799 ecs_id_t id);
2800
2812FLECS_API
2814 ecs_world_t *world,
2815 ecs_entity_t entity,
2816 ecs_id_t id);
2817
2828FLECS_API
2830 const ecs_world_t *world,
2831 ecs_entity_t entity,
2832 ecs_id_t id);
2833
2842FLECS_API
2844 const ecs_world_t *world,
2845 ecs_ref_t *ref,
2846 ecs_id_t id);
2847
2855FLECS_API
2857 const ecs_world_t *world,
2858 ecs_ref_t *ref);
2859
2878FLECS_API
2880 ecs_world_t *world,
2881 ecs_entity_t entity);
2882
2889FLECS_API
2891 ecs_record_t *record);
2892
2912FLECS_API
2914 ecs_world_t *world,
2915 ecs_entity_t entity);
2916
2922FLECS_API
2924 const ecs_record_t *record);
2925
2931FLECS_API
2933 const ecs_record_t *record);
2934
2948FLECS_API
2950 const ecs_world_t *world,
2951 const ecs_record_t *record,
2952 ecs_id_t id);
2953
2962FLECS_API
2964 ecs_world_t *world,
2965 ecs_record_t *record,
2966 ecs_id_t id);
2967
2974FLECS_API
2976 ecs_world_t *world,
2977 const ecs_record_t *record,
2978 ecs_id_t id);
2979
2993FLECS_API
2995 ecs_world_t *world,
2996 ecs_entity_t entity,
2997 ecs_id_t id);
2998
3008FLECS_API
3010 ecs_world_t *world,
3011 ecs_entity_t entity,
3012 ecs_id_t id);
3013
3030FLECS_API
3032 ecs_world_t *world,
3033 ecs_entity_t entity,
3034 ecs_id_t id,
3035 size_t size,
3036 const void *ptr);
3037
3065FLECS_API
3067 const ecs_world_t *world,
3068 ecs_entity_t e);
3069
3095FLECS_API
3097 const ecs_world_t *world,
3098 ecs_entity_t e);
3099
3105FLECS_API
3107 ecs_entity_t e);
3108
3120FLECS_API
3122 ecs_world_t *world,
3123 ecs_entity_t entity);
3124
3141FLECS_API
3143 const ecs_world_t *world,
3144 ecs_entity_t e);
3145
3166FLECS_API
3168 ecs_world_t *world,
3169 ecs_entity_t entity);
3170
3189FLECS_API
3191 ecs_world_t *world,
3192 ecs_id_t id);
3193
3201FLECS_API
3203 const ecs_world_t *world,
3204 ecs_entity_t entity);
3205
3221FLECS_API
3223 const ecs_world_t *world,
3224 ecs_entity_t entity);
3225
3232FLECS_API
3234 const ecs_world_t *world,
3235 ecs_entity_t entity);
3236
3244FLECS_API
3246 const ecs_world_t *world,
3247 const ecs_type_t* type);
3248
3257FLECS_API
3259 const ecs_world_t *world,
3260 const ecs_table_t *table);
3261
3273FLECS_API
3275 const ecs_world_t *world,
3276 ecs_entity_t entity);
3277
3286FLECS_API
3288 const ecs_world_t *world,
3289 ecs_entity_t entity,
3290 ecs_id_t id);
3291
3302FLECS_API
3304 const ecs_world_t *world,
3305 ecs_entity_t entity,
3306 ecs_id_t id);
3307
3322FLECS_API
3324 const ecs_world_t *world,
3325 ecs_entity_t entity,
3326 ecs_entity_t rel,
3327 int32_t index);
3328
3340FLECS_API
3342 const ecs_world_t *world,
3343 ecs_entity_t entity);
3344
3365FLECS_API
3367 const ecs_world_t *world,
3368 ecs_entity_t entity,
3369 ecs_entity_t rel,
3370 ecs_id_t id);
3371
3382FLECS_API
3384 const ecs_world_t *world,
3385 ecs_entity_t entity,
3386 ecs_entity_t rel);
3387
3388typedef struct ecs_flatten_desc_t {
3389 /* When true, the flatten operation will not remove names from entities in
3390 * the flattened tree. This may fail if entities from different subtrees
3391 * have the same name. */
3392 bool keep_names;
3393
3394 /* When true, the flattened tree won't contain information about the
3395 * original depth of the entities. This can reduce fragmentation, but may
3396 * cause existing code, such as cascade queries, to no longer work. */
3397 bool lose_depth;
3399
3424FLECS_API
3426 ecs_world_t *world,
3427 ecs_id_t pair,
3428 const ecs_flatten_desc_t *desc);
3429
3437FLECS_API
3439 const ecs_world_t *world,
3440 ecs_id_t entity);
3441
3459FLECS_API
3460const char* ecs_get_name(
3461 const ecs_world_t *world,
3462 ecs_entity_t entity);
3463
3471FLECS_API
3472const char* ecs_get_symbol(
3473 const ecs_world_t *world,
3474 ecs_entity_t entity);
3475
3487FLECS_API
3489 ecs_world_t *world,
3490 ecs_entity_t entity,
3491 const char *name);
3492
3504FLECS_API
3506 ecs_world_t *world,
3507 ecs_entity_t entity,
3508 const char *symbol);
3509
3521FLECS_API
3523 ecs_world_t *world,
3524 ecs_entity_t entity,
3525 const char *alias);
3526
3538FLECS_API
3540 const ecs_world_t *world,
3541 const char *path);
3542
3552FLECS_API
3554 const ecs_world_t *world,
3555 ecs_entity_t parent,
3556 const char *name);
3557
3576FLECS_API
3578 const ecs_world_t *world,
3579 ecs_entity_t parent,
3580 const char *path,
3581 const char *sep,
3582 const char *prefix,
3583 bool recursive);
3584
3598FLECS_API
3600 const ecs_world_t *world,
3601 const char *symbol,
3602 bool lookup_as_path,
3603 bool recursive);
3604
3624FLECS_API
3626 const ecs_world_t *world,
3627 ecs_entity_t parent,
3628 ecs_entity_t child,
3629 const char *sep,
3630 const char *prefix);
3631
3643 const ecs_world_t *world,
3644 ecs_entity_t parent,
3645 ecs_entity_t child,
3646 const char *sep,
3647 const char *prefix,
3648 ecs_strbuf_t *buf);
3649
3665FLECS_API
3667 ecs_world_t *world,
3668 ecs_entity_t parent,
3669 const char *path,
3670 const char *sep,
3671 const char *prefix);
3672
3687FLECS_API
3689 ecs_world_t *world,
3690 ecs_entity_t entity,
3691 ecs_entity_t parent,
3692 const char *path,
3693 const char *sep,
3694 const char *prefix);
3695
3707FLECS_API
3709 ecs_world_t *world,
3710 ecs_entity_t scope);
3711
3719FLECS_API
3721 const ecs_world_t *world);
3722
3732FLECS_API
3734 ecs_world_t *world,
3735 const char *prefix);
3736
3761FLECS_API
3763 ecs_world_t *world,
3764 const ecs_entity_t *lookup_path);
3765
3772FLECS_API
3774 const ecs_world_t *world);
3775
3800FLECS_API
3802 ecs_world_t *world,
3803 const ecs_component_desc_t *desc);
3804
3814FLECS_API
3816 const ecs_world_t *world,
3817 ecs_id_t id);
3818
3830FLECS_API
3832 ecs_world_t *world,
3833 ecs_entity_t id,
3834 const ecs_type_hooks_t *hooks);
3835
3842FLECS_API
3844 ecs_world_t *world,
3845 ecs_entity_t id);
3846
3870FLECS_API
3872 const ecs_world_t *world,
3873 ecs_id_t id);
3874
3887FLECS_API
3889 const ecs_world_t *world,
3890 ecs_id_t id);
3891
3900FLECS_API
3902 const ecs_world_t *world,
3903 ecs_id_t id);
3904
3924FLECS_API
3926 const ecs_world_t *world,
3927 ecs_id_t id);
3928
3936FLECS_API
3938 ecs_id_t id,
3939 ecs_id_t pattern);
3940
3946FLECS_API
3948 ecs_id_t id);
3949
3955FLECS_API
3957 ecs_id_t id);
3958
3972FLECS_API
3974 const ecs_world_t *world,
3975 ecs_id_t id);
3976
3985FLECS_API
3986ecs_flags32_t ecs_id_get_flags(
3987 const ecs_world_t *world,
3988 ecs_id_t id);
3989
3996FLECS_API
3998 ecs_id_t id_flags);
3999
4007FLECS_API
4009 const ecs_world_t *world,
4010 ecs_id_t id);
4011
4019FLECS_API
4021 const ecs_world_t *world,
4022 ecs_id_t id,
4023 ecs_strbuf_t *buf);
4024
4043FLECS_API
4044ecs_iter_t ecs_term_iter(
4045 const ecs_world_t *world,
4046 ecs_term_t *term);
4047
4056FLECS_API
4058 const ecs_iter_t *it,
4059 ecs_term_t *term);
4060
4070FLECS_API
4072 ecs_iter_t *it);
4073
4082FLECS_API
4083ecs_iter_t ecs_children(
4084 const ecs_world_t *world,
4085 ecs_entity_t parent);
4086
4093FLECS_API
4095 ecs_iter_t *it);
4096
4102FLECS_API
4104 const ecs_term_id_t *id);
4105
4117FLECS_API
4119 const ecs_term_t *term);
4120
4135FLECS_API
4137 const ecs_term_t *term);
4138
4151FLECS_API
4153 const ecs_term_t *term);
4154
4173FLECS_API
4175 const ecs_world_t *world,
4176 ecs_term_t *term);
4177
4186FLECS_API
4188 const ecs_term_t *src);
4189
4200FLECS_API
4202 ecs_term_t *src);
4203
4210FLECS_API
4212 ecs_term_t *term);
4213
4241FLECS_API
4243 ecs_world_t *world,
4244 const ecs_filter_desc_t *desc);
4245
4251FLECS_API
4253 ecs_filter_t *filter);
4254
4268FLECS_API
4270 const ecs_world_t *world,
4271 ecs_filter_t *filter);
4272
4284FLECS_API
4286 const ecs_filter_t *filter);
4287
4296FLECS_API
4298 const ecs_world_t *world,
4299 const ecs_term_t *term);
4300
4309FLECS_API
4311 const ecs_world_t *world,
4312 const ecs_filter_t *filter);
4313
4322FLECS_API
4324 const ecs_world_t *world,
4325 const ecs_filter_t *filter);
4326
4335FLECS_API
4337 const ecs_iter_t *it,
4338 const ecs_filter_t *filter);
4339
4359FLECS_API
4361 const ecs_world_t *world,
4362 const ecs_filter_t *filter);
4363
4373FLECS_API
4375 ecs_iter_t *it);
4376
4383FLECS_API
4385 ecs_iter_t *it);
4386
4392FLECS_API
4394 ecs_filter_t *dst,
4395 ecs_filter_t *src);
4396
4402FLECS_API
4404 ecs_filter_t *dst,
4405 const ecs_filter_t *src);
4406
4450FLECS_API
4452 ecs_world_t *world,
4453 const ecs_query_desc_t *desc);
4454
4462FLECS_API
4464 ecs_query_t *query);
4465
4473FLECS_API
4475 const ecs_query_t *query);
4476
4504FLECS_API
4506 const ecs_world_t *world,
4507 ecs_query_t *query);
4508
4518FLECS_API
4520 ecs_iter_t *iter);
4521
4528FLECS_API
4530 ecs_iter_t *iter);
4531
4542FLECS_API
4544 ecs_iter_t *iter);
4545
4567FLECS_API
4569 ecs_iter_t *iter,
4570 bool when_changed);
4571
4601FLECS_API
4603 ecs_query_t *query,
4604 const ecs_iter_t *it);
4605
4616FLECS_API
4618 ecs_iter_t *it);
4619
4642FLECS_API
4644 ecs_iter_t *it,
4645 uint64_t group_id);
4646
4655FLECS_API
4657 const ecs_query_t *query,
4658 uint64_t group_id);
4659
4668FLECS_API
4670 const ecs_query_t *query,
4671 uint64_t group_id);
4672
4681FLECS_API
4683 const ecs_query_t *query);
4684
4690FLECS_API
4692 const ecs_query_t *query);
4693
4699FLECS_API
4701 const ecs_query_t *query);
4702
4708FLECS_API
4710 const ecs_query_t *query);
4711
4719FLECS_API
4721 const ecs_query_t *query);
4722
4729FLECS_API
4731 const ecs_query_t *query);
4732
4739FLECS_API
4741 const ecs_query_t *query);
4742
4769FLECS_API
4771 ecs_world_t *world,
4772 ecs_event_desc_t *desc);
4773
4774FLECS_API
4775void ecs_enqueue(
4776 ecs_world_t *world,
4777 ecs_event_desc_t *desc);
4778
4788FLECS_API
4790 ecs_world_t *world,
4791 const ecs_observer_desc_t *desc);
4792
4802FLECS_API
4804 ecs_iter_t *it);
4805
4813FLECS_API
4815 const ecs_world_t *world,
4816 ecs_entity_t observer);
4817
4825FLECS_API
4827 const ecs_world_t *world,
4828 ecs_entity_t observer);
4829
4837FLECS_API
4839 const ecs_world_t *world,
4840 ecs_entity_t observer);
4841
4872FLECS_API
4874 const ecs_world_t *world,
4875 const ecs_poly_t *poly,
4876 ecs_iter_t *iter,
4877 ecs_term_t *filter);
4878
4892FLECS_API
4894 ecs_iter_t *it);
4895
4905FLECS_API
4907 ecs_iter_t *it);
4908
4920FLECS_API
4922 ecs_iter_t *it);
4923
4936FLECS_API
4938 ecs_iter_t *it);
4939
4947FLECS_API
4949 ecs_iter_t *it);
4950
4986FLECS_API
4988 ecs_iter_t *it,
4989 int32_t var_id,
4990 ecs_entity_t entity);
4991
4999FLECS_API
5001 ecs_iter_t *it,
5002 int32_t var_id,
5003 const ecs_table_t *table);
5004
5012FLECS_API
5014 ecs_iter_t *it,
5015 int32_t var_id,
5016 const ecs_table_range_t *range);
5017
5030FLECS_API
5032 ecs_iter_t *it,
5033 int32_t var_id);
5034
5048FLECS_API
5050 ecs_iter_t *it,
5051 int32_t var_id);
5052
5066FLECS_API
5068 ecs_iter_t *it,
5069 int32_t var_id);
5070
5082FLECS_API
5084 ecs_iter_t *it,
5085 int32_t var_id);
5086
5098FLECS_API
5100 const ecs_iter_t *it);
5101
5117FLECS_API
5118ecs_iter_t ecs_page_iter(
5119 const ecs_iter_t *it,
5120 int32_t offset,
5121 int32_t limit);
5122
5129FLECS_API
5131 ecs_iter_t *it);
5132
5153FLECS_API
5155 const ecs_iter_t *it,
5156 int32_t index,
5157 int32_t count);
5158
5165FLECS_API
5167 ecs_iter_t *it);
5168
5192FLECS_API
5194 const ecs_iter_t *it,
5195 size_t size,
5196 int32_t index);
5197
5206FLECS_API
5208 const ecs_iter_t *it,
5209 int32_t index);
5210
5221FLECS_API
5223 const ecs_iter_t *it,
5224 int32_t index);
5225
5232FLECS_API
5234 const ecs_iter_t *it,
5235 int32_t index);
5236
5243FLECS_API
5245 const ecs_iter_t *it,
5246 int32_t index);
5247
5256FLECS_API
5258 const ecs_iter_t *it,
5259 int32_t index);
5260
5268FLECS_API
5270 const ecs_iter_t *it,
5271 int32_t index);
5272
5280FLECS_API
5282 const ecs_iter_t *it,
5283 int32_t index);
5284
5298FLECS_API
5300 const ecs_iter_t *it,
5301 int32_t index);
5302
5318FLECS_API
5320 const ecs_table_t *table);
5321
5330FLECS_API
5332 const ecs_world_t *world,
5333 const ecs_table_t *table,
5334 ecs_id_t id);
5335
5345FLECS_API
5347 const ecs_world_t *world,
5348 const ecs_table_t *table,
5349 ecs_id_t id);
5350
5358FLECS_API
5360 const ecs_table_t *table);
5361
5373FLECS_API
5375 const ecs_table_t *table,
5376 int32_t index);
5377
5386FLECS_API
5388 const ecs_table_t *table,
5389 int32_t index);
5390
5399FLECS_API
5401 const ecs_table_t *table,
5402 int32_t index,
5403 int32_t offset);
5404
5413FLECS_API
5415 const ecs_world_t *world,
5416 const ecs_table_t *table,
5417 ecs_id_t id,
5418 int32_t offset);
5419
5427FLECS_API
5429 const ecs_table_t *table,
5430 int32_t index);
5431
5440FLECS_API
5442 const ecs_table_t *table);
5443
5452FLECS_API
5454 const ecs_world_t *world,
5455 const ecs_table_t *table,
5456 ecs_id_t id);
5457
5468FLECS_API
5470 const ecs_world_t *world,
5471 const ecs_table_t *table,
5472 ecs_entity_t rel);
5473
5483FLECS_API
5485 ecs_world_t *world,
5486 ecs_table_t *table,
5487 ecs_id_t id);
5488
5499FLECS_API
5501 ecs_world_t *world,
5502 const ecs_id_t *ids,
5503 int32_t id_count);
5504
5514FLECS_API
5516 ecs_world_t *world,
5517 ecs_table_t *table,
5518 ecs_id_t id);
5519
5535FLECS_API
5537 ecs_world_t *world,
5538 ecs_table_t *table);
5539
5546FLECS_API
5548 ecs_world_t *world,
5549 ecs_table_t *table);
5550
5560FLECS_API
5562 ecs_table_t *table,
5563 ecs_flags32_t flags);
5564
5572FLECS_API
5574 ecs_world_t* world,
5575 ecs_table_t* table,
5576 int32_t row_1,
5577 int32_t row_2);
5578
5601FLECS_API
5603 ecs_world_t *world,
5604 ecs_entity_t entity,
5605 ecs_record_t *record,
5606 ecs_table_t *table,
5607 const ecs_type_t *added,
5608 const ecs_type_t *removed);
5609
5611FLECS_API
5613 const ecs_world_t *world,
5614 ecs_entity_t entity);
5615
5617FLECS_API
5619 const ecs_record_t *r,
5620 int32_t column,
5621 size_t c_size);
5622
5638FLECS_API
5640 const ecs_world_t *world,
5641 const ecs_table_t *table,
5642 ecs_id_t id,
5643 ecs_id_t *id_out);
5644
5677FLECS_API
5679 const ecs_world_t *world,
5680 const ecs_table_t *table,
5681 int32_t offset,
5682 ecs_id_t id,
5683 ecs_id_t *id_out);
5684
5723FLECS_API
5725 const ecs_world_t *world,
5726 const ecs_table_t *table,
5727 int32_t offset,
5728 ecs_id_t id,
5729 ecs_entity_t rel,
5730 ecs_flags32_t flags, /* EcsSelf and/or EcsUp */
5731 ecs_entity_t *subject_out,
5732 ecs_id_t *id_out,
5733 struct ecs_table_record_t **tr_out);
5734
5751FLECS_API
5753 const ecs_world_t *world,
5754 ecs_entity_t type,
5755 void *ptr);
5756
5764FLECS_API
5766 const ecs_world_t *world,
5767 const ecs_type_info_t *ti,
5768 void *ptr);
5769
5776FLECS_API
5778 ecs_world_t *world,
5779 ecs_entity_t type);
5780
5788 ecs_world_t *world,
5789 const ecs_type_info_t *ti);
5790
5799 const ecs_world_t *world,
5800 const ecs_type_info_t *ti,
5801 void *ptr);
5802
5810FLECS_API
5812 const ecs_world_t *world,
5813 ecs_entity_t type,
5814 void* ptr);
5815
5822FLECS_API
5824 ecs_world_t *world,
5825 ecs_entity_t type,
5826 void* ptr);
5827
5836FLECS_API
5838 const ecs_world_t *world,
5839 const ecs_type_info_t *ti,
5840 void* dst,
5841 const void *src);
5842
5851FLECS_API
5853 const ecs_world_t *world,
5854 ecs_entity_t type,
5855 void* dst,
5856 const void *src);
5857
5867 const ecs_world_t *world,
5868 const ecs_type_info_t *ti,
5869 void* dst,
5870 void *src);
5871
5881 const ecs_world_t *world,
5882 ecs_entity_t type,
5883 void* dst,
5884 void *src);
5885
5895 const ecs_world_t *world,
5896 const ecs_type_info_t *ti,
5897 void* dst,
5898 void *src);
5899
5909 const ecs_world_t *world,
5910 ecs_entity_t type,
5911 void* dst,
5912 void *src);
5913
5927#include "flecs/addons/flecs_c.h"
5928
5929#ifdef __cplusplus
5930}
5931#endif
5932
5933#include "flecs/private/addons.h"
5934
5935#endif
The deprecated addon contains deprecated operations.
Extends the core API with convenience macros for C applications.
ecs_entity_t ecs_set_with(ecs_world_t *world, ecs_id_t id)
Set current with id.
void ecs_override_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Add override for (component) id.
void ecs_add_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Add a (component) id to an entity.
void ecs_remove_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Remove a (component) id from an entity.
void ecs_clear(ecs_world_t *world, ecs_entity_t entity)
Clear all components.
ecs_id_t ecs_get_with(const ecs_world_t *world)
Get current with id.
void ecs_remove_all(ecs_world_t *world, ecs_id_t id)
Remove all instances of the specified (component) id.
struct EcsTarget EcsTarget
Target data for flattened relationships.
struct EcsIdentifier EcsIdentifier
A (string) identifier.
ecs_iterable_t EcsIterable
Component for iterable entities.
Definition flecs.h:1333
struct EcsPoly EcsPoly
Component for storing a poly object.
struct EcsComponent EcsComponent
Component information.
const ecs_entity_t EcsOnRemove
Event that triggers when an id is removed from an entity.
const ecs_entity_t EcsThis
This entity.
const ecs_entity_t EcsWildcard
Wildcard entity ("*").
const ecs_entity_t EcsName
Tag to indicate name identifier.
const ecs_entity_t EcsAcyclic
Marks a relationship as acyclic.
const ecs_entity_t EcsSymmetric
Marks relationship as commutative.
const ecs_entity_t EcsAlias
Tag to indicate alias identifier.
const ecs_entity_t EcsOnSet
Event that triggers when a component is set for an entity.
const ecs_entity_t EcsReflexive
Marks a relationship as reflexive.
const ecs_entity_t EcsEmpty
Tag used to indicate query is empty.
const ecs_entity_t EcsOneOf
Ensure that relationship target is child of specified entity.
const ecs_entity_t EcsOnTableDelete
Event that triggers when a table is deleted.
const ecs_entity_t EcsOnTableCreate
Event that triggers when a table is created.
const ecs_entity_t EcsTraversable
Marks a relationship as traversable.
const ecs_entity_t EcsUnSet
Event that triggers when a component is unset for an entity.
const ecs_entity_t EcsIsA
Used to express inheritance relationships.
const ecs_entity_t EcsExclusive
Can be added to relationship to indicate that the relationship can only occur once on an entity.
const ecs_entity_t EcsSymbol
Tag to indicate symbol identifier.
const ecs_entity_t EcsDependsOn
Used to express dependency relationships.
const ecs_entity_t EcsAlwaysOverride
Ensures a component is always overridden.
const ecs_entity_t EcsTransitive
Marks a relationship as transitive.
const ecs_entity_t EcsDelete
Delete cleanup policy.
const ecs_entity_t EcsOnTableFill
Event that triggers when a table becomes non-empty.
const ecs_entity_t EcsChildOf
Used to express parent-child relationships.
const ecs_entity_t EcsFlecsCore
Core module scope.
const ecs_entity_t EcsMonitor
Event that triggers observer when an entity starts/stops matching a query.
const ecs_entity_t EcsOnTableEmpty
Event that triggers when a table becomes empty (doesn't emit on creation).
const ecs_entity_t EcsWorld
Entity associated with world (used for "attaching" components to world)
const ecs_entity_t EcsPrivate
Tag to indicate an entity/component/system is private to a module.
const ecs_entity_t EcsRemove
Remove cleanup policy.
const ecs_entity_t EcsSlotOf
Used to express a slot (used with prefab inheritance)
const ecs_entity_t EcsModule
Tag added to module entities.
const ecs_entity_t EcsOnAdd
Event that triggers when an id is added to an entity.
const ecs_entity_t EcsPrefab
Tag added to prefab entities.
const ecs_entity_t EcsUnion
Tag to indicate that relationship is stored as union.
const ecs_entity_t EcsAny
Any entity ("_").
const ecs_entity_t EcsWith
Ensure that a component always is added together with another component.
const ecs_entity_t EcsTag
Can be added to relationship to indicate that it should never hold data, even when it or the relation...
const ecs_entity_t EcsOnDelete
Relationship used for specifying cleanup behavior.
const ecs_entity_t EcsOnDeleteTarget
Relationship used to define what should happen when a target entity (second element of a pair) is del...
const ecs_entity_t EcsFlecs
Root scope for builtin flecs entities.
const ecs_entity_t EcsDisabled
When this tag is added to an entity it is skipped by queries, unless EcsDisabled is explicitly querie...
const ecs_entity_t EcsDontInherit
Ensures that component is never inherited from an IsA target.
const ecs_entity_t EcsPanic
Panic cleanup policy.
const ecs_entity_t EcsDefaultChildComponent
Used like (EcsDefaultChildComponent, Component).
const ecs_entity_t EcsFinal
Ensures that entity/component cannot be used as target in IsA relationship.
const ecs_entity_t EcsVariable
Variable entity ("$").
const ecs_entity_t EcsFlatten
Tag added to root entity to indicate its subtree should be flattened.
bool ecs_defer_end(ecs_world_t *world)
End block of operations to defer.
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
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
Target data for flattened relationships.
Definition flecs.h:1327
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