Flecs: include/flecs.h Source File
Description: A fast entity component system (ECS) for C & C++

| Flecs v4.1 A fast entity component system (ECS) for C & C++

Loading...
Searching...
No Matches
flecs.h
Go to the documentation of this file.
1
7
8#ifndef FLECS_H
9#define FLECS_H
10
17
25
32
33/* Flecs version macros */
34#define FLECS_VERSION_MAJOR 4
35#define FLECS_VERSION_MINOR 1
36#define FLECS_VERSION_PATCH 3
37
39#define FLECS_VERSION FLECS_VERSION_IMPL(\
40 FLECS_VERSION_MAJOR, FLECS_VERSION_MINOR, FLECS_VERSION_PATCH)
41
45#ifdef FLECS_CONFIG_HEADER
46#include "flecs_config.h"
47#endif
48
51#ifndef ecs_float_t
52#define ecs_float_t float
53#endif
54
58#ifndef ecs_ftime_t
59#define ecs_ftime_t ecs_float_t
60#endif
61
62
68// #define FLECS_ACCURATE_COUNTERS
69
75// #define FLECS_DISABLE_COUNTERS
76
77/* Make sure provided configuration is valid */
78#if defined(FLECS_DEBUG) && defined(FLECS_NDEBUG)
79#warning "invalid configuration: cannot both define FLECS_DEBUG and FLECS_NDEBUG"
80#endif
81#if defined(FLECS_DEBUG) && defined(NDEBUG)
82#warning "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
111#ifdef FLECS_DEBUG
112#ifndef FLECS_DEBUG_INFO
113#define FLECS_DEBUG_INFO
114#endif
115#endif
116
117/* Tip: if you see weird behavior that you think might be a bug, make sure to
118 * test with the FLECS_DEBUG or FLECS_SANITIZE flags enabled. There's a good
119 * chance that this gives you more information about the issue! */
120
134// #define FLECS_SOFT_ASSERT
135
141// #define FLECS_KEEP_ASSERT
142
149// #define FLECS_DEFAULT_TO_UNCACHED_QUERIES
150
159// #define FLECS_CPP_NO_AUTO_REGISTRATION
160
168// #define FLECS_CPP_NO_ENUM_REFLECTION
169
174// #define FLECS_NO_ALWAYS_INLINE
175
203// #define FLECS_CUSTOM_BUILD
204
205#ifndef FLECS_CUSTOM_BUILD
206#define FLECS_ALERTS
207#define FLECS_APP
208// #define FLECS_C /**< C API convenience macros, always enabled */
209#define FLECS_CPP
210#define FLECS_DOC
211// #define FLECS_JOURNAL /**< Journaling addon */
212#define FLECS_JSON
213#define FLECS_HTTP
214#define FLECS_LOG
215#define FLECS_META
216#define FLECS_METRICS
217#define FLECS_MODULE
218#define FLECS_OS_API_IMPL
219// #define FLECS_PERF_TRACE /**< Enable performance tracing */
220#define FLECS_PIPELINE
221#define FLECS_REST
222#define FLECS_PARSER
223#define FLECS_QUERY_DSL
224#define FLECS_SCRIPT
225// #define FLECS_SCRIPT_MATH /**< Math functions for flecs script (may require linking with libm) */
226#define FLECS_SYSTEM
227#define FLECS_STATS
228#define FLECS_TIMER
229#define FLECS_UNITS
230#endif // ifndef FLECS_CUSTOM_BUILD
231
235// #define FLECS_LOW_FOOTPRINT
236#ifdef FLECS_LOW_FOOTPRINT
237#define FLECS_HI_COMPONENT_ID 16
238#define FLECS_HI_ID_RECORD_ID 16
239#define FLECS_ENTITY_PAGE_BITS 6
240#define FLECS_USE_OS_ALLOC
241#define FLECS_DEFAULT_TO_UNCACHED_QUERIES
242#endif
243
258#ifndef FLECS_HI_COMPONENT_ID
259#define FLECS_HI_COMPONENT_ID 256
260#endif
261
268#ifndef FLECS_HI_ID_RECORD_ID
269#define FLECS_HI_ID_RECORD_ID 1024
270#endif
271
277#ifndef FLECS_SPARSE_PAGE_BITS
278#define FLECS_SPARSE_PAGE_BITS 6
279#endif
280
283#ifndef FLECS_ENTITY_PAGE_BITS
284#define FLECS_ENTITY_PAGE_BITS 10
285#endif
286
291// #define FLECS_USE_OS_ALLOC
292
295#ifndef FLECS_ID_DESC_MAX
296#define FLECS_ID_DESC_MAX 32
297#endif
298
301#ifndef FLECS_EVENT_DESC_MAX
302#define FLECS_EVENT_DESC_MAX 8
303#endif
304
307#define FLECS_VARIABLE_COUNT_MAX 64
308
311#ifndef FLECS_TERM_COUNT_MAX
312#define FLECS_TERM_COUNT_MAX 32
313#endif
314
317#ifndef FLECS_TERM_ARG_COUNT_MAX
318#define FLECS_TERM_ARG_COUNT_MAX 16
319#endif
320
323#ifndef FLECS_QUERY_VARIABLE_COUNT_MAX
324#define FLECS_QUERY_VARIABLE_COUNT_MAX 64
325#endif
326
329#ifndef FLECS_QUERY_SCOPE_NESTING_MAX
330#define FLECS_QUERY_SCOPE_NESTING_MAX 8
331#endif
332
337#ifndef FLECS_DAG_DEPTH_MAX
338#define FLECS_DAG_DEPTH_MAX 128
339#endif
340
342
343#include "flecs/private/api_defines.h"
344
351
354 typedef uint64_t ecs_id_t;
355
361 typedef ecs_id_t ecs_entity_t;
362
378 typedef struct {
379 ecs_id_t *array;
380 int32_t count;
381} ecs_type_t;
382
405 typedef struct ecs_world_t ecs_world_t;
406
408 typedef struct ecs_stage_t ecs_stage_t;
409
411 typedef struct ecs_table_t ecs_table_t;
412
414 typedef struct ecs_term_t ecs_term_t;
415
417 typedef struct ecs_query_t ecs_query_t;
418
436 typedef struct ecs_observer_t ecs_observer_t;
437
441 typedef struct ecs_observable_t ecs_observable_t;
442
447 typedef struct ecs_iter_t ecs_iter_t;
448
457 typedef struct ecs_ref_t ecs_ref_t;
458
462 typedef struct ecs_type_hooks_t ecs_type_hooks_t;
463
467 typedef struct ecs_type_info_t ecs_type_info_t;
468
470 typedef struct ecs_record_t ecs_record_t;
471
473 typedef struct ecs_component_record_t ecs_component_record_t;
474
494 typedef void ecs_poly_t;
495
497 typedef struct ecs_mixins_t ecs_mixins_t;
498
500 typedef struct ecs_header_t {
501 int32_t type;
502 int32_t refcount;
503 ecs_mixins_t *mixins;
504} ecs_header_t;
505
506typedef struct ecs_table_record_t ecs_table_record_t;
507
509
510#include "flecs/datastructures/vec.h" /* Vector datatype */
511#include "flecs/datastructures/sparse.h" /* Sparse set */
512#include "flecs/datastructures/block_allocator.h" /* Block allocator */
513#include "flecs/datastructures/stack_allocator.h" /* Stack allocator */
514#include "flecs/datastructures/map.h" /* Map */
515#include "flecs/datastructures/allocator.h" /* Allocator */
516#include "flecs/datastructures/strbuf.h" /* String builder */
517#include "flecs/os_api.h" /* Abstraction for operating system functions */
518
519#ifdef __cplusplus
520extern "C" {
521#endif
522
529
530
537
547 typedef void (*ecs_run_action_t)(
548 ecs_iter_t *it);
549
556 typedef void (*ecs_iter_action_t)(
557 ecs_iter_t *it);
558
566 typedef bool (*ecs_iter_next_action_t)(
567 ecs_iter_t *it);
568
574 typedef void (*ecs_iter_fini_action_t)(
575 ecs_iter_t *it);
576
578 typedef int (*ecs_order_by_action_t)(
579 ecs_entity_t e1,
580 const void *ptr1,
581 ecs_entity_t e2,
582 const void *ptr2);
583
585 typedef void (*ecs_sort_table_action_t)(
586 ecs_world_t* world,
587 ecs_table_t* table,
588 ecs_entity_t* entities,
589 void* ptr,
590 int32_t size,
591 int32_t lo,
592 int32_t hi,
593 ecs_order_by_action_t order_by);
594
596 typedef uint64_t (*ecs_group_by_action_t)(
597 ecs_world_t *world,
598 ecs_table_t *table,
599 ecs_id_t group_id,
600 void *ctx);
601
603 typedef void* (*ecs_group_create_action_t)(
604 ecs_world_t *world,
605 uint64_t group_id,
606 void *group_by_ctx); /* from ecs_query_desc_t */
607
609 typedef void (*ecs_group_delete_action_t)(
610 ecs_world_t *world,
611 uint64_t group_id,
612 void *group_ctx, /* return value from ecs_group_create_action_t */
613 void *group_by_ctx); /* from ecs_query_desc_t */
614
616 typedef void (*ecs_module_action_t)(
617 ecs_world_t *world);
618
620 typedef void (*ecs_fini_action_t)(
621 ecs_world_t *world,
622 void *ctx);
623
625 typedef void (*ecs_ctx_free_t)(
626 void *ctx);
627
629 typedef int (*ecs_compare_action_t)(
630 const void *ptr1,
631 const void *ptr2);
632
634 typedef uint64_t (*ecs_hash_value_action_t)(
635 const void *ptr);
636
638 typedef void (*ecs_xtor_t)(
639 void *ptr,
640 int32_t count,
641 const ecs_type_info_t *type_info);
642
644 typedef void (*ecs_copy_t)(
645 void *dst_ptr,
646 const void *src_ptr,
647 int32_t count,
648 const ecs_type_info_t *type_info);
649
651 typedef void (*ecs_move_t)(
652 void *dst_ptr,
653 void *src_ptr,
654 int32_t count,
655 const ecs_type_info_t *type_info);
656
658 typedef int (*ecs_cmp_t)(
659 const void *a_ptr,
660 const void *b_ptr,
661 const ecs_type_info_t *type_info);
662
664 typedef bool (*ecs_equals_t)(
665 const void *a_ptr,
666 const void *b_ptr,
667 const ecs_type_info_t *type_info);
668
670 typedef void (*flecs_poly_dtor_t)(
671 ecs_poly_t *poly);
672
674
681
683 typedef enum ecs_inout_kind_t {
684 EcsInOutDefault,
685 EcsInOutNone,
686 EcsInOutFilter,
687 EcsInOut,
688 EcsIn,
689 EcsOut,
690} ecs_inout_kind_t;
691
693 typedef enum ecs_oper_kind_t {
694 EcsAnd,
695 EcsOr,
696 EcsNot,
697 EcsOptional,
698 EcsAndFrom,
699 EcsOrFrom,
700 EcsNotFrom,
701} ecs_oper_kind_t;
702
704 typedef enum ecs_query_cache_kind_t {
705 EcsQueryCacheDefault,
706 EcsQueryCacheAuto,
707 EcsQueryCacheAll,
708 EcsQueryCacheNone,
709} ecs_query_cache_kind_t;
710
711/* Term id flags */
712
717#define EcsSelf (1llu << 63)
718
723#define EcsUp (1llu << 62)
724
729#define EcsTrav (1llu << 61)
730
735#define EcsCascade (1llu << 60)
736
741#define EcsDesc (1llu << 59)
742
747#define EcsIsVariable (1llu << 58)
748
753#define EcsIsEntity (1llu << 57)
754
759#define EcsIsName (1llu << 56)
760
765#define EcsTraverseFlags (EcsSelf|EcsUp|EcsTrav|EcsCascade|EcsDesc)
766
771#define EcsTermRefFlags (EcsTraverseFlags|EcsIsVariable|EcsIsEntity|EcsIsName)
772
774 typedef struct ecs_term_ref_t {
775 ecs_entity_t id;
780
781 const char *name;
786} ecs_term_ref_t;
787
789 struct ecs_term_t {
790 ecs_id_t id;
794
795 ecs_term_ref_t src;
796 ecs_term_ref_t first;
797 ecs_term_ref_t second;
798
799 ecs_entity_t trav;
802
803 int16_t inout;
804 int16_t oper;
805
806 int8_t field_index;
807 ecs_flags16_t flags_;
808};
809
813 struct ecs_query_t {
814 ecs_header_t hdr;
815
816 ecs_term_t *terms;
817 int32_t *sizes;
818 ecs_id_t *ids;
819
820 uint64_t bloom_filter;
821 ecs_flags32_t flags;
822 int8_t var_count;
823 int8_t term_count;
824 int8_t field_count;
825
826 /* Bitmasks for quick field information lookups */
827 ecs_termset_t fixed_fields;
828 ecs_termset_t var_fields;
829 ecs_termset_t static_id_fields;
830 ecs_termset_t data_fields;
831 ecs_termset_t write_fields;
832 ecs_termset_t read_fields;
833 ecs_termset_t row_fields;
834 ecs_termset_t shared_readonly_fields;
835 ecs_termset_t set_fields;
836
837 ecs_query_cache_kind_t cache_kind;
838
839 char **vars;
840
841 void *ctx;
842 void *binding_ctx;
843
844 ecs_entity_t entity;
845 ecs_world_t *real_world;
846 ecs_world_t *world;
847
848 int32_t eval_count;
849};
850
854 struct ecs_observer_t {
855 ecs_header_t hdr;
856
857 ecs_query_t *query;
858
860 ecs_entity_t events[FLECS_EVENT_DESC_MAX];
861 int32_t event_count;
862
863 ecs_iter_action_t callback;
864 ecs_run_action_t run;
865
866 void *ctx;
867 void *callback_ctx;
868 void *run_ctx;
869
870 ecs_ctx_free_t ctx_free;
871 ecs_ctx_free_t callback_ctx_free;
872 ecs_ctx_free_t run_ctx_free;
873
874 ecs_observable_t *observable;
875
876 ecs_world_t *world;
877 ecs_entity_t entity;
878};
879
881
886
887/* Flags that can be used to check which hooks a type has set */
888#define ECS_TYPE_HOOK_CTOR ECS_CAST(ecs_flags32_t, 1 << 0)
889#define ECS_TYPE_HOOK_DTOR ECS_CAST(ecs_flags32_t, 1 << 1)
890#define ECS_TYPE_HOOK_COPY ECS_CAST(ecs_flags32_t, 1 << 2)
891#define ECS_TYPE_HOOK_MOVE ECS_CAST(ecs_flags32_t, 1 << 3)
892#define ECS_TYPE_HOOK_COPY_CTOR ECS_CAST(ecs_flags32_t, 1 << 4)
893#define ECS_TYPE_HOOK_MOVE_CTOR ECS_CAST(ecs_flags32_t, 1 << 5)
894#define ECS_TYPE_HOOK_CTOR_MOVE_DTOR ECS_CAST(ecs_flags32_t, 1 << 6)
895#define ECS_TYPE_HOOK_MOVE_DTOR ECS_CAST(ecs_flags32_t, 1 << 7)
896#define ECS_TYPE_HOOK_CMP ECS_CAST(ecs_flags32_t, 1 << 8)
897#define ECS_TYPE_HOOK_EQUALS ECS_CAST(ecs_flags32_t, 1 << 9)
898
899
900/* Flags that can be used to set/check which hooks of a type are invalid */
901#define ECS_TYPE_HOOK_CTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 10)
902#define ECS_TYPE_HOOK_DTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 12)
903#define ECS_TYPE_HOOK_COPY_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 13)
904#define ECS_TYPE_HOOK_MOVE_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 14)
905#define ECS_TYPE_HOOK_COPY_CTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 15)
906#define ECS_TYPE_HOOK_MOVE_CTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 16)
907#define ECS_TYPE_HOOK_CTOR_MOVE_DTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 17)
908#define ECS_TYPE_HOOK_MOVE_DTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 18)
909#define ECS_TYPE_HOOK_CMP_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 19)
910#define ECS_TYPE_HOOK_EQUALS_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 20)
911
912
913/* All valid hook flags */
914#define ECS_TYPE_HOOKS (ECS_TYPE_HOOK_CTOR|ECS_TYPE_HOOK_DTOR|\
915 ECS_TYPE_HOOK_COPY|ECS_TYPE_HOOK_MOVE|ECS_TYPE_HOOK_COPY_CTOR|\
916 ECS_TYPE_HOOK_MOVE_CTOR|ECS_TYPE_HOOK_CTOR_MOVE_DTOR|\
917 ECS_TYPE_HOOK_MOVE_DTOR|ECS_TYPE_HOOK_CMP|ECS_TYPE_HOOK_EQUALS)
918
919/* All invalid hook flags */
920#define ECS_TYPE_HOOKS_ILLEGAL (ECS_TYPE_HOOK_CTOR_ILLEGAL|\
921 ECS_TYPE_HOOK_DTOR_ILLEGAL|ECS_TYPE_HOOK_COPY_ILLEGAL|\
922 ECS_TYPE_HOOK_MOVE_ILLEGAL|ECS_TYPE_HOOK_COPY_CTOR_ILLEGAL|\
923 ECS_TYPE_HOOK_MOVE_CTOR_ILLEGAL|ECS_TYPE_HOOK_CTOR_MOVE_DTOR_ILLEGAL|\
924 ECS_TYPE_HOOK_MOVE_DTOR_ILLEGAL|ECS_TYPE_HOOK_CMP_ILLEGAL|\
925 ECS_TYPE_HOOK_EQUALS_ILLEGAL)
926 struct ecs_type_hooks_t {
927 ecs_xtor_t ctor;
928 ecs_xtor_t dtor;
929 ecs_copy_t copy;
930 ecs_move_t move;
931
933 ecs_copy_t copy_ctor;
934
936 ecs_move_t move_ctor;
937
942 ecs_move_t ctor_move_dtor;
943
948 ecs_move_t move_dtor;
949
951 ecs_cmp_t cmp;
952
954 ecs_equals_t equals;
955
960 ecs_flags32_t flags;
961
964 ecs_iter_action_t on_add;
965
969 ecs_iter_action_t on_set;
970
974 ecs_iter_action_t on_remove;
975
980 ecs_iter_action_t on_replace;
981
982 void *ctx;
983 void *binding_ctx;
984 void *lifecycle_ctx;
985
986 ecs_ctx_free_t ctx_free;
987 ecs_ctx_free_t binding_ctx_free;
988 ecs_ctx_free_t lifecycle_ctx_free;
989};
990
995 struct ecs_type_info_t {
996 ecs_size_t size;
997 ecs_size_t alignment;
998 ecs_type_hooks_t hooks;
999 ecs_entity_t component;
1000 const char *name;
1001};
1002
1003#include "flecs/private/api_types.h" /* Supporting API types */
1004#include "flecs/private/api_support.h" /* Supporting API functions */
1005#include "flecs/datastructures/hashmap.h" /* Hashmap */
1006#include "flecs/private/api_internals.h" /* Supporting API functions */
1007
1009 typedef struct ecs_value_t {
1010 ecs_entity_t type;
1011 void *ptr;
1012} ecs_value_t;
1013
1018 typedef struct ecs_entity_desc_t {
1019 int32_t _canary;
1020
1021 ecs_entity_t id;
1022
1023 ecs_entity_t parent;
1024
1025 const char *name;
1029
1030 const char *sep;
1033
1034 const char *root_sep;
1035
1036 const char *symbol;
1045
1046 bool use_low_id;
1049
1051 const ecs_id_t *add;
1052
1054 const ecs_value_t *set;
1055
1057 const char *add_expr;
1058} ecs_entity_desc_t;
1059
1064 typedef struct ecs_bulk_desc_t {
1065 int32_t _canary;
1066
1067 ecs_entity_t *entities;
1071
1072 int32_t count;
1073
1074 ecs_id_t ids[FLECS_ID_DESC_MAX];
1075
1076 void **data;
1082
1083 ecs_table_t *table;
1087
1088} ecs_bulk_desc_t;
1089
1094 typedef struct ecs_component_desc_t {
1095 int32_t _canary;
1096
1098 ecs_entity_t entity;
1099
1101 ecs_type_info_t type;
1102} ecs_component_desc_t;
1103
1142 struct ecs_iter_t {
1143 /* World */
1144 ecs_world_t *world;
1145 ecs_world_t *real_world;
1146
1147 /* Matched data */
1148 int32_t offset;
1149 int32_t count;
1150 const ecs_entity_t *entities;
1151 void **ptrs;
1152 const ecs_table_record_t **trs;
1153 const ecs_size_t *sizes;
1154 ecs_table_t *table;
1155 ecs_table_t *other_table;
1156 ecs_id_t *ids;
1157 ecs_entity_t *sources;
1158 ecs_flags64_t constrained_vars;
1159 ecs_termset_t set_fields;
1160 ecs_termset_t ref_fields;
1161 ecs_termset_t row_fields;
1162 ecs_termset_t up_fields;
1163
1164 /* Input information */
1165 ecs_entity_t system;
1166 ecs_entity_t event;
1167 ecs_id_t event_id;
1168 int32_t event_cur;
1169
1170 /* Query information */
1171 int8_t field_count;
1172 int8_t term_index;
1175 const ecs_query_t *query;
1176
1177 /* Context */
1178 void *param;
1179 void *ctx;
1180 void *binding_ctx;
1181 void *callback_ctx;
1182 void *run_ctx;
1183
1184 /* Time */
1185 ecs_ftime_t delta_time;
1186 ecs_ftime_t delta_system_time;
1187
1188 /* Iterator counters */
1189 int32_t frame_offset;
1190
1191 /* Misc */
1192 ecs_flags32_t flags;
1193 ecs_entity_t interrupted_by;
1194 ecs_iter_private_t priv_;
1195
1196 /* Chained iterators */
1197 ecs_iter_next_action_t next;
1198 ecs_iter_action_t callback;
1199 ecs_iter_fini_action_t fini;
1200 ecs_iter_t *chain_it;
1201};
1202
1203
1208#define EcsQueryMatchPrefab (1u << 1u)
1209
1214#define EcsQueryMatchDisabled (1u << 2u)
1215
1220#define EcsQueryMatchEmptyTables (1u << 3u)
1221
1226#define EcsQueryAllowUnresolvedByName (1u << 6u)
1227
1232#define EcsQueryTableOnly (1u << 7u)
1233
1244#define EcsQueryDetectChanges (1u << 8u)
1245
1246
1251 typedef struct ecs_query_desc_t {
1253 int32_t _canary;
1254
1256 ecs_term_t terms[FLECS_TERM_COUNT_MAX];
1257
1259 const char *expr;
1260
1262 ecs_query_cache_kind_t cache_kind;
1263
1265 ecs_flags32_t flags;
1266
1270 ecs_order_by_action_t order_by_callback;
1271
1274 ecs_sort_table_action_t order_by_table_callback;
1275
1278 ecs_entity_t order_by;
1279
1282 ecs_id_t group_by;
1283
1289 ecs_group_by_action_t group_by_callback;
1290
1293 ecs_group_create_action_t on_group_create;
1294
1297 ecs_group_delete_action_t on_group_delete;
1298
1300 void *group_by_ctx;
1301
1303 ecs_ctx_free_t group_by_ctx_free;
1304
1306 void *ctx;
1307
1309 void *binding_ctx;
1310
1312 ecs_ctx_free_t ctx_free;
1313
1315 ecs_ctx_free_t binding_ctx_free;
1316
1318 ecs_entity_t entity;
1319} ecs_query_desc_t;
1320
1325 typedef struct ecs_observer_desc_t {
1327 int32_t _canary;
1328
1330 ecs_entity_t entity;
1331
1333 ecs_query_desc_t query;
1334
1336 ecs_entity_t events[FLECS_EVENT_DESC_MAX];
1337
1340 bool yield_existing;
1341
1343 ecs_iter_action_t callback;
1344
1351 ecs_run_action_t run;
1352
1354 void *ctx;
1355
1357 ecs_ctx_free_t ctx_free;
1358
1360 void *callback_ctx;
1361
1363 ecs_ctx_free_t callback_ctx_free;
1364
1366 void *run_ctx;
1367
1369 ecs_ctx_free_t run_ctx_free;
1370
1372 int32_t *last_event_id;
1373 int8_t term_index_;
1374 ecs_flags32_t flags_;
1375} ecs_observer_desc_t;
1376
1381 typedef struct ecs_event_desc_t {
1383 ecs_entity_t event;
1384
1388 const ecs_type_t *ids;
1389
1391 ecs_table_t *table;
1392
1395 ecs_table_t *other_table;
1396
1398 int32_t offset;
1399
1403 int32_t count;
1404
1406 ecs_entity_t entity;
1407
1412 void *param;
1413
1417 const void *const_param;
1418
1420 ecs_poly_t *observable;
1421
1423 ecs_flags32_t flags;
1424} ecs_event_desc_t;
1425
1426
1433
1435 typedef struct ecs_build_info_t {
1436 const char *compiler;
1437 const char **addons;
1438 const char **flags;
1439 const char *version;
1440 int16_t version_major;
1441 int16_t version_minor;
1442 int16_t version_patch;
1443 bool debug;
1444 bool sanitize;
1445 bool perf_trace;
1446} ecs_build_info_t;
1447
1449 typedef struct ecs_world_info_t {
1450 ecs_entity_t last_component_id;
1451 ecs_entity_t min_id;
1452 ecs_entity_t max_id;
1453
1454 ecs_ftime_t delta_time_raw;
1455 ecs_ftime_t delta_time;
1456 ecs_ftime_t time_scale;
1457 ecs_ftime_t target_fps;
1458 ecs_ftime_t frame_time_total;
1459 ecs_ftime_t system_time_total;
1460 ecs_ftime_t emit_time_total;
1461 ecs_ftime_t merge_time_total;
1462 ecs_ftime_t rematch_time_total;
1463 double world_time_total;
1464 double world_time_total_raw;
1465
1466 int64_t frame_count_total;
1467 int64_t merge_count_total;
1468 int64_t eval_comp_monitors_total;
1469 int64_t rematch_count_total;
1470
1471 int64_t id_create_total;
1472 int64_t id_delete_total;
1473 int64_t table_create_total;
1474 int64_t table_delete_total;
1475 int64_t pipeline_build_count_total;
1476 int64_t systems_ran_total;
1477 int64_t observers_ran_total;
1478 int64_t queries_ran_total;
1479
1480 int32_t tag_id_count;
1481 int32_t component_id_count;
1482 int32_t pair_id_count;
1483
1484 int32_t table_count;
1485
1486 uint32_t creation_time;
1487
1488 /* -- Command counts -- */
1489 struct {
1490 int64_t add_count;
1491 int64_t remove_count;
1492 int64_t delete_count;
1493 int64_t clear_count;
1494 int64_t set_count;
1495 int64_t ensure_count;
1496 int64_t modified_count;
1497 int64_t discard_count;
1498 int64_t event_count;
1499 int64_t other_count;
1500 int64_t batched_entity_count;
1501 int64_t batched_command_count;
1502 } cmd;
1503
1504 const char *name_prefix;
1508} ecs_world_info_t;
1509
1511 typedef struct ecs_query_group_info_t {
1512 uint64_t id;
1513 int32_t match_count;
1514 int32_t table_count;
1515 void *ctx;
1516} ecs_query_group_info_t;
1517
1519
1526
1528 typedef struct EcsIdentifier {
1529 char *value;
1530 ecs_size_t length;
1531 uint64_t hash;
1532 uint64_t index_hash;
1533 ecs_hashmap_t *index;
1534} EcsIdentifier;
1535
1537 typedef struct EcsComponent {
1538 ecs_size_t size;
1539 ecs_size_t alignment;
1540} EcsComponent;
1541
1543 typedef struct EcsPoly {
1544 ecs_poly_t *poly;
1545} EcsPoly;
1546
1552 typedef struct EcsDefaultChildComponent {
1553 ecs_id_t component;
1554} EcsDefaultChildComponent;
1555
1558
1559/* Only include deprecated definitions if deprecated addon is required */
1560#ifdef FLECS_DEPRECATED
1561#include "flecs/addons/deprecated.h"
1562#endif
1563
1570
1577
1579FLECS_API extern const ecs_id_t ECS_PAIR;
1580
1582FLECS_API extern const ecs_id_t ECS_AUTO_OVERRIDE;
1583
1585FLECS_API extern const ecs_id_t ECS_TOGGLE;
1586
1588
1593
1594/* Builtin component ids */
1595
1597FLECS_API extern const ecs_entity_t ecs_id(EcsComponent);
1598
1600FLECS_API extern const ecs_entity_t ecs_id(EcsIdentifier);
1601
1603FLECS_API extern const ecs_entity_t ecs_id(EcsPoly);
1604
1606FLECS_API extern const ecs_entity_t ecs_id(EcsDefaultChildComponent);
1607
1609FLECS_API extern const ecs_entity_t EcsQuery;
1610
1612FLECS_API extern const ecs_entity_t EcsObserver;
1613
1615FLECS_API extern const ecs_entity_t EcsSystem;
1616
1618FLECS_API extern const ecs_entity_t ecs_id(EcsTickSource);
1619
1621FLECS_API extern const ecs_entity_t ecs_id(EcsPipelineQuery);
1622
1624FLECS_API extern const ecs_entity_t ecs_id(EcsTimer);
1625
1627FLECS_API extern const ecs_entity_t ecs_id(EcsRateFilter);
1628
1630FLECS_API extern const ecs_entity_t EcsFlecs;
1631
1633FLECS_API extern const ecs_entity_t EcsFlecsCore;
1634
1636FLECS_API extern const ecs_entity_t EcsWorld;
1637
1639FLECS_API extern const ecs_entity_t EcsWildcard;
1640
1642FLECS_API extern const ecs_entity_t EcsAny;
1643
1645FLECS_API extern const ecs_entity_t EcsThis;
1646
1648FLECS_API extern const ecs_entity_t EcsVariable;
1649
1657FLECS_API extern const ecs_entity_t EcsTransitive;
1658
1666FLECS_API extern const ecs_entity_t EcsReflexive;
1667
1678FLECS_API extern const ecs_entity_t EcsFinal;
1679
1685FLECS_API extern const ecs_entity_t EcsInheritable;
1686
1688FLECS_API extern const ecs_entity_t EcsOnInstantiate;
1689
1693FLECS_API extern const ecs_entity_t EcsOverride;
1694
1698FLECS_API extern const ecs_entity_t EcsInherit;
1699
1704FLECS_API extern const ecs_entity_t EcsDontInherit;
1705
1713FLECS_API extern const ecs_entity_t EcsSymmetric;
1714
1724FLECS_API extern const ecs_entity_t EcsExclusive;
1725
1727FLECS_API extern const ecs_entity_t EcsAcyclic;
1728
1731FLECS_API extern const ecs_entity_t EcsTraversable;
1732
1742FLECS_API extern const ecs_entity_t EcsWith;
1743
1753FLECS_API extern const ecs_entity_t EcsOneOf;
1754
1756FLECS_API extern const ecs_entity_t EcsCanToggle;
1757
1761FLECS_API extern const ecs_entity_t EcsTrait;
1762
1772FLECS_API extern const ecs_entity_t EcsRelationship;
1773
1783FLECS_API extern const ecs_entity_t EcsTarget;
1784
1787FLECS_API extern const ecs_entity_t EcsPairIsTag;
1788
1790FLECS_API extern const ecs_entity_t EcsName;
1791
1793FLECS_API extern const ecs_entity_t EcsSymbol;
1794
1796FLECS_API extern const ecs_entity_t EcsAlias;
1797
1799FLECS_API extern const ecs_entity_t EcsChildOf;
1800
1802FLECS_API extern const ecs_entity_t EcsIsA;
1803
1805FLECS_API extern const ecs_entity_t EcsDependsOn;
1806
1808FLECS_API extern const ecs_entity_t EcsSlotOf;
1809
1811FLECS_API extern const ecs_entity_t EcsOrderedChildren;
1812
1814FLECS_API extern const ecs_entity_t EcsModule;
1815
1817FLECS_API extern const ecs_entity_t EcsPrivate;
1818
1821FLECS_API extern const ecs_entity_t EcsPrefab;
1822
1825FLECS_API extern const ecs_entity_t EcsDisabled;
1826
1830FLECS_API extern const ecs_entity_t EcsNotQueryable;
1831
1833FLECS_API extern const ecs_entity_t EcsOnAdd;
1834
1836FLECS_API extern const ecs_entity_t EcsOnRemove;
1837
1839FLECS_API extern const ecs_entity_t EcsOnSet;
1840
1842FLECS_API extern const ecs_entity_t EcsMonitor;
1843
1845FLECS_API extern const ecs_entity_t EcsOnTableCreate;
1846
1848FLECS_API extern const ecs_entity_t EcsOnTableDelete;
1849
1851FLECS_API extern const ecs_entity_t EcsOnDelete;
1852
1855FLECS_API extern const ecs_entity_t EcsOnDeleteTarget;
1856
1859FLECS_API extern const ecs_entity_t EcsRemove;
1860
1863FLECS_API extern const ecs_entity_t EcsDelete;
1864
1867FLECS_API extern const ecs_entity_t EcsPanic;
1868
1871FLECS_API extern const ecs_entity_t EcsSingleton;
1872
1874FLECS_API extern const ecs_entity_t EcsSparse;
1875
1877FLECS_API extern const ecs_entity_t EcsDontFragment;
1878
1880FLECS_API extern const ecs_entity_t EcsPredEq;
1881
1883FLECS_API extern const ecs_entity_t EcsPredMatch;
1884
1886FLECS_API extern const ecs_entity_t EcsPredLookup;
1887
1889FLECS_API extern const ecs_entity_t EcsScopeOpen;
1890
1892FLECS_API extern const ecs_entity_t EcsScopeClose;
1893
1898FLECS_API extern const ecs_entity_t EcsEmpty;
1899
1900FLECS_API extern const ecs_entity_t ecs_id(EcsPipeline);
1901FLECS_API extern const ecs_entity_t EcsOnStart;
1902FLECS_API extern const ecs_entity_t EcsPreFrame;
1903FLECS_API extern const ecs_entity_t EcsOnLoad;
1904FLECS_API extern const ecs_entity_t EcsPostLoad;
1905FLECS_API extern const ecs_entity_t EcsPreUpdate;
1906FLECS_API extern const ecs_entity_t EcsOnUpdate;
1907FLECS_API extern const ecs_entity_t EcsOnValidate;
1908FLECS_API extern const ecs_entity_t EcsPostUpdate;
1909FLECS_API extern const ecs_entity_t EcsPreStore;
1910FLECS_API extern const ecs_entity_t EcsOnStore;
1911FLECS_API extern const ecs_entity_t EcsPostFrame;
1912FLECS_API extern const ecs_entity_t EcsPhase;
1913
1914FLECS_API extern const ecs_entity_t EcsConstant;
1915
1918#define EcsLastInternalComponentId (ecs_id(EcsPoly))
1919
1922#define EcsFirstUserComponentId (8)
1923
1926#define EcsFirstUserEntityId (FLECS_HI_COMPONENT_ID + 128)
1927
1928/* When visualized the reserved id ranges look like this:
1929 * - [1..8]: Builtin components
1930 * - [9..FLECS_HI_COMPONENT_ID]: Low ids reserved for application components
1931 * - [FLECS_HI_COMPONENT_ID + 1..EcsFirstUserEntityId]: Builtin entities
1932 */
1933
1936
1943
1948
1955FLECS_API
1956 ecs_world_t* ecs_init(void);
1957
1964FLECS_API
1965 ecs_world_t* ecs_mini(void);
1966
1974FLECS_API
1975 ecs_world_t* ecs_init_w_args(
1976 int argc,
1977 char *argv[]);
1978
1985FLECS_API
1986 int ecs_fini(
1987 ecs_world_t *world);
1988
1996FLECS_API
1997 bool ecs_is_fini(
1998 const ecs_world_t *world);
1999
2007FLECS_API
2008 void ecs_atfini(
2009 ecs_world_t *world,
2010 ecs_fini_action_t action,
2011 void *ctx);
2012
2014 typedef struct ecs_entities_t {
2015 const ecs_entity_t *ids;
2016 int32_t count;
2017 int32_t alive_count;
2018} ecs_entities_t;
2019
2046FLECS_API
2047 ecs_entities_t ecs_get_entities(
2048 const ecs_world_t *world);
2049
2057FLECS_API
2058ecs_flags32_t ecs_world_get_flags(
2059 const ecs_world_t *world);
2060
2062
2067
2086FLECS_API
2087 ecs_ftime_t ecs_frame_begin(
2088 ecs_world_t *world,
2089 ecs_ftime_t delta_time);
2090
2097FLECS_API
2098 void ecs_frame_end(
2099 ecs_world_t *world);
2100
2108FLECS_API
2109 void ecs_run_post_frame(
2110 ecs_world_t *world,
2111 ecs_fini_action_t action,
2112 void *ctx);
2113
2120FLECS_API
2121 void ecs_quit(
2122 ecs_world_t *world);
2123
2130FLECS_API
2131 bool ecs_should_quit(
2132 const ecs_world_t *world);
2133
2145FLECS_API void ecs_measure_frame_time(
2146 ecs_world_t *world,
2147 bool enable);
2148
2159FLECS_API void ecs_measure_system_time(
2160 ecs_world_t *world,
2161 bool enable);
2162
2178FLECS_API
2179 void ecs_set_target_fps(
2180 ecs_world_t *world,
2181 ecs_ftime_t fps);
2182
2196FLECS_API
2197 void ecs_set_default_query_flags(
2198 ecs_world_t *world,
2199 ecs_flags32_t flags);
2200
2202
2207
2277FLECS_API
2278 bool ecs_readonly_begin(
2279 ecs_world_t *world,
2280 bool multi_threaded);
2281
2289FLECS_API
2290 void ecs_readonly_end(
2291 ecs_world_t *world);
2292
2298FLECS_API
2299 void ecs_merge(
2300 ecs_world_t *stage);
2301
2318FLECS_API
2319 bool ecs_defer_begin(
2320 ecs_world_t *world);
2321
2335FLECS_API
2336 bool ecs_defer_end(
2337 ecs_world_t *world);
2338
2353FLECS_API
2354 void ecs_defer_suspend(
2355 ecs_world_t *world);
2356
2367FLECS_API
2368 void ecs_defer_resume(
2369 ecs_world_t *world);
2370
2382FLECS_API
2383 bool ecs_is_deferred(
2384 const ecs_world_t *world);
2385
2397FLECS_API
2398 bool ecs_is_defer_suspended(
2399 const ecs_world_t *world);
2400
2414FLECS_API
2415 void ecs_set_stage_count(
2416 ecs_world_t *world,
2417 int32_t stages);
2418
2425FLECS_API
2426int32_t ecs_get_stage_count(
2427 const ecs_world_t *world);
2428
2444FLECS_API
2445 ecs_world_t* ecs_get_stage(
2446 const ecs_world_t *world,
2447 int32_t stage_id);
2448
2456FLECS_API
2457 bool ecs_stage_is_readonly(
2458 const ecs_world_t *world);
2459
2467FLECS_API
2468 ecs_world_t* ecs_stage_new(
2469 ecs_world_t *world);
2470
2475FLECS_API
2476 void ecs_stage_free(
2477 ecs_world_t *stage);
2478
2486FLECS_API
2487int32_t ecs_stage_get_id(
2488 const ecs_world_t *world);
2489
2491
2496
2505FLECS_API
2506 void ecs_set_ctx(
2507 ecs_world_t *world,
2508 void *ctx,
2509 ecs_ctx_free_t ctx_free);
2510
2519FLECS_API
2520 void ecs_set_binding_ctx(
2521 ecs_world_t *world,
2522 void *ctx,
2523 ecs_ctx_free_t ctx_free);
2524
2532FLECS_API
2533 void* ecs_get_ctx(
2534 const ecs_world_t *world);
2535
2543FLECS_API
2544 void* ecs_get_binding_ctx(
2545 const ecs_world_t *world);
2546
2552FLECS_API
2553 const ecs_build_info_t* ecs_get_build_info(void);
2554
2560FLECS_API
2561 const ecs_world_info_t* ecs_get_world_info(
2562 const ecs_world_t *world);
2563
2572FLECS_API
2573 void ecs_dim(
2574 ecs_world_t *world,
2575 int32_t entity_count);
2576
2591FLECS_API
2592 void ecs_shrink(
2593 ecs_world_t *world);
2594
2610FLECS_API
2611 void ecs_set_entity_range(
2612 ecs_world_t *world,
2613 ecs_entity_t id_start,
2614 ecs_entity_t id_end);
2615
2626FLECS_API
2627 bool ecs_enable_range_check(
2628 ecs_world_t *world,
2629 bool enable);
2630
2636FLECS_API
2637 ecs_entity_t ecs_get_max_id(
2638 const ecs_world_t *world);
2639
2653FLECS_API
2654 void ecs_run_aperiodic(
2655 ecs_world_t *world,
2656 ecs_flags32_t flags);
2657
2659 typedef struct ecs_delete_empty_tables_desc_t {
2661 uint16_t clear_generation;
2662
2664 uint16_t delete_generation;
2665
2667 double time_budget_seconds;
2668} ecs_delete_empty_tables_desc_t;
2669
2699FLECS_API
2700int32_t ecs_delete_empty_tables(
2701 ecs_world_t *world,
2702 const ecs_delete_empty_tables_desc_t *desc);
2703
2709FLECS_API
2710 const ecs_world_t* ecs_get_world(
2711 const ecs_poly_t *poly);
2712
2718FLECS_API
2719 ecs_entity_t ecs_get_entity(
2720 const ecs_poly_t *poly);
2721
2735FLECS_API
2736 bool flecs_poly_is_(
2737 const ecs_poly_t *object,
2738 int32_t type);
2739
2743#define flecs_poly_is(object, type)\
2744 flecs_poly_is_(object, type##_magic)
2745
2754FLECS_API
2755 ecs_id_t ecs_make_pair(
2756 ecs_entity_t first,
2757 ecs_entity_t second);
2758
2781FLECS_API
2782 void ecs_exclusive_access_begin(
2783 ecs_world_t *world,
2784 const char *thread_name);
2785
2808FLECS_API
2809 void ecs_exclusive_access_end(
2810 ecs_world_t *world,
2811 bool lock_world);
2812
2814
2816
2823
2830
2839FLECS_API
2840 ecs_entity_t ecs_new(
2841 ecs_world_t *world);
2842
2860FLECS_API
2861 ecs_entity_t ecs_new_low_id(
2862 ecs_world_t *world);
2863
2872FLECS_API
2873 ecs_entity_t ecs_new_w_id(
2874 ecs_world_t *world,
2875 ecs_id_t component);
2876
2884FLECS_API
2885 ecs_entity_t ecs_new_w_table(
2886 ecs_world_t *world,
2887 ecs_table_t *table);
2888
2907FLECS_API
2908 ecs_entity_t ecs_entity_init(
2909 ecs_world_t *world,
2910 const ecs_entity_desc_t *desc);
2911
2938FLECS_API
2939 const ecs_entity_t* ecs_bulk_init(
2940 ecs_world_t *world,
2941 const ecs_bulk_desc_t *desc);
2942
2952FLECS_API
2953 const ecs_entity_t* ecs_bulk_new_w_id(
2954 ecs_world_t *world,
2955 ecs_id_t component,
2956 int32_t count);
2957
2973FLECS_API
2974 ecs_entity_t ecs_clone(
2975 ecs_world_t *world,
2976 ecs_entity_t dst,
2977 ecs_entity_t src,
2978 bool copy_value);
2979
2988FLECS_API
2989 void ecs_delete(
2990 ecs_world_t *world,
2991 ecs_entity_t entity);
2992
3000FLECS_API
3001 void ecs_delete_with(
3002 ecs_world_t *world,
3003 ecs_id_t component);
3004
3022FLECS_API
3023 void ecs_set_child_order(
3024 ecs_world_t *world,
3025 ecs_entity_t parent,
3026 const ecs_entity_t *children,
3027 int32_t child_count);
3028
3038FLECS_API
3039 ecs_entities_t ecs_get_ordered_children(
3040 const ecs_world_t *world,
3041 ecs_entity_t parent);
3042
3044
3051
3060FLECS_API
3061 void ecs_add_id(
3062 ecs_world_t *world,
3063 ecs_entity_t entity,
3064 ecs_id_t component);
3065
3074FLECS_API
3075 void ecs_remove_id(
3076 ecs_world_t *world,
3077 ecs_entity_t entity,
3078 ecs_id_t component);
3079
3131FLECS_API
3132 void ecs_auto_override_id(
3133 ecs_world_t *world,
3134 ecs_entity_t entity,
3135 ecs_id_t component);
3136
3143FLECS_API
3144 void ecs_clear(
3145 ecs_world_t *world,
3146 ecs_entity_t entity);
3147
3155FLECS_API
3156 void ecs_remove_all(
3157 ecs_world_t *world,
3158 ecs_id_t component);
3159
3174FLECS_API
3175 ecs_entity_t ecs_set_with(
3176 ecs_world_t *world,
3177 ecs_id_t component);
3178
3186FLECS_API
3187 ecs_id_t ecs_get_with(
3188 const ecs_world_t *world);
3189
3191
3198
3208FLECS_API
3209 void ecs_enable(
3210 ecs_world_t *world,
3211 ecs_entity_t entity,
3212 bool enabled);
3213
3227FLECS_API
3228 void ecs_enable_id(
3229 ecs_world_t *world,
3230 ecs_entity_t entity,
3231 ecs_id_t component,
3232 bool enable);
3233
3244FLECS_API
3245 bool ecs_is_enabled_id(
3246 const ecs_world_t *world,
3247 ecs_entity_t entity,
3248 ecs_id_t component);
3249
3251
3258
3273FLECS_API
3274FLECS_ALWAYS_INLINE const void* ecs_get_id(
3275 const ecs_world_t *world,
3276 ecs_entity_t entity,
3277 ecs_id_t component);
3278
3293FLECS_API
3294FLECS_ALWAYS_INLINE void* ecs_get_mut_id(
3295 const ecs_world_t *world,
3296 ecs_entity_t entity,
3297 ecs_id_t component);
3298
3315FLECS_API
3316 void* ecs_ensure_id(
3317 ecs_world_t *world,
3318 ecs_entity_t entity,
3319 ecs_id_t component,
3320 size_t size);
3321
3332FLECS_ALWAYS_INLINE FLECS_API
3333 ecs_ref_t ecs_ref_init_id(
3334 const ecs_world_t *world,
3335 ecs_entity_t entity,
3336 ecs_id_t component);
3337
3348FLECS_ALWAYS_INLINE FLECS_API
3349 void* ecs_ref_get_id(
3350 const ecs_world_t *world,
3351 ecs_ref_t *ref,
3352 ecs_id_t component);
3353
3361FLECS_ALWAYS_INLINE FLECS_API
3362 void ecs_ref_update(
3363 const ecs_world_t *world,
3364 ecs_ref_t *ref);
3365
3386FLECS_API
3387 void* ecs_emplace_id(
3388 ecs_world_t *world,
3389 ecs_entity_t entity,
3390 ecs_id_t component,
3391 size_t size,
3392 bool *is_new);
3393
3403FLECS_API
3404 void ecs_modified_id(
3405 ecs_world_t *world,
3406 ecs_entity_t entity,
3407 ecs_id_t component);
3408
3424FLECS_API
3425 void ecs_set_id(
3426 ecs_world_t *world,
3427 ecs_entity_t entity,
3428 ecs_id_t component,
3429 size_t size,
3430 const void *ptr);
3431
3433
3440
3460FLECS_API
3461 bool ecs_is_valid(
3462 const ecs_world_t *world,
3463 ecs_entity_t e);
3464
3494FLECS_API
3495 bool ecs_is_alive(
3496 const ecs_world_t *world,
3497 ecs_entity_t e);
3498
3504FLECS_API
3505 ecs_id_t ecs_strip_generation(
3506 ecs_entity_t e);
3507
3524FLECS_API
3525 ecs_entity_t ecs_get_alive(
3526 const ecs_world_t *world,
3527 ecs_entity_t e);
3528
3551FLECS_API
3552 void ecs_make_alive(
3553 ecs_world_t *world,
3554 ecs_entity_t entity);
3555
3574FLECS_API
3575 void ecs_make_alive_id(
3576 ecs_world_t *world,
3577 ecs_id_t component);
3578
3586FLECS_API
3587 bool ecs_exists(
3588 const ecs_world_t *world,
3589 ecs_entity_t entity);
3590
3605FLECS_API
3606 void ecs_set_version(
3607 ecs_world_t *world,
3608 ecs_entity_t entity);
3609
3611
3618
3625FLECS_API
3626 const ecs_type_t* ecs_get_type(
3627 const ecs_world_t *world,
3628 ecs_entity_t entity);
3629
3636FLECS_API
3637 ecs_table_t* ecs_get_table(
3638 const ecs_world_t *world,
3639 ecs_entity_t entity);
3640
3648FLECS_API
3649 char* ecs_type_str(
3650 const ecs_world_t *world,
3651 const ecs_type_t* type);
3652
3664FLECS_API
3665 char* ecs_table_str(
3666 const ecs_world_t *world,
3667 const ecs_table_t *table);
3668
3683FLECS_API
3684 char* ecs_entity_str(
3685 const ecs_world_t *world,
3686 ecs_entity_t entity);
3687
3698FLECS_API
3699FLECS_ALWAYS_INLINE bool ecs_has_id(
3700 const ecs_world_t *world,
3701 ecs_entity_t entity,
3702 ecs_id_t component);
3703
3714FLECS_API
3715FLECS_ALWAYS_INLINE bool ecs_owns_id(
3716 const ecs_world_t *world,
3717 ecs_entity_t entity,
3718 ecs_id_t component);
3719
3734FLECS_API
3735 ecs_entity_t ecs_get_target(
3736 const ecs_world_t *world,
3737 ecs_entity_t entity,
3738 ecs_entity_t rel,
3739 int32_t index);
3740
3754FLECS_API
3755 ecs_entity_t ecs_get_parent(
3756 const ecs_world_t *world,
3757 ecs_entity_t entity);
3758
3779FLECS_API
3780 ecs_entity_t ecs_get_target_for_id(
3781 const ecs_world_t *world,
3782 ecs_entity_t entity,
3783 ecs_entity_t rel,
3784 ecs_id_t component);
3785
3796FLECS_API
3797int32_t ecs_get_depth(
3798 const ecs_world_t *world,
3799 ecs_entity_t entity,
3800 ecs_entity_t rel);
3801
3809FLECS_API
3810int32_t ecs_count_id(
3811 const ecs_world_t *world,
3812 ecs_id_t entity);
3813
3815
3816
3823
3833FLECS_API
3834 const char* ecs_get_name(
3835 const ecs_world_t *world,
3836 ecs_entity_t entity);
3837
3847FLECS_API
3848 const char* ecs_get_symbol(
3849 const ecs_world_t *world,
3850 ecs_entity_t entity);
3851
3865FLECS_API
3866 ecs_entity_t ecs_set_name(
3867 ecs_world_t *world,
3868 ecs_entity_t entity,
3869 const char *name);
3870
3884FLECS_API
3885 ecs_entity_t ecs_set_symbol(
3886 ecs_world_t *world,
3887 ecs_entity_t entity,
3888 const char *symbol);
3889
3901FLECS_API
3902 void ecs_set_alias(
3903 ecs_world_t *world,
3904 ecs_entity_t entity,
3905 const char *alias);
3906
3922FLECS_API
3923 ecs_entity_t ecs_lookup(
3924 const ecs_world_t *world,
3925 const char *path);
3926
3941FLECS_API
3942 ecs_entity_t ecs_lookup_child(
3943 const ecs_world_t *world,
3944 ecs_entity_t parent,
3945 const char *name);
3946
3969FLECS_API
3970 ecs_entity_t ecs_lookup_path_w_sep(
3971 const ecs_world_t *world,
3972 ecs_entity_t parent,
3973 const char *path,
3974 const char *sep,
3975 const char *prefix,
3976 bool recursive);
3977
3995FLECS_API
3996 ecs_entity_t ecs_lookup_symbol(
3997 const ecs_world_t *world,
3998 const char *symbol,
3999 bool lookup_as_path,
4000 bool recursive);
4001
4023FLECS_API
4024 char* ecs_get_path_w_sep(
4025 const ecs_world_t *world,
4026 ecs_entity_t parent,
4027 ecs_entity_t child,
4028 const char *sep,
4029 const char *prefix);
4030
4043FLECS_API
4044 void ecs_get_path_w_sep_buf(
4045 const ecs_world_t *world,
4046 ecs_entity_t parent,
4047 ecs_entity_t child,
4048 const char *sep,
4049 const char *prefix,
4050 ecs_strbuf_t *buf,
4051 bool escape);
4052
4068FLECS_API
4069 ecs_entity_t ecs_new_from_path_w_sep(
4070 ecs_world_t *world,
4071 ecs_entity_t parent,
4072 const char *path,
4073 const char *sep,
4074 const char *prefix);
4075
4090FLECS_API
4091 ecs_entity_t ecs_add_path_w_sep(
4092 ecs_world_t *world,
4093 ecs_entity_t entity,
4094 ecs_entity_t parent,
4095 const char *path,
4096 const char *sep,
4097 const char *prefix);
4098
4112FLECS_API
4113 ecs_entity_t ecs_set_scope(
4114 ecs_world_t *world,
4115 ecs_entity_t scope);
4116
4124FLECS_API
4125 ecs_entity_t ecs_get_scope(
4126 const ecs_world_t *world);
4127
4137FLECS_API
4138 const char* ecs_set_name_prefix(
4139 ecs_world_t *world,
4140 const char *prefix);
4141
4168FLECS_API
4169 ecs_entity_t* ecs_set_lookup_path(
4170 ecs_world_t *world,
4171 const ecs_entity_t *lookup_path);
4172
4179FLECS_API
4180 ecs_entity_t* ecs_get_lookup_path(
4181 const ecs_world_t *world);
4182
4184
4186
4193
4207FLECS_API
4208 ecs_entity_t ecs_component_init(
4209 ecs_world_t *world,
4210 const ecs_component_desc_t *desc);
4211
4221FLECS_API
4222 const ecs_type_info_t* ecs_get_type_info(
4223 const ecs_world_t *world,
4224 ecs_id_t component);
4225
4237FLECS_API
4238 void ecs_set_hooks_id(
4239 ecs_world_t *world,
4240 ecs_entity_t component,
4241 const ecs_type_hooks_t *hooks);
4242
4249FLECS_API
4250 const ecs_type_hooks_t* ecs_get_hooks_id(
4251 const ecs_world_t *world,
4252 ecs_entity_t component);
4253
4255
4262
4277FLECS_API
4278 bool ecs_id_is_tag(
4279 const ecs_world_t *world,
4280 ecs_id_t component);
4281
4290FLECS_API
4291 bool ecs_id_in_use(
4292 const ecs_world_t *world,
4293 ecs_id_t component);
4294
4314FLECS_API
4315 ecs_entity_t ecs_get_typeid(
4316 const ecs_world_t *world,
4317 ecs_id_t component);
4318
4327FLECS_API
4328 bool ecs_id_match(
4329 ecs_id_t component,
4330 ecs_id_t pattern);
4331
4337FLECS_API
4338 bool ecs_id_is_pair(
4339 ecs_id_t component);
4340
4346FLECS_API
4347 bool ecs_id_is_wildcard(
4348 ecs_id_t component);
4349
4355 bool ecs_id_is_any(
4356 ecs_id_t component);
4357
4371FLECS_API
4372 bool ecs_id_is_valid(
4373 const ecs_world_t *world,
4374 ecs_id_t component);
4375
4384FLECS_API
4385ecs_flags32_t ecs_id_get_flags(
4386 const ecs_world_t *world,
4387 ecs_id_t component);
4388
4399FLECS_API
4400 const char* ecs_id_flag_str(
4401 ecs_id_t component_flags);
4402
4418FLECS_API
4419 char* ecs_id_str(
4420 const ecs_world_t *world,
4421 ecs_id_t component);
4422
4430FLECS_API
4431 void ecs_id_str_buf(
4432 const ecs_world_t *world,
4433 ecs_id_t component,
4434 ecs_strbuf_t *buf);
4435
4443FLECS_API
4444 ecs_id_t ecs_id_from_str(
4445 const ecs_world_t *world,
4446 const char *expr);
4447
4449
4455
4463FLECS_API
4464 bool ecs_term_ref_is_set(
4465 const ecs_term_ref_t *ref);
4466
4478FLECS_API
4479 bool ecs_term_is_initialized(
4480 const ecs_term_t *term);
4481
4496FLECS_API
4497 bool ecs_term_match_this(
4498 const ecs_term_t *term);
4499
4512FLECS_API
4513 bool ecs_term_match_0(
4514 const ecs_term_t *term);
4515
4524FLECS_API
4525 char* ecs_term_str(
4526 const ecs_world_t *world,
4527 const ecs_term_t *term);
4528
4536FLECS_API
4537 char* ecs_query_str(
4538 const ecs_query_t *query);
4539
4541
4547
4580FLECS_API
4581 ecs_iter_t ecs_each_id(
4582 const ecs_world_t *world,
4583 ecs_id_t component);
4584
4590FLECS_API
4591 bool ecs_each_next(
4592 ecs_iter_t *it);
4593
4616FLECS_API
4617FLECS_ALWAYS_INLINE ecs_iter_t ecs_children(
4618 const ecs_world_t *world,
4619 ecs_entity_t parent);
4620
4628FLECS_API
4629FLECS_ALWAYS_INLINE ecs_iter_t ecs_children_w_rel(
4630 const ecs_world_t *world,
4631 ecs_entity_t relationship,
4632 ecs_entity_t parent);
4633
4639FLECS_API
4640 bool ecs_children_next(
4641 ecs_iter_t *it);
4642
4644
4651
4658FLECS_API
4659 ecs_query_t* ecs_query_init(
4660 ecs_world_t *world,
4661 const ecs_query_desc_t *desc);
4662
4667FLECS_API
4668 void ecs_query_fini(
4669 ecs_query_t *query);
4670
4679FLECS_API
4680int32_t ecs_query_find_var(
4681 const ecs_query_t *query,
4682 const char *name);
4683
4691FLECS_API
4692 const char* ecs_query_var_name(
4693 const ecs_query_t *query,
4694 int32_t var_id);
4695
4706FLECS_API
4707 bool ecs_query_var_is_entity(
4708 const ecs_query_t *query,
4709 int32_t var_id);
4710
4779FLECS_API
4780 ecs_iter_t ecs_query_iter(
4781 const ecs_world_t *world,
4782 const ecs_query_t *query);
4783
4791FLECS_API
4792 bool ecs_query_next(
4793 ecs_iter_t *it);
4794
4813FLECS_API
4814 bool ecs_query_has(
4815 ecs_query_t *query,
4816 ecs_entity_t entity,
4817 ecs_iter_t *it);
4818
4837FLECS_API
4838 bool ecs_query_has_table(
4839 ecs_query_t *query,
4840 ecs_table_t *table,
4841 ecs_iter_t *it);
4842
4869FLECS_API
4870 bool ecs_query_has_range(
4871 ecs_query_t *query,
4872 ecs_table_range_t *range,
4873 ecs_iter_t *it);
4874
4882FLECS_API
4883int32_t ecs_query_match_count(
4884 const ecs_query_t *query);
4885
4895FLECS_API
4896 char* ecs_query_plan(
4897 const ecs_query_t *query);
4898
4913FLECS_API
4914 char* ecs_query_plan_w_profile(
4915 const ecs_query_t *query,
4916 const ecs_iter_t *it);
4917
4935FLECS_API
4936 const char* ecs_query_args_parse(
4937 ecs_query_t *query,
4938 ecs_iter_t *it,
4939 const char *expr);
4940
4968FLECS_API
4969 bool ecs_query_changed(
4970 ecs_query_t *query);
4971
4980FLECS_API
4981 const ecs_query_t* ecs_query_get(
4982 const ecs_world_t *world,
4983 ecs_entity_t query);
4984
4995FLECS_API
4996 void ecs_iter_skip(
4997 ecs_iter_t *it);
4998
5021FLECS_API
5022 void ecs_iter_set_group(
5023 ecs_iter_t *it,
5024 uint64_t group_id);
5025
5034FLECS_API
5035 void* ecs_query_get_group_ctx(
5036 const ecs_query_t *query,
5037 uint64_t group_id);
5038
5047FLECS_API
5048 const ecs_query_group_info_t* ecs_query_get_group_info(
5049 const ecs_query_t *query,
5050 uint64_t group_id);
5051
5053 typedef struct ecs_query_count_t {
5054 int32_t results;
5055 int32_t entities;
5056 int32_t tables;
5059} ecs_query_count_t;
5060
5067FLECS_API
5068 ecs_query_count_t ecs_query_count(
5069 const ecs_query_t *query);
5070
5076FLECS_API
5077 bool ecs_query_is_true(
5078 const ecs_query_t *query);
5079
5088FLECS_API
5089 const ecs_query_t* ecs_query_get_cache_query(
5090 const ecs_query_t *query);
5091
5093
5100
5120FLECS_API
5121 void ecs_emit(
5122 ecs_world_t *world,
5123 ecs_event_desc_t *desc);
5124
5135FLECS_API
5136 void ecs_enqueue(
5137 ecs_world_t *world,
5138 ecs_event_desc_t *desc);
5139
5150FLECS_API
5151 ecs_entity_t ecs_observer_init(
5152 ecs_world_t *world,
5153 const ecs_observer_desc_t *desc);
5154
5163FLECS_API
5164 const ecs_observer_t* ecs_observer_get(
5165 const ecs_world_t *world,
5166 ecs_entity_t observer);
5167
5169
5176
5190FLECS_API
5191 bool ecs_iter_next(
5192 ecs_iter_t *it);
5193
5203FLECS_API
5204 void ecs_iter_fini(
5205 ecs_iter_t *it);
5206
5218FLECS_API
5219int32_t ecs_iter_count(
5220 ecs_iter_t *it);
5221
5234FLECS_API
5235 bool ecs_iter_is_true(
5236 ecs_iter_t *it);
5237
5245FLECS_API
5246 ecs_entity_t ecs_iter_first(
5247 ecs_iter_t *it);
5248
5287FLECS_API
5288 void ecs_iter_set_var(
5289 ecs_iter_t *it,
5290 int32_t var_id,
5291 ecs_entity_t entity);
5292
5303FLECS_API
5304 void ecs_iter_set_var_as_table(
5305 ecs_iter_t *it,
5306 int32_t var_id,
5307 const ecs_table_t *table);
5308
5319FLECS_API
5320 void ecs_iter_set_var_as_range(
5321 ecs_iter_t *it,
5322 int32_t var_id,
5323 const ecs_table_range_t *range);
5324
5337FLECS_API
5338 ecs_entity_t ecs_iter_get_var(
5339 ecs_iter_t *it,
5340 int32_t var_id);
5341
5348FLECS_API
5349 const char* ecs_iter_get_var_name(
5350 const ecs_iter_t *it,
5351 int32_t var_id);
5352
5358FLECS_API
5359int32_t ecs_iter_get_var_count(
5360 const ecs_iter_t *it);
5361
5367FLECS_API
5368ecs_var_t* ecs_iter_get_vars(
5369 const ecs_iter_t *it);
5370
5384FLECS_API
5385 ecs_table_t* ecs_iter_get_var_as_table(
5386 ecs_iter_t *it,
5387 int32_t var_id);
5388
5402FLECS_API
5403ecs_table_range_t ecs_iter_get_var_as_range(
5404 ecs_iter_t *it,
5405 int32_t var_id);
5406
5418FLECS_API
5419 bool ecs_iter_var_is_constrained(
5420 ecs_iter_t *it,
5421 int32_t var_id);
5422
5434FLECS_API
5435uint64_t ecs_iter_get_group(
5436 const ecs_iter_t *it);
5437
5449FLECS_API
5450 bool ecs_iter_changed(
5451 ecs_iter_t *it);
5452
5464FLECS_API
5465 char* ecs_iter_str(
5466 const ecs_iter_t *it);
5467
5483FLECS_API
5484 ecs_iter_t ecs_page_iter(
5485 const ecs_iter_t *it,
5486 int32_t offset,
5487 int32_t limit);
5488
5495FLECS_API
5496 bool ecs_page_next(
5497 ecs_iter_t *it);
5498
5519FLECS_API
5520 ecs_iter_t ecs_worker_iter(
5521 const ecs_iter_t *it,
5522 int32_t index,
5523 int32_t count);
5524
5531FLECS_API
5532 bool ecs_worker_next(
5533 ecs_iter_t *it);
5534
5576FLECS_API
5577 void* ecs_field_w_size(
5578 const ecs_iter_t *it,
5579 size_t size,
5580 int8_t index);
5581
5603FLECS_API
5604 void* ecs_field_at_w_size(
5605 const ecs_iter_t *it,
5606 size_t size,
5607 int8_t index,
5608 int32_t row);
5609
5618FLECS_API
5619 bool ecs_field_is_readonly(
5620 const ecs_iter_t *it,
5621 int8_t index);
5622
5633FLECS_API
5634 bool ecs_field_is_writeonly(
5635 const ecs_iter_t *it,
5636 int8_t index);
5637
5644FLECS_API
5645 bool ecs_field_is_set(
5646 const ecs_iter_t *it,
5647 int8_t index);
5648
5655FLECS_API
5656 ecs_id_t ecs_field_id(
5657 const ecs_iter_t *it,
5658 int8_t index);
5659
5668FLECS_API
5669int32_t ecs_field_column(
5670 const ecs_iter_t *it,
5671 int8_t index);
5672
5680FLECS_API
5681 ecs_entity_t ecs_field_src(
5682 const ecs_iter_t *it,
5683 int8_t index);
5684
5692FLECS_API
5693 size_t ecs_field_size(
5694 const ecs_iter_t *it,
5695 int8_t index);
5696
5710FLECS_API
5711 bool ecs_field_is_self(
5712 const ecs_iter_t *it,
5713 int8_t index);
5714
5716
5723
5730FLECS_API
5731 const ecs_type_t* ecs_table_get_type(
5732 const ecs_table_t *table);
5733
5744FLECS_API
5745int32_t ecs_table_get_type_index(
5746 const ecs_world_t *world,
5747 const ecs_table_t *table,
5748 ecs_id_t component);
5749
5759FLECS_API
5760int32_t ecs_table_get_column_index(
5761 const ecs_world_t *world,
5762 const ecs_table_t *table,
5763 ecs_id_t component);
5764
5772FLECS_API
5773int32_t ecs_table_column_count(
5774 const ecs_table_t *table);
5775
5789FLECS_API
5790int32_t ecs_table_type_to_column_index(
5791 const ecs_table_t *table,
5792 int32_t index);
5793
5802FLECS_API
5803int32_t ecs_table_column_to_type_index(
5804 const ecs_table_t *table,
5805 int32_t index);
5806
5815FLECS_API
5816 void* ecs_table_get_column(
5817 const ecs_table_t *table,
5818 int32_t index,
5819 int32_t offset);
5820
5830FLECS_API
5831 void* ecs_table_get_id(
5832 const ecs_world_t *world,
5833 const ecs_table_t *table,
5834 ecs_id_t component,
5835 int32_t offset);
5836
5844FLECS_API
5845 size_t ecs_table_get_column_size(
5846 const ecs_table_t *table,
5847 int32_t index);
5848
5855FLECS_API
5856int32_t ecs_table_count(
5857 const ecs_table_t *table);
5858
5866FLECS_API
5867int32_t ecs_table_size(
5868 const ecs_table_t *table);
5869
5876FLECS_API
5877 const ecs_entity_t* ecs_table_entities(
5878 const ecs_table_t *table);
5879
5890FLECS_API
5891 bool ecs_table_has_id(
5892 const ecs_world_t *world,
5893 const ecs_table_t *table,
5894 ecs_id_t component);
5895
5906FLECS_API
5907 ecs_entity_t ecs_table_get_target(
5908 const ecs_world_t *world,
5909 const ecs_table_t *table,
5910 ecs_entity_t relationship,
5911 int32_t index);
5912
5923FLECS_API
5924int32_t ecs_table_get_depth(
5925 const ecs_world_t *world,
5926 const ecs_table_t *table,
5927 ecs_entity_t rel);
5928
5938FLECS_API
5939 ecs_table_t* ecs_table_add_id(
5940 ecs_world_t *world,
5941 ecs_table_t *table,
5942 ecs_id_t component);
5943
5954FLECS_API
5955 ecs_table_t* ecs_table_find(
5956 ecs_world_t *world,
5957 const ecs_id_t *ids,
5958 int32_t id_count);
5959
5969FLECS_API
5970 ecs_table_t* ecs_table_remove_id(
5971 ecs_world_t *world,
5972 ecs_table_t *table,
5973 ecs_id_t component);
5974
5990FLECS_API
5991 void ecs_table_lock(
5992 ecs_world_t *world,
5993 ecs_table_t *table);
5994
6001FLECS_API
6002 void ecs_table_unlock(
6003 ecs_world_t *world,
6004 ecs_table_t *table);
6005
6015FLECS_API
6016 bool ecs_table_has_flags(
6017 ecs_table_t *table,
6018 ecs_flags32_t flags);
6019
6027FLECS_API
6028 bool ecs_table_has_traversable(
6029 const ecs_table_t *table);
6030
6038FLECS_API
6039 void ecs_table_swap_rows(
6040 ecs_world_t* world,
6041 ecs_table_t* table,
6042 int32_t row_1,
6043 int32_t row_2);
6044
6067FLECS_API
6068 bool ecs_commit(
6069 ecs_world_t *world,
6070 ecs_entity_t entity,
6071 ecs_record_t *record,
6072 ecs_table_t *table,
6073 const ecs_type_t *added,
6074 const ecs_type_t *removed);
6075
6076
6096FLECS_API
6097int32_t ecs_search(
6098 const ecs_world_t *world,
6099 const ecs_table_t *table,
6100 ecs_id_t component,
6101 ecs_id_t *component_out);
6102
6138FLECS_API
6139int32_t ecs_search_offset(
6140 const ecs_world_t *world,
6141 const ecs_table_t *table,
6142 int32_t offset,
6143 ecs_id_t component,
6144 ecs_id_t *component_out);
6145
6187FLECS_API
6188int32_t ecs_search_relation(
6189 const ecs_world_t *world,
6190 const ecs_table_t *table,
6191 int32_t offset,
6192 ecs_id_t component,
6193 ecs_entity_t rel,
6194 ecs_flags64_t flags, /* EcsSelf and/or EcsUp */
6195 ecs_entity_t *subject_out,
6196 ecs_id_t *component_out,
6197 struct ecs_table_record_t **tr_out);
6198
6206FLECS_API
6207 void ecs_table_clear_entities(
6208 ecs_world_t* world,
6209 ecs_table_t* table);
6210
6212
6219
6227FLECS_API
6228 int ecs_value_init(
6229 const ecs_world_t *world,
6230 ecs_entity_t type,
6231 void *ptr);
6232
6240FLECS_API
6241 int ecs_value_init_w_type_info(
6242 const ecs_world_t *world,
6243 const ecs_type_info_t *ti,
6244 void *ptr);
6245
6252FLECS_API
6253 void* ecs_value_new(
6254 ecs_world_t *world,
6255 ecs_entity_t type);
6256
6263 void* ecs_value_new_w_type_info(
6264 ecs_world_t *world,
6265 const ecs_type_info_t *ti);
6266
6274 int ecs_value_fini_w_type_info(
6275 const ecs_world_t *world,
6276 const ecs_type_info_t *ti,
6277 void *ptr);
6278
6286FLECS_API
6287 int ecs_value_fini(
6288 const ecs_world_t *world,
6289 ecs_entity_t type,
6290 void* ptr);
6291
6299FLECS_API
6300 int ecs_value_free(
6301 ecs_world_t *world,
6302 ecs_entity_t type,
6303 void* ptr);
6304
6313FLECS_API
6314 int ecs_value_copy_w_type_info(
6315 const ecs_world_t *world,
6316 const ecs_type_info_t *ti,
6317 void* dst,
6318 const void *src);
6319
6328FLECS_API
6329 int ecs_value_copy(
6330 const ecs_world_t *world,
6331 ecs_entity_t type,
6332 void* dst,
6333 const void *src);
6334
6343 int ecs_value_move_w_type_info(
6344 const ecs_world_t *world,
6345 const ecs_type_info_t *ti,
6346 void* dst,
6347 void *src);
6348
6357 int ecs_value_move(
6358 const ecs_world_t *world,
6359 ecs_entity_t type,
6360 void* dst,
6361 void *src);
6362
6371 int ecs_value_move_ctor_w_type_info(
6372 const ecs_world_t *world,
6373 const ecs_type_info_t *ti,
6374 void* dst,
6375 void *src);
6376
6385 int ecs_value_move_ctor(
6386 const ecs_world_t *world,
6387 ecs_entity_t type,
6388 void* dst,
6389 void *src);
6390
6392
6394
6403
6404#include "flecs/addons/flecs_c.h"
6405
6406#ifdef __cplusplus
6407}
6408#endif
6409
6410#include "flecs/private/addons.h"
6411
6412#endif
deprecated.h
The deprecated addon contains deprecated operations.
flecs_c.h
Extends the core API with convenience macros for C applications.
ecs_remove_id
void ecs_remove_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Remove a component from an entity.
ecs_auto_override_id
void ecs_auto_override_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Add auto override for component.
ecs_remove_all
void ecs_remove_all(ecs_world_t *world, ecs_id_t component)
Remove all instances of the specified component.
ecs_clear
void ecs_clear(ecs_world_t *world, ecs_entity_t entity)
Clear all components.
ecs_get_with
ecs_id_t ecs_get_with(const ecs_world_t *world)
Get component set with ecs_set_with().
ecs_add_id
void ecs_add_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Add a (component) id to an entity.
ecs_set_with
ecs_entity_t ecs_set_with(ecs_world_t *world, ecs_id_t component)
Create new entities with specified component.
EcsScopeClose
const ecs_entity_t EcsScopeClose
Marker used to indicate the end of a scope (}) in queries.
EcsOnRemove
const ecs_entity_t EcsOnRemove
Event that triggers when an id is removed from an entity.
EcsThis
const ecs_entity_t EcsThis
This entity.
EcsWildcard
const ecs_entity_t EcsWildcard
Wildcard entity ("*").
EcsName
const ecs_entity_t EcsName
Tag to indicate name identifier.
EcsAcyclic
const ecs_entity_t EcsAcyclic
Marks a relationship as acyclic.
EcsSymmetric
const ecs_entity_t EcsSymmetric
Marks relationship as commutative.
EcsAlias
const ecs_entity_t EcsAlias
Tag to indicate alias identifier.
EcsOnSet
const ecs_entity_t EcsOnSet
Event that triggers when a component is set for an entity.
EcsReflexive
const ecs_entity_t EcsReflexive
Marks a relationship as reflexive.
EcsTrait
const ecs_entity_t EcsTrait
Can be added to components to indicate it is a trait.
EcsEmpty
const ecs_entity_t EcsEmpty
Tag used to indicate query is empty.
EcsOneOf
const ecs_entity_t EcsOneOf
Ensure that relationship target is child of specified entity.
EcsOnTableDelete
const ecs_entity_t EcsOnTableDelete
Event that triggers when a table is deleted.
EcsOnTableCreate
const ecs_entity_t EcsOnTableCreate
Event that triggers when a table is created.
EcsObserver
const ecs_entity_t EcsObserver
Tag added to observers.
EcsQuery
const ecs_entity_t EcsQuery
Tag added to queries.
EcsRelationship
const ecs_entity_t EcsRelationship
Ensure that an entity is always used in pair as relationship.
EcsSingleton
const ecs_entity_t EcsSingleton
Mark component as singleton.
EcsOnStart
const ecs_entity_t EcsOnStart
OnStart pipeline phase.
EcsNotQueryable
const ecs_entity_t EcsNotQueryable
Trait added to entities that should never be returned by queries.
EcsOnStore
const ecs_entity_t EcsOnStore
OnStore pipeline phase.
EcsOrderedChildren
const ecs_entity_t EcsOrderedChildren
Tag that when added to a parent ensures stable order of ecs_children result.
EcsDontFragment
const ecs_entity_t EcsDontFragment
Mark component as non-fragmenting.
EcsTraversable
const ecs_entity_t EcsTraversable
Marks a relationship as traversable.
EcsPredLookup
const ecs_entity_t EcsPredLookup
Marker used to indicate $var ~= "pattern" matching in queries.
EcsPreStore
const ecs_entity_t EcsPreStore
PreStore pipeline phase.
EcsOnLoad
const ecs_entity_t EcsOnLoad
OnLoad pipeline phase.
EcsIsA
const ecs_entity_t EcsIsA
Used to express inheritance relationships.
EcsExclusive
const ecs_entity_t EcsExclusive
Can be added to relationship to indicate that the relationship can only occur once on an entity.
EcsSymbol
const ecs_entity_t EcsSymbol
Tag to indicate symbol identifier.
EcsDependsOn
const ecs_entity_t EcsDependsOn
Used to express dependency relationships.
EcsTransitive
const ecs_entity_t EcsTransitive
Marks a relationship as transitive.
EcsDelete
const ecs_entity_t EcsDelete
Delete cleanup policy.
EcsChildOf
const ecs_entity_t EcsChildOf
Used to express parent-child relationships.
EcsFlecsCore
const ecs_entity_t EcsFlecsCore
Core module scope.
EcsMonitor
const ecs_entity_t EcsMonitor
Event that triggers observer when an entity starts/stops matching a query.
EcsCanToggle
const ecs_entity_t EcsCanToggle
Mark a component as toggleable with ecs_enable_id().
EcsPredEq
const ecs_entity_t EcsPredEq
Marker used to indicate $var == ... matching in queries.
EcsPhase
const ecs_entity_t EcsPhase
Phase pipeline phase.
EcsWorld
const ecs_entity_t EcsWorld
Entity associated with world (used for "attaching" components to world).
EcsPrivate
const ecs_entity_t EcsPrivate
Tag to indicate an entity/component/system is private to a module.
EcsScopeOpen
const ecs_entity_t EcsScopeOpen
Marker used to indicate the start of a scope ({) in queries.
EcsPostUpdate
const ecs_entity_t EcsPostUpdate
PostUpdate pipeline phase.
EcsOnValidate
const ecs_entity_t EcsOnValidate
OnValidate pipeline phase.
EcsRemove
const ecs_entity_t EcsRemove
Remove cleanup policy.
EcsOverride
const ecs_entity_t EcsOverride
Override component on instantiate.
EcsPredMatch
const ecs_entity_t EcsPredMatch
Marker used to indicate $var == "name" matching in queries.
EcsInherit
const ecs_entity_t EcsInherit
Inherit component on instantiate.
EcsSlotOf
const ecs_entity_t EcsSlotOf
Used to express a slot (used with prefab inheritance).
EcsModule
const ecs_entity_t EcsModule
Tag added to module entities.
EcsSparse
const ecs_entity_t EcsSparse
Mark component as sparse.
EcsPreUpdate
const ecs_entity_t EcsPreUpdate
PreUpdate pipeline phase.
EcsOnAdd
const ecs_entity_t EcsOnAdd
Event that triggers when an id is added to an entity.
EcsPrefab
const ecs_entity_t EcsPrefab
Tag added to prefab entities.
EcsOnInstantiate
const ecs_entity_t EcsOnInstantiate
Relationship that specifies component inheritance behavior.
EcsPostFrame
const ecs_entity_t EcsPostFrame
PostFrame pipeline phase.
EcsInheritable
const ecs_entity_t EcsInheritable
Mark component as inheritable.
EcsAny
const ecs_entity_t EcsAny
Any entity ("_").
EcsTarget
const ecs_entity_t EcsTarget
Ensure that an entity is always used in pair as target.
EcsWith
const ecs_entity_t EcsWith
Ensure that a component always is added together with another component.
EcsPostLoad
const ecs_entity_t EcsPostLoad
PostLoad pipeline phase.
EcsOnDelete
const ecs_entity_t EcsOnDelete
Relationship used for specifying cleanup behavior.
EcsOnDeleteTarget
const ecs_entity_t EcsOnDeleteTarget
Relationship used to define what should happen when a target entity (second element of a pair) is del...
EcsPreFrame
const ecs_entity_t EcsPreFrame
PreFrame pipeline phase.
EcsFlecs
const ecs_entity_t EcsFlecs
Root scope for builtin flecs entities.
EcsSystem
const ecs_entity_t EcsSystem
Tag added to systems.
EcsOnUpdate
const ecs_entity_t EcsOnUpdate
OnUpdate pipeline phase.
EcsDisabled
const ecs_entity_t EcsDisabled
When this tag is added to an entity it is skipped by queries, unless EcsDisabled is explicitly querie...
EcsDontInherit
const ecs_entity_t EcsDontInherit
Never inherit component on instantiate.
EcsPairIsTag
const ecs_entity_t EcsPairIsTag
Can be added to relationship to indicate that it should never hold data, even when it or the relation...
EcsPanic
const ecs_entity_t EcsPanic
Panic cleanup policy.
EcsFinal
const ecs_entity_t EcsFinal
Ensures that entity/component cannot be used as target in IsA relationship.
EcsVariable
const ecs_entity_t EcsVariable
Variable entity ("$").
EcsConstant
const ecs_entity_t EcsConstant
Tag added to enum/bitmask constants.
ecs_id
FLECS_API const ecs_entity_t ecs_id(EcsDocDescription)
Component id for EcsDocDescription.
ecs_stage_new
ecs_world_t * ecs_stage_new(ecs_world_t *world)
Create unmanaged stage.
ecs_defer_end
bool ecs_defer_end(ecs_world_t *world)
End block of operations to defer.
ecs_readonly_begin
bool ecs_readonly_begin(ecs_world_t *world, bool multi_threaded)
Begin readonly mode.
ecs_defer_resume
void ecs_defer_resume(ecs_world_t *world)
Resume deferring.
ecs_defer_begin
bool ecs_defer_begin(ecs_world_t *world)
Defer operations until end of frame.
ecs_defer_suspend
void ecs_defer_suspend(ecs_world_t *world)
Suspend deferring but do not flush queue.
ecs_is_deferred
bool ecs_is_deferred(const ecs_world_t *world)
Test if deferring is enabled for current stage.
ecs_stage_free
void ecs_stage_free(ecs_world_t *stage)
Free unmanaged stage.
ecs_merge
void ecs_merge(ecs_world_t *stage)
Merge stage.
ecs_stage_get_id
int32_t ecs_stage_get_id(const ecs_world_t *world)
Get stage id.
ecs_stage_is_readonly
bool ecs_stage_is_readonly(const ecs_world_t *world)
Test whether the current world is readonly.
ecs_get_stage_count
int32_t ecs_get_stage_count(const ecs_world_t *world)
Get number of configured stages.
ecs_get_stage
ecs_world_t * ecs_get_stage(const ecs_world_t *world, int32_t stage_id)
Get stage-specific world pointer.
ecs_set_stage_count
void ecs_set_stage_count(ecs_world_t *world, int32_t stages)
Configure world to have N stages.
ecs_readonly_end
void ecs_readonly_end(ecs_world_t *world)
End readonly mode.
ecs_is_defer_suspended
bool ecs_is_defer_suspended(const ecs_world_t *world)
Test if deferring is suspended for current stage.
ecs_get_hooks_id
const ecs_type_hooks_t * ecs_get_hooks_id(const ecs_world_t *world, ecs_entity_t component)
Get hooks for component.
ecs_component_init
ecs_entity_t ecs_component_init(ecs_world_t *world, const ecs_component_desc_t *desc)
Find or create a component.
ecs_get_type_info
const ecs_type_info_t * ecs_get_type_info(const ecs_world_t *world, ecs_id_t component)
Get the type info for an component.
ecs_set_hooks_id
void ecs_set_hooks_id(ecs_world_t *world, ecs_entity_t component, const ecs_type_hooks_t *hooks)
Register hooks for component.
ecs_component_record_t
struct ecs_component_record_t ecs_component_record_t
Information about a (component) id, such as type info and tables with the id.
Definition flecs.h:473
ecs_stage_t
struct ecs_stage_t ecs_stage_t
A stage enables modification while iterating and from multiple threads.
Definition flecs.h:408
ecs_ref_t
struct ecs_ref_t ecs_ref_t
A ref is a fast way to fetch a component for a specific entity.
Definition flecs.h:457
ecs_entity_t
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:361
ecs_world_t
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition flecs.h:405
ecs_mixins_t
struct ecs_mixins_t ecs_mixins_t
Type that stores poly mixins.
Definition flecs.h:497
ecs_id_t
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
Definition flecs.h:354
ecs_observable_t
struct ecs_observable_t ecs_observable_t
An observable produces events that can be listened for by an observer.
Definition flecs.h:441
ecs_record_t
struct ecs_record_t ecs_record_t
Information about an entity, like its table and row.
Definition flecs.h:470
ecs_table_t
struct ecs_table_t ecs_table_t
A table stores entities and components for a specific type.
Definition flecs.h:411
ecs_poly_t
void ecs_poly_t
A poly object.
Definition flecs.h:494
ecs_new_low_id
ecs_entity_t ecs_new_low_id(ecs_world_t *world)
Create new low id.
ecs_set_child_order
void ecs_set_child_order(ecs_world_t *world, ecs_entity_t parent, const ecs_entity_t *children, int32_t child_count)
Set child order for parent with OrderedChildren.
ecs_bulk_init
const ecs_entity_t * ecs_bulk_init(ecs_world_t *world, const ecs_bulk_desc_t *desc)
Bulk create/populate new entities.
ecs_clone
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.
ecs_new
ecs_entity_t ecs_new(ecs_world_t *world)
Create new entity id.
ecs_entity_init
ecs_entity_t ecs_entity_init(ecs_world_t *world, const ecs_entity_desc_t *desc)
Find or create an entity.
ecs_delete
void ecs_delete(ecs_world_t *world, ecs_entity_t entity)
Delete an entity.
ecs_delete_with
void ecs_delete_with(ecs_world_t *world, ecs_id_t component)
Delete all entities with the specified component.
ecs_new_w_id
ecs_entity_t ecs_new_w_id(ecs_world_t *world, ecs_id_t component)
Create new entity with (component) id.
ecs_new_w_table
ecs_entity_t ecs_new_w_table(ecs_world_t *world, ecs_table_t *table)
Create new entity in table.
ecs_bulk_new_w_id
const ecs_entity_t * ecs_bulk_new_w_id(ecs_world_t *world, ecs_id_t component, int32_t count)
Create N new entities.
ecs_get_ordered_children
ecs_entities_t ecs_get_ordered_children(const ecs_world_t *world, ecs_entity_t parent)
Get ordered children.
ecs_children_next
bool ecs_children_next(ecs_iter_t *it)
Progress an iterator created with ecs_children().
ecs_each_id
ecs_iter_t ecs_each_id(const ecs_world_t *world, ecs_id_t component)
Iterate all entities with specified (component id).
ecs_each_next
bool ecs_each_next(ecs_iter_t *it)
Progress an iterator created with ecs_each_id().
ecs_children
ecs_iter_t ecs_children(const ecs_world_t *world, ecs_entity_t parent)
Iterate children of parent.
ecs_children_w_rel
ecs_iter_t ecs_children_w_rel(const ecs_world_t *world, ecs_entity_t relationship, ecs_entity_t parent)
Same as ecs_children() but with custom relationship argument.
ecs_enable_id
void ecs_enable_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t component, bool enable)
Enable or disable component.
ecs_is_enabled_id
bool ecs_is_enabled_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Test if component is enabled.
ecs_enable
void ecs_enable(ecs_world_t *world, ecs_entity_t entity, bool enabled)
Enable or disable entity.
ecs_entity_str
char * ecs_entity_str(const ecs_world_t *world, ecs_entity_t entity)
Convert entity to string.
ecs_get_target
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_get_parent
ecs_entity_t ecs_get_parent(const ecs_world_t *world, ecs_entity_t entity)
Get parent (target of ChildOf relationship) for entity.
ecs_get_target_for_id
ecs_entity_t ecs_get_target_for_id(const ecs_world_t *world, ecs_entity_t entity, ecs_entity_t rel, ecs_id_t component)
Get the target of a relationship for a given component.
ecs_get_type
const ecs_type_t * ecs_get_type(const ecs_world_t *world, ecs_entity_t entity)
Get the type of an entity.
ecs_owns_id
bool ecs_owns_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Test if an entity owns a component.
ecs_type_str
char * ecs_type_str(const ecs_world_t *world, const ecs_type_t *type)
Convert type to string.
ecs_table_str
char * ecs_table_str(const ecs_world_t *world, const ecs_table_t *table)
Convert table to string.
ecs_count_id
int32_t ecs_count_id(const ecs_world_t *world, ecs_id_t entity)
Count entities that have the specified id.
ecs_get_depth
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_get_table
ecs_table_t * ecs_get_table(const ecs_world_t *world, ecs_entity_t entity)
Get the table of an entity.
ecs_has_id
bool ecs_has_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Test if an entity has a component.
ecs_module_action_t
void(* ecs_module_action_t)(ecs_world_t *world)
Initialization action for modules.
Definition flecs.h:616
ecs_group_by_action_t
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:596
ecs_cmp_t
int(* ecs_cmp_t)(const void *a_ptr, const void *b_ptr, const ecs_type_info_t *type_info)
Compare hook to compare component instances.
Definition flecs.h:658
ecs_hash_value_action_t
uint64_t(* ecs_hash_value_action_t)(const void *ptr)
Callback used for hashing values.
Definition flecs.h:634
ecs_group_delete_action_t
void(* ecs_group_delete_action_t)(ecs_world_t *world, uint64_t group_id, void *group_ctx, void *group_by_ctx)
Callback invoked when a query deletes an existing group.
Definition flecs.h:609
ecs_iter_fini_action_t
void(* ecs_iter_fini_action_t)(ecs_iter_t *it)
Function prototype for freeing an iterator.
Definition flecs.h:574
ecs_group_create_action_t
void *(* ecs_group_create_action_t)(ecs_world_t *world, uint64_t group_id, void *group_by_ctx)
Callback invoked when a query creates a new group.
Definition flecs.h:603
ecs_sort_table_action_t
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:585
ecs_iter_next_action_t
bool(* ecs_iter_next_action_t)(ecs_iter_t *it)
Function prototype for iterating an iterator.
Definition flecs.h:566
ecs_iter_action_t
void(* ecs_iter_action_t)(ecs_iter_t *it)
Function prototype for iterables.
Definition flecs.h:556
ecs_copy_t
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:644
ecs_equals_t
bool(* ecs_equals_t)(const void *a_ptr, const void *b_ptr, const ecs_type_info_t *type_info)
Equals operator hook.
Definition flecs.h:664
ecs_compare_action_t
int(* ecs_compare_action_t)(const void *ptr1, const void *ptr2)
Callback used for sorting values.
Definition flecs.h:629
ecs_fini_action_t
void(* ecs_fini_action_t)(ecs_world_t *world, void *ctx)
Action callback on world exit.
Definition flecs.h:620
ecs_move_t
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:651
flecs_poly_dtor_t
void(* flecs_poly_dtor_t)(ecs_poly_t *poly)
Destructor function for poly objects.
Definition flecs.h:670
ecs_run_action_t
void(* ecs_run_action_t)(ecs_iter_t *it)
Function prototype for runnables (systems, observers).
Definition flecs.h:547
ecs_ctx_free_t
void(* ecs_ctx_free_t)(void *ctx)
Function to cleanup context data.
Definition flecs.h:625
ecs_order_by_action_t
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:578
ecs_xtor_t
void(* ecs_xtor_t)(void *ptr, int32_t count, const ecs_type_info_t *type_info)
Constructor/destructor callback.
Definition flecs.h:638
ecs_ref_get_id
void * ecs_ref_get_id(const ecs_world_t *world, ecs_ref_t *ref, ecs_id_t component)
Get component from ref.
ecs_emplace_id
void * ecs_emplace_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t component, size_t size, bool *is_new)
Emplace a component.
ecs_ref_update
void ecs_ref_update(const ecs_world_t *world, ecs_ref_t *ref)
Update ref.
ecs_get_id
const void * ecs_get_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Get an immutable pointer to a component.
ecs_modified_id
void ecs_modified_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Signal that a component has been modified.
ecs_ref_init_id
ecs_ref_t ecs_ref_init_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Create a component ref.
ecs_get_mut_id
void * ecs_get_mut_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Get a mutable pointer to a component.
ecs_ensure_id
void * ecs_ensure_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t component, size_t size)
Ensure entity has component, return pointer.
ecs_set_id
void ecs_set_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t component, size_t size, const void *ptr)
Set the value of a component.
ECS_PAIR
const ecs_id_t ECS_PAIR
Indicates that the id is a pair.
ECS_AUTO_OVERRIDE
const ecs_id_t ECS_AUTO_OVERRIDE
Automatically override component when it is inherited.
ECS_TOGGLE
const ecs_id_t ECS_TOGGLE
Adds bitset to storage which allows component to be enabled/disabled.
ecs_id_str
char * ecs_id_str(const ecs_world_t *world, ecs_id_t component)
Convert component id to string.
ecs_id_is_tag
bool ecs_id_is_tag(const ecs_world_t *world, ecs_id_t component)
Returns whether specified component is a tag.
ecs_id_get_flags
ecs_flags32_t ecs_id_get_flags(const ecs_world_t *world, ecs_id_t component)
Get flags associated with id.
ecs_id_is_valid
bool ecs_id_is_valid(const ecs_world_t *world, ecs_id_t component)
Utility to check if id is valid.
ecs_id_flag_str
const char * ecs_id_flag_str(ecs_id_t component_flags)
Convert component flag to string.
ecs_id_in_use
bool ecs_id_in_use(const ecs_world_t *world, ecs_id_t component)
Returns whether specified component is in use.
ecs_id_match
bool ecs_id_match(ecs_id_t component, ecs_id_t pattern)
Utility to match a component with a pattern.
ecs_id_str_buf
void ecs_id_str_buf(const ecs_world_t *world, ecs_id_t component, ecs_strbuf_t *buf)
Write component string to buffer.
ecs_id_is_pair
bool ecs_id_is_pair(ecs_id_t component)
Utility to check if component is a pair.
ecs_get_typeid
ecs_entity_t ecs_get_typeid(const ecs_world_t *world, ecs_id_t component)
Get the type for a component.
ecs_id_from_str
ecs_id_t ecs_id_from_str(const ecs_world_t *world, const char *expr)
Convert string to a component.
ecs_id_is_wildcard
bool ecs_id_is_wildcard(ecs_id_t component)
Utility to check if component is a wildcard.
ecs_id_is_any
bool ecs_id_is_any(ecs_id_t component)
Utility to check if component is an any wildcard.
ecs_field_src
ecs_entity_t ecs_field_src(const ecs_iter_t *it, int8_t index)
Return field source.
ecs_iter_changed
bool ecs_iter_changed(ecs_iter_t *it)
Returns whether current iterator result has changed.
ecs_field_is_writeonly
bool ecs_field_is_writeonly(const ecs_iter_t *it, int8_t index)
Test whether the field is writeonly.
ecs_iter_get_vars
ecs_var_t * ecs_iter_get_vars(const ecs_iter_t *it)
Get variable array.
ecs_field_is_readonly
bool ecs_field_is_readonly(const ecs_iter_t *it, int8_t index)
Test whether the field is readonly.
ecs_iter_get_var_name
const char * ecs_iter_get_var_name(const ecs_iter_t *it, int32_t var_id)
Get variable name.
ecs_worker_iter
ecs_iter_t ecs_worker_iter(const ecs_iter_t *it, int32_t index, int32_t count)
Create a worker iterator.
ecs_iter_is_true
bool ecs_iter_is_true(ecs_iter_t *it)
Test if iterator is true.
ecs_iter_fini
void ecs_iter_fini(ecs_iter_t *it)
Cleanup iterator resources.
ecs_iter_str
char * ecs_iter_str(const ecs_iter_t *it)
Convert iterator to string.
ecs_iter_var_is_constrained
bool ecs_iter_var_is_constrained(ecs_iter_t *it, int32_t var_id)
Returns whether variable is constrained.
ecs_page_iter
ecs_iter_t ecs_page_iter(const ecs_iter_t *it, int32_t offset, int32_t limit)
Create a paged iterator.
ecs_iter_get_var_count
int32_t ecs_iter_get_var_count(const ecs_iter_t *it)
Get number of variables.
ecs_field_at_w_size
void * ecs_field_at_w_size(const ecs_iter_t *it, size_t size, int8_t index, int32_t row)
Get data for field at specified row.
ecs_field_id
ecs_id_t ecs_field_id(const ecs_iter_t *it, int8_t index)
Return id matched for field.
ecs_field_is_set
bool ecs_field_is_set(const ecs_iter_t *it, int8_t index)
Test whether field is set.
ecs_iter_set_var
void ecs_iter_set_var(ecs_iter_t *it, int32_t var_id, ecs_entity_t entity)
Set value for iterator variable.
ecs_field_is_self
bool ecs_field_is_self(const ecs_iter_t *it, int8_t index)
Test whether the field is matched on self.
ecs_iter_next
bool ecs_iter_next(ecs_iter_t *it)
Progress any iterator.
ecs_iter_get_var
ecs_entity_t ecs_iter_get_var(ecs_iter_t *it, int32_t var_id)
Get value of iterator variable as entity.
ecs_worker_next
bool ecs_worker_next(ecs_iter_t *it)
Progress a worker iterator.
ecs_iter_first
ecs_entity_t ecs_iter_first(ecs_iter_t *it)
Get first matching entity from iterator.
ecs_field_column
int32_t ecs_field_column(const ecs_iter_t *it, int8_t index)
Return index of matched table column.
ecs_iter_get_group
uint64_t ecs_iter_get_group(const ecs_iter_t *it)
Return the group id for the currently iterated result.
ecs_iter_set_var_as_table
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_iter_get_var_as_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_field_w_size
void * ecs_field_w_size(const ecs_iter_t *it, size_t size, int8_t index)
Get data for field.
ecs_iter_count
int32_t ecs_iter_count(ecs_iter_t *it)
Count number of matched entities in query.
ecs_page_next
bool ecs_page_next(ecs_iter_t *it)
Progress a paged iterator.
ecs_iter_set_var_as_range
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_field_size
size_t ecs_field_size(const ecs_iter_t *it, int8_t index)
Return field type size.
ecs_iter_get_var_as_range
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.
ecs_strip_generation
ecs_id_t ecs_strip_generation(ecs_entity_t e)
Remove generation from entity id.
ecs_make_alive_id
void ecs_make_alive_id(ecs_world_t *world, ecs_id_t component)
Same as ecs_make_alive(), but for components.
ecs_is_valid
bool ecs_is_valid(const ecs_world_t *world, ecs_entity_t e)
Test whether an entity is valid.
ecs_make_alive
void ecs_make_alive(ecs_world_t *world, ecs_entity_t entity)
Ensure id is alive.
ecs_get_alive
ecs_entity_t ecs_get_alive(const ecs_world_t *world, ecs_entity_t e)
Get alive identifier.
ecs_exists
bool ecs_exists(const ecs_world_t *world, ecs_entity_t entity)
Test whether an entity exists.
ecs_is_alive
bool ecs_is_alive(const ecs_world_t *world, ecs_entity_t e)
Test whether an entity is alive.
ecs_set_version
void ecs_set_version(ecs_world_t *world, ecs_entity_t entity)
Override the generation of an entity.
ecs_emit
void ecs_emit(ecs_world_t *world, ecs_event_desc_t *desc)
Send event.
ecs_enqueue
void ecs_enqueue(ecs_world_t *world, ecs_event_desc_t *desc)
Enqueue event.
ecs_observer_init
ecs_entity_t ecs_observer_init(ecs_world_t *world, const ecs_observer_desc_t *desc)
Create observer.
ecs_observer_get
const ecs_observer_t * ecs_observer_get(const ecs_world_t *world, ecs_entity_t observer)
Get observer object.
FLECS_EVENT_DESC_MAX
#define FLECS_EVENT_DESC_MAX
Maximum number of events in ecs_observer_desc_t.
Definition flecs.h:302
ecs_ftime_t
#define ecs_ftime_t
Customizable precision for scalar time values.
Definition flecs.h:59
FLECS_ID_DESC_MAX
#define FLECS_ID_DESC_MAX
Maximum number of ids to add ecs_entity_desc_t / ecs_bulk_desc_t.
Definition flecs.h:296
FLECS_TERM_COUNT_MAX
#define FLECS_TERM_COUNT_MAX
Maximum number of terms in queries.
Definition flecs.h:312
ecs_get_path_w_sep
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_new_from_path_w_sep
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_lookup_symbol
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.
ecs_set_alias
void ecs_set_alias(ecs_world_t *world, ecs_entity_t entity, const char *alias)
Set alias for entity.
ecs_lookup
ecs_entity_t ecs_lookup(const ecs_world_t *world, const char *path)
Lookup an entity by it's path.
ecs_get_scope
ecs_entity_t ecs_get_scope(const ecs_world_t *world)
Get the current scope.
ecs_get_path_w_sep_buf
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, bool escape)
Write path identifier to buffer.
ecs_set_lookup_path
ecs_entity_t * ecs_set_lookup_path(ecs_world_t *world, const ecs_entity_t *lookup_path)
Set search path for lookup operations.
ecs_set_name
ecs_entity_t ecs_set_name(ecs_world_t *world, ecs_entity_t entity, const char *name)
Set the name of an entity.
ecs_get_symbol
const char * ecs_get_symbol(const ecs_world_t *world, ecs_entity_t entity)
Get the symbol of an entity.
ecs_lookup_path_w_sep
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_set_symbol
ecs_entity_t ecs_set_symbol(ecs_world_t *world, ecs_entity_t entity, const char *symbol)
Set the symbol of an entity.
ecs_lookup_child
ecs_entity_t ecs_lookup_child(const ecs_world_t *world, ecs_entity_t parent, const char *name)
Lookup a child entity by name.
ecs_get_name
const char * ecs_get_name(const ecs_world_t *world, ecs_entity_t entity)
Get the name of an entity.
ecs_add_path_w_sep
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_get_lookup_path
ecs_entity_t * ecs_get_lookup_path(const ecs_world_t *world)
Get current lookup path.
ecs_set_scope
ecs_entity_t ecs_set_scope(ecs_world_t *world, ecs_entity_t scope)
Set the current scope.
ecs_set_name_prefix
const char * ecs_set_name_prefix(ecs_world_t *world, const char *prefix)
Set a name prefix for newly created entities.
ecs_iter_skip
void ecs_iter_skip(ecs_iter_t *it)
Skip a table while iterating.
ecs_iter_set_group
void ecs_iter_set_group(ecs_iter_t *it, uint64_t group_id)
Set group to iterate for query iterator.
ecs_query_get
const ecs_query_t * ecs_query_get(const ecs_world_t *world, ecs_entity_t query)
Get query object.
ecs_query_next
bool ecs_query_next(ecs_iter_t *it)
Progress query iterator.
ecs_query_get_group_info
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.
ecs_query_has
bool ecs_query_has(ecs_query_t *query, ecs_entity_t entity, ecs_iter_t *it)
Match entity with query.
ecs_query_is_true
bool ecs_query_is_true(const ecs_query_t *query)
Does query return one or more results.
ecs_term_str
char * ecs_term_str(const ecs_world_t *world, const ecs_term_t *term)
Convert term to string expression.
ecs_query_find_var
int32_t ecs_query_find_var(const ecs_query_t *query, const char *name)
Find variable index.
ecs_query_fini
void ecs_query_fini(ecs_query_t *query)
Delete a query.
ecs_query_plan_w_profile
char * ecs_query_plan_w_profile(const ecs_query_t *query, const ecs_iter_t *it)
Convert query to string with profile.
ecs_query_args_parse
const char * ecs_query_args_parse(ecs_query_t *query, ecs_iter_t *it, const char *expr)
Populate variables from key-value string.
ecs_query_match_count
int32_t ecs_query_match_count(const ecs_query_t *query)
Returns how often a match event happened for a cached query.
ecs_query_plan
char * ecs_query_plan(const ecs_query_t *query)
Convert query to a string.
ecs_query_iter
ecs_iter_t ecs_query_iter(const ecs_world_t *world, const ecs_query_t *query)
Create a query iterator.
ecs_query_str
char * ecs_query_str(const ecs_query_t *query)
Convert query to string expression.
ecs_query_var_is_entity
bool ecs_query_var_is_entity(const ecs_query_t *query, int32_t var_id)
Test if variable is an entity.
ecs_query_init
ecs_query_t * ecs_query_init(ecs_world_t *world, const ecs_query_desc_t *desc)
Create a query.
ecs_query_changed
bool ecs_query_changed(ecs_query_t *query)
Returns whether the query data changed since the last iteration.
ecs_query_has_range
bool ecs_query_has_range(ecs_query_t *query, ecs_table_range_t *range, ecs_iter_t *it)
Match range with query.
ecs_query_var_name
const char * ecs_query_var_name(const ecs_query_t *query, int32_t var_id)
Get variable name.
ecs_term_match_this
bool ecs_term_match_this(const ecs_term_t *term)
Is term matched on $this variable.
ecs_query_has_table
bool ecs_query_has_table(ecs_query_t *query, ecs_table_t *table, ecs_iter_t *it)
Match table with query.
ecs_query_get_group_ctx
void * ecs_query_get_group_ctx(const ecs_query_t *query, uint64_t group_id)
Get context of query group.
ecs_query_count
ecs_query_count_t ecs_query_count(const ecs_query_t *query)
Returns number of entities and results the query matches with.
ecs_term_is_initialized
bool ecs_term_is_initialized(const ecs_term_t *term)
Test whether a term is set.
ecs_term_ref_is_set
bool ecs_term_ref_is_set(const ecs_term_ref_t *ref)
Test whether term ref is set.
ecs_term_match_0
bool ecs_term_match_0(const ecs_term_t *term)
Is term matched on 0 source.
ecs_query_get_cache_query
const ecs_query_t * ecs_query_get_cache_query(const ecs_query_t *query)
Get query used to populate cache.
ecs_query_cache_kind_t
ecs_query_cache_kind_t
Specify cache policy for query.
Definition flecs.h:704
ecs_inout_kind_t
ecs_inout_kind_t
Specify read/write access for term.
Definition flecs.h:683
ecs_oper_kind_t
ecs_oper_kind_t
Specify operator for term.
Definition flecs.h:693
EcsQueryCacheAll
@ EcsQueryCacheAll
Require that all query terms can be cached.
Definition flecs.h:707
EcsQueryCacheDefault
@ EcsQueryCacheDefault
Behavior determined by query creation context.
Definition flecs.h:705
EcsQueryCacheNone
@ EcsQueryCacheNone
No caching.
Definition flecs.h:708
EcsQueryCacheAuto
@ EcsQueryCacheAuto
Cache query terms that are cacheable.
Definition flecs.h:706
EcsOut
@ EcsOut
Term is only written.
Definition flecs.h:689
EcsInOut
@ EcsInOut
Term is both read and written.
Definition flecs.h:687
EcsInOutFilter
@ EcsInOutFilter
Same as InOutNone + prevents term from triggering observers.
Definition flecs.h:686
EcsInOutDefault
@ EcsInOutDefault
InOut for regular terms, In for shared terms.
Definition flecs.h:684
EcsInOutNone
@ EcsInOutNone
Term is neither read nor written.
Definition flecs.h:685
EcsIn
@ EcsIn
Term is only read.
Definition flecs.h:688
EcsNot
@ EcsNot
The term must not match.
Definition flecs.h:696
EcsOptional
@ EcsOptional
The term may match.
Definition flecs.h:697
EcsOr
@ EcsOr
One of the terms in an or chain must match.
Definition flecs.h:695
EcsOrFrom
@ EcsOrFrom
Term must match at least one component from term id.
Definition flecs.h:699
EcsAnd
@ EcsAnd
The term must match.
Definition flecs.h:694
EcsNotFrom
@ EcsNotFrom
Term must match none of the components from term id.
Definition flecs.h:700
EcsAndFrom
@ EcsAndFrom
Term must match all components from term id.
Definition flecs.h:698
ecs_table_add_id
ecs_table_t * ecs_table_add_id(ecs_world_t *world, ecs_table_t *table, ecs_id_t component)
Get table that has all components of current table plus the specified id.
ecs_search_offset
int32_t ecs_search_offset(const ecs_world_t *world, const ecs_table_t *table, int32_t offset, ecs_id_t component, ecs_id_t *component_out)
Search for component in table type starting from an offset.
ecs_table_remove_id
ecs_table_t * ecs_table_remove_id(ecs_world_t *world, ecs_table_t *table, ecs_id_t component)
Get table that has all components of current table minus the specified component.
ecs_table_get_type
const ecs_type_t * ecs_table_get_type(const ecs_table_t *table)
Get type for table.
ecs_table_get_column_index
int32_t ecs_table_get_column_index(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t component)
Get column index for component.
ecs_table_get_id
void * ecs_table_get_id(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t component, int32_t offset)
Get column from table by component.
ecs_table_size
int32_t ecs_table_size(const ecs_table_t *table)
Returns allocated size of table.
ecs_table_has_flags
bool ecs_table_has_flags(ecs_table_t *table, ecs_flags32_t flags)
Test table for flags.
ecs_table_column_to_type_index
int32_t ecs_table_column_to_type_index(const ecs_table_t *table, int32_t index)
Convert column index to type index.
ecs_table_column_count
int32_t ecs_table_column_count(const ecs_table_t *table)
Return number of columns in table.
ecs_commit
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.
ecs_table_get_column
void * ecs_table_get_column(const ecs_table_t *table, int32_t index, int32_t offset)
Get column from table by column index.
ecs_search
int32_t ecs_search(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t component, ecs_id_t *component_out)
Search for component in table type.
ecs_table_get_target
ecs_entity_t ecs_table_get_target(const ecs_world_t *world, const ecs_table_t *table, ecs_entity_t relationship, int32_t index)
Get relationship target for table.
ecs_table_count
int32_t ecs_table_count(const ecs_table_t *table)
Returns the number of entities in the table.
ecs_table_entities
const ecs_entity_t * ecs_table_entities(const ecs_table_t *table)
Returns array with entity ids for table.
ecs_table_unlock
void ecs_table_unlock(ecs_world_t *world, ecs_table_t *table)
Unlock a table.
ecs_table_has_traversable
bool ecs_table_has_traversable(const ecs_table_t *table)
Check if table has traversable entities.
ecs_table_get_depth
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.
ecs_search_relation
int32_t ecs_search_relation(const ecs_world_t *world, const ecs_table_t *table, int32_t offset, ecs_id_t component, ecs_entity_t rel, ecs_flags64_t flags, ecs_entity_t *subject_out, ecs_id_t *component_out, struct ecs_table_record_t **tr_out)
Search for component/relationship id in table type starting from an offset.
ecs_table_has_id
bool ecs_table_has_id(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t component)
Test if table has component.
ecs_table_swap_rows
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.
ecs_table_lock
void ecs_table_lock(ecs_world_t *world, ecs_table_t *table)
Lock a table.
ecs_table_find
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_table_get_column_size
size_t ecs_table_get_column_size(const ecs_table_t *table, int32_t index)
Get column size from table.
ecs_table_get_type_index
int32_t ecs_table_get_type_index(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t component)
Get type index for component.
ecs_table_clear_entities
void ecs_table_clear_entities(ecs_world_t *world, ecs_table_t *table)
Remove all entities in a table.
ecs_table_type_to_column_index
int32_t ecs_table_type_to_column_index(const ecs_table_t *table, int32_t index)
Convert type index to column index.
ecs_value_fini_w_type_info
int ecs_value_fini_w_type_info(const ecs_world_t *world, const ecs_type_info_t *ti, void *ptr)
Destruct a value.
ecs_value_fini
int ecs_value_fini(const ecs_world_t *world, ecs_entity_t type, void *ptr)
Destruct a value.
ecs_value_copy
int ecs_value_copy(const ecs_world_t *world, ecs_entity_t type, void *dst, const void *src)
Copy value.
ecs_value_move
int ecs_value_move(const ecs_world_t *world, ecs_entity_t type, void *dst, void *src)
Move value.
ecs_value_move_w_type_info
int ecs_value_move_w_type_info(const ecs_world_t *world, const ecs_type_info_t *ti, void *dst, void *src)
Move value.
ecs_value_new_w_type_info
void * ecs_value_new_w_type_info(ecs_world_t *world, const ecs_type_info_t *ti)
Construct a value in new storage.
ecs_value_move_ctor_w_type_info
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.
ecs_value_copy_w_type_info
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.
ecs_value_init_w_type_info
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.
ecs_value_new
void * ecs_value_new(ecs_world_t *world, ecs_entity_t type)
Construct a value in new storage.
ecs_value_free
int ecs_value_free(ecs_world_t *world, ecs_entity_t type, void *ptr)
Destruct a value, free storage.
ecs_value_move_ctor
int ecs_value_move_ctor(const ecs_world_t *world, ecs_entity_t type, void *dst, void *src)
Move construct value.
ecs_value_init
int ecs_value_init(const ecs_world_t *world, ecs_entity_t type, void *ptr)
Construct a value in existing storage.
ecs_atfini
void ecs_atfini(ecs_world_t *world, ecs_fini_action_t action, void *ctx)
Register action to be executed when world is destroyed.
ecs_is_fini
bool ecs_is_fini(const ecs_world_t *world)
Returns whether the world is being deleted.
ecs_fini
int ecs_fini(ecs_world_t *world)
Delete a world.
ecs_world_get_flags
ecs_flags32_t ecs_world_get_flags(const ecs_world_t *world)
Get flags set on the world.
ecs_mini
ecs_world_t * ecs_mini(void)
Create a new world with just the core module.
ecs_init
ecs_world_t * ecs_init(void)
Create a new world.
ecs_init_w_args
ecs_world_t * ecs_init_w_args(int argc, char *argv[])
Create a new world with arguments.
ecs_get_entities
ecs_entities_t ecs_get_entities(const ecs_world_t *world)
Return entity identifiers in world.
ecs_set_target_fps
void ecs_set_target_fps(ecs_world_t *world, float fps)
Set target frames per second (FPS) for application.
ecs_measure_system_time
void ecs_measure_system_time(ecs_world_t *world, bool enable)
Measure system time.
ecs_frame_begin
float ecs_frame_begin(ecs_world_t *world, float delta_time)
Begin frame.
ecs_run_post_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.
ecs_should_quit
bool ecs_should_quit(const ecs_world_t *world)
Return whether a quit has been requested.
ecs_set_default_query_flags
void ecs_set_default_query_flags(ecs_world_t *world, ecs_flags32_t flags)
Set default query flags.
ecs_quit
void ecs_quit(ecs_world_t *world)
Signal exit This operation signals that the application should quit.
ecs_measure_frame_time
void ecs_measure_frame_time(ecs_world_t *world, bool enable)
Measure frame time.
ecs_frame_end
void ecs_frame_end(ecs_world_t *world)
End frame.
ecs_get_entity
ecs_entity_t ecs_get_entity(const ecs_poly_t *poly)
Get entity from poly.
ecs_make_pair
ecs_id_t ecs_make_pair(ecs_entity_t first, ecs_entity_t second)
Make a pair id.
ecs_get_build_info
const ecs_build_info_t * ecs_get_build_info(void)
Get build info.
flecs_poly_is_
bool flecs_poly_is_(const ecs_poly_t *object, int32_t type)
Test if pointer is of specified type.
ecs_get_max_id
ecs_entity_t ecs_get_max_id(const ecs_world_t *world)
Get the largest issued entity id (not counting generation).
ecs_run_aperiodic
void ecs_run_aperiodic(ecs_world_t *world, ecs_flags32_t flags)
Force aperiodic actions.
ecs_get_binding_ctx
void * ecs_get_binding_ctx(const ecs_world_t *world)
Get the world binding context.
ecs_shrink
void ecs_shrink(ecs_world_t *world)
Free unused memory.
ecs_dim
void ecs_dim(ecs_world_t *world, int32_t entity_count)
Dimension the world for a specified number of entities.
ecs_set_entity_range
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.
ecs_get_world_info
const ecs_world_info_t * ecs_get_world_info(const ecs_world_t *world)
Get world info.
ecs_get_world
const ecs_world_t * ecs_get_world(const ecs_poly_t *poly)
Get world from poly.
ecs_set_ctx
void ecs_set_ctx(ecs_world_t *world, void *ctx, ecs_ctx_free_t ctx_free)
Set a world context.
ecs_exclusive_access_begin
void ecs_exclusive_access_begin(ecs_world_t *world, const char *thread_name)
Begin exclusive thread access.
ecs_delete_empty_tables
int32_t ecs_delete_empty_tables(ecs_world_t *world, const ecs_delete_empty_tables_desc_t *desc)
Cleanup empty tables.
ecs_set_binding_ctx
void ecs_set_binding_ctx(ecs_world_t *world, void *ctx, ecs_ctx_free_t ctx_free)
Set a world binding context.
ecs_enable_range_check
bool ecs_enable_range_check(ecs_world_t *world, bool enable)
Enable/disable range limits.
ecs_exclusive_access_end
void ecs_exclusive_access_end(ecs_world_t *world, bool lock_world)
End exclusive thread access.
ecs_get_ctx
void * ecs_get_ctx(const ecs_world_t *world)
Get the world context.
os_api.h
Operating system abstraction API.
EcsComponent
Component information.
Definition flecs.h:1537
EcsComponent::size
ecs_size_t size
Component size.
Definition flecs.h:1538
EcsComponent::alignment
ecs_size_t alignment
Component alignment.
Definition flecs.h:1539
EcsDefaultChildComponent
When added to an entity this informs serialization formats which component to use when a value is ass...
Definition flecs.h:1552
EcsDefaultChildComponent::component
ecs_id_t component
Default component id.
Definition flecs.h:1553
EcsIdentifier
A (string) identifier.
Definition flecs.h:1528
EcsIdentifier::length
ecs_size_t length
Length of identifier.
Definition flecs.h:1530
EcsIdentifier::value
char * value
Identifier string.
Definition flecs.h:1529
EcsIdentifier::index
ecs_hashmap_t * index
Current index.
Definition flecs.h:1533
EcsIdentifier::hash
uint64_t hash
Hash of current value.
Definition flecs.h:1531
EcsIdentifier::index_hash
uint64_t index_hash
Hash of existing record in current index.
Definition flecs.h:1532
EcsPoly
Component for storing a poly object.
Definition flecs.h:1543
EcsPoly::poly
ecs_poly_t * poly
Pointer to poly object.
Definition flecs.h:1544
EcsRateFilter
Apply a rate filter to a tick source.
Definition timer.h:45
EcsTickSource
Component used to provide a tick source to systems.
Definition system.h:32
EcsTimer
Component used for one shot/interval timer functionality.
Definition timer.h:35
ecs_build_info_t
Type with information about the current Flecs build.
Definition flecs.h:1435
ecs_build_info_t::flags
const char ** flags
Compile time settings.
Definition flecs.h:1438
ecs_build_info_t::version_major
int16_t version_major
Major flecs version.
Definition flecs.h:1440
ecs_build_info_t::addons
const char ** addons
Addons included in build.
Definition flecs.h:1437
ecs_build_info_t::version
const char * version
Stringified version.
Definition flecs.h:1439
ecs_build_info_t::compiler
const char * compiler
Compiler used to compile flecs.
Definition flecs.h:1436
ecs_build_info_t::sanitize
bool sanitize
Is this a sanitize build.
Definition flecs.h:1444
ecs_build_info_t::perf_trace
bool perf_trace
Is this a perf tracing build.
Definition flecs.h:1445
ecs_build_info_t::version_minor
int16_t version_minor
Minor flecs version.
Definition flecs.h:1441
ecs_build_info_t::debug
bool debug
Is this a debug build.
Definition flecs.h:1443
ecs_build_info_t::version_patch
int16_t version_patch
Patch flecs version.
Definition flecs.h:1442
ecs_bulk_desc_t
Used with ecs_bulk_init().
Definition flecs.h:1064
ecs_bulk_desc_t::ids
ecs_id_t ids[32]
Ids to create the entities with.
Definition flecs.h:1074
ecs_bulk_desc_t::data
void ** data
Array with component data to insert.
Definition flecs.h:1076
ecs_bulk_desc_t::count
int32_t count
Number of entities to create/populate.
Definition flecs.h:1072
ecs_bulk_desc_t::_canary
int32_t _canary
Used for validity testing.
Definition flecs.h:1065
ecs_bulk_desc_t::entities
ecs_entity_t * entities
Entities to bulk insert.
Definition flecs.h:1067
ecs_bulk_desc_t::table
ecs_table_t * table
Table to insert the entities into.
Definition flecs.h:1083
ecs_component_desc_t
Used with ecs_component_init().
Definition flecs.h:1094
ecs_component_desc_t::_canary
int32_t _canary
Used for validity testing.
Definition flecs.h:1095
ecs_component_desc_t::type
ecs_type_info_t type
Parameters for type (size, hooks, ...).
Definition flecs.h:1101
ecs_component_desc_t::entity
ecs_entity_t entity
Existing entity to associate with observer (optional).
Definition flecs.h:1098
ecs_delete_empty_tables_desc_t
Used with ecs_delete_empty_tables().
Definition flecs.h:2659
ecs_delete_empty_tables_desc_t::delete_generation
uint16_t delete_generation
Delete table when generation > delete_generation.
Definition flecs.h:2664
ecs_delete_empty_tables_desc_t::time_budget_seconds
double time_budget_seconds
Amount of time operation is allowed to spend.
Definition flecs.h:2667
ecs_delete_empty_tables_desc_t::clear_generation
uint16_t clear_generation
Free table data when generation > clear_generation.
Definition flecs.h:2661
ecs_entities_t
Type returned by ecs_get_entities().
Definition flecs.h:2014
ecs_entities_t::alive_count
int32_t alive_count
Number of alive entity ids.
Definition flecs.h:2017
ecs_entities_t::count
int32_t count
Total number of entity ids.
Definition flecs.h:2016
ecs_entities_t::ids
const ecs_entity_t * ids
Array with all entity ids in the world.
Definition flecs.h:2015
ecs_entity_desc_t
Used with ecs_entity_init().
Definition flecs.h:1018
ecs_entity_desc_t::sep
const char * sep
Optional custom separator for hierarchical names.
Definition flecs.h:1030
ecs_entity_desc_t::root_sep
const char * root_sep
Optional, used for identifiers relative to root.
Definition flecs.h:1034
ecs_entity_desc_t::name
const char * name
Name of the entity.
Definition flecs.h:1025
ecs_entity_desc_t::use_low_id
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:1046
ecs_entity_desc_t::symbol
const char * symbol
Optional entity symbol.
Definition flecs.h:1036
ecs_entity_desc_t::_canary
int32_t _canary
Used for validity testing.
Definition flecs.h:1019
ecs_entity_desc_t::add
const ecs_id_t * add
0-terminated array of ids to add to the entity.
Definition flecs.h:1051
ecs_entity_desc_t::add_expr
const char * add_expr
String expression with components to add.
Definition flecs.h:1057
ecs_entity_desc_t::set
const ecs_value_t * set
0-terminated array of values to set on the entity.
Definition flecs.h:1054
ecs_entity_desc_t::id
ecs_entity_t id
Set to modify existing entity (optional).
Definition flecs.h:1021
ecs_entity_desc_t::parent
ecs_entity_t parent
Parent entity.
Definition flecs.h:1023
ecs_event_desc_t
Used with ecs_emit().
Definition flecs.h:1381
ecs_event_desc_t::entity
ecs_entity_t entity
Single-entity alternative to setting table / offset / count.
Definition flecs.h:1406
ecs_event_desc_t::const_param
const void * const_param
Same as param, but with the guarantee that the value won't be modified.
Definition flecs.h:1417
ecs_event_desc_t::table
ecs_table_t * table
The table for which to notify.
Definition flecs.h:1391
ecs_event_desc_t::count
int32_t count
Limit number of notified entities to count.
Definition flecs.h:1403
ecs_event_desc_t::other_table
ecs_table_t * other_table
Optional 2nd table to notify.
Definition flecs.h:1395
ecs_event_desc_t::offset
int32_t offset
Limit notified entities to ones starting from offset (row) in table.
Definition flecs.h:1398
ecs_event_desc_t::ids
const ecs_type_t * ids
Component ids.
Definition flecs.h:1388
ecs_event_desc_t::observable
ecs_poly_t * observable
Observable (usually the world).
Definition flecs.h:1420
ecs_event_desc_t::event
ecs_entity_t event
The event id.
Definition flecs.h:1383
ecs_event_desc_t::flags
ecs_flags32_t flags
Event flags.
Definition flecs.h:1423
ecs_event_desc_t::param
void * param
Optional context.
Definition flecs.h:1412
ecs_header_t
Header for ecs_poly_t objects.
Definition flecs.h:500
ecs_header_t::type
int32_t type
Magic number indicating which type of flecs object.
Definition flecs.h:501
ecs_header_t::refcount
int32_t refcount
Refcount, to enable RAII handles.
Definition flecs.h:502
ecs_header_t::mixins
ecs_mixins_t * mixins
Table with offsets to (optional) mixins.
Definition flecs.h:503
ecs_iter_t
Iterator.
Definition flecs.h:1142
ecs_iter_t::real_world
ecs_world_t * real_world
Actual world.
Definition flecs.h:1145
ecs_iter_t::param
void * param
Param passed to ecs_run.
Definition flecs.h:1178
ecs_iter_t::event
ecs_entity_t event
The event (if applicable).
Definition flecs.h:1166
ecs_iter_t::frame_offset
int32_t frame_offset
Offset relative to start of iteration.
Definition flecs.h:1189
ecs_iter_t::ref_fields
ecs_flags32_t ref_fields
Bitset with fields that aren't component arrays.
Definition flecs.h:1160
ecs_iter_t::interrupted_by
ecs_entity_t interrupted_by
When set, system execution is interrupted.
Definition flecs.h:1193
ecs_iter_t::flags
ecs_flags32_t flags
Iterator flags.
Definition flecs.h:1192
ecs_iter_t::chain_it
ecs_iter_t * chain_it
Optional, allows for creating iterator chains.
Definition flecs.h:1200
ecs_iter_t::ctx
void * ctx
System context.
Definition flecs.h:1179
ecs_iter_t::run_ctx
void * run_ctx
Run language binding context.
Definition flecs.h:1182
ecs_iter_t::table
ecs_table_t * table
Current table.
Definition flecs.h:1154
ecs_iter_t::offset
int32_t offset
Offset relative to current table.
Definition flecs.h:1148
ecs_iter_t::event_id
ecs_id_t event_id
The (component) id for the event.
Definition flecs.h:1167
ecs_iter_t::fini
ecs_iter_fini_action_t fini
Function to cleanup iterator resources.
Definition flecs.h:1199
ecs_iter_t::priv_
ecs_iter_private_t priv_
Private data.
Definition flecs.h:1194
ecs_iter_t::world
ecs_world_t * world
The world.
Definition flecs.h:1144
ecs_iter_t::callback_ctx
void * callback_ctx
Callback language binding context.
Definition flecs.h:1181
ecs_iter_t::sources
ecs_entity_t * sources
Entity on which the id was matched (0 if same as entities).
Definition flecs.h:1157
ecs_iter_t::binding_ctx
void * binding_ctx
System binding context.
Definition flecs.h:1180
ecs_iter_t::row_fields
ecs_flags32_t row_fields
Fields that must be obtained with field_at.
Definition flecs.h:1161
ecs_iter_t::delta_system_time
float delta_system_time
Time elapsed since last system invocation.
Definition flecs.h:1186
ecs_iter_t::query
const ecs_query_t * query
Query being evaluated.
Definition flecs.h:1175
ecs_iter_t::term_index
int8_t term_index
Index of term that emitted an event.
Definition flecs.h:1172
ecs_iter_t::system
ecs_entity_t system
The system (if applicable).
Definition flecs.h:1165
ecs_iter_t::set_fields
ecs_flags32_t set_fields
Fields that are set.
Definition flecs.h:1159
ecs_iter_t::sizes
const ecs_size_t * sizes
Component sizes.
Definition flecs.h:1153
ecs_iter_t::delta_time
float delta_time
Time elapsed since last frame.
Definition flecs.h:1185
ecs_iter_t::up_fields
ecs_flags32_t up_fields
Bitset with fields matched through up traversal.
Definition flecs.h:1162
ecs_iter_t::callback
ecs_iter_action_t callback
Callback of system or observer.
Definition flecs.h:1198
ecs_iter_t::field_count
int8_t field_count
Number of fields in iterator.
Definition flecs.h:1171
ecs_iter_t::other_table
ecs_table_t * other_table
Prev or next table when adding/removing.
Definition flecs.h:1155
ecs_iter_t::event_cur
int32_t event_cur
Unique event id.
Definition flecs.h:1168
ecs_iter_t::trs
const ecs_table_record_t ** trs
Info on where to find field in table.
Definition flecs.h:1152
ecs_iter_t::count
int32_t count
Number of entities to iterate.
Definition flecs.h:1149
ecs_iter_t::ptrs
void ** ptrs
Component pointers.
Definition flecs.h:1151
ecs_iter_t::next
ecs_iter_next_action_t next
Function to progress iterator.
Definition flecs.h:1197
ecs_iter_t::entities
const ecs_entity_t * entities
Entity identifiers.
Definition flecs.h:1150
ecs_iter_t::ids
ecs_id_t * ids
(Component) ids
Definition flecs.h:1156
ecs_iter_t::constrained_vars
ecs_flags64_t constrained_vars
Bitset that marks constrained variables.
Definition flecs.h:1158
ecs_observer_desc_t
Used with ecs_observer_init().
Definition flecs.h:1325
ecs_observer_desc_t::run_ctx_free
ecs_ctx_free_t run_ctx_free
Callback to free run ctx.
Definition flecs.h:1369
ecs_observer_desc_t::ctx_free
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:1357
ecs_observer_desc_t::run_ctx
void * run_ctx
Context associated with run (for language bindings).
Definition flecs.h:1366
ecs_observer_desc_t::entity
ecs_entity_t entity
Existing entity to associate with observer (optional).
Definition flecs.h:1330
ecs_observer_desc_t::last_event_id
int32_t * last_event_id
Used for internal purposes.
Definition flecs.h:1372
ecs_observer_desc_t::callback_ctx
void * callback_ctx
Context associated with callback (for language bindings).
Definition flecs.h:1360
ecs_observer_desc_t::ctx
void * ctx
User context to pass to callback.
Definition flecs.h:1354
ecs_observer_desc_t::query
ecs_query_desc_t query
Query for observer.
Definition flecs.h:1333
ecs_observer_desc_t::callback_ctx_free
ecs_ctx_free_t callback_ctx_free
Callback to free callback ctx.
Definition flecs.h:1363
ecs_observer_desc_t::callback
ecs_iter_action_t callback
Callback to invoke on an event, invoked when the observer matches.
Definition flecs.h:1343
ecs_observer_desc_t::yield_existing
bool yield_existing
When observer is created, generate events from existing data.
Definition flecs.h:1340
ecs_observer_desc_t::run
ecs_run_action_t run
Callback invoked on an event.
Definition flecs.h:1351
ecs_observer_desc_t::events
ecs_entity_t events[8]
Events to observe (OnAdd, OnRemove, OnSet).
Definition flecs.h:1336
ecs_observer_desc_t::_canary
int32_t _canary
Used for validity testing.
Definition flecs.h:1327
ecs_observer_t
An observer reacts to events matching a query.
Definition flecs.h:854
ecs_observer_t::event_count
int32_t event_count
Number of events.
Definition flecs.h:861
ecs_observer_t::callback
ecs_iter_action_t callback
See ecs_observer_desc_t::callback.
Definition flecs.h:863
ecs_observer_t::entity
ecs_entity_t entity
Entity associated with observer.
Definition flecs.h:877
ecs_observer_t::observable
ecs_observable_t * observable
Observable for observer.
Definition flecs.h:874
ecs_observer_t::run
ecs_run_action_t run
See ecs_observer_desc_t::run.
Definition flecs.h:864
ecs_observer_t::hdr
ecs_header_t hdr
Object header.
Definition flecs.h:855
ecs_observer_t::ctx_free
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:870
ecs_observer_t::events
ecs_entity_t events[8]
Observer events.
Definition flecs.h:860
ecs_observer_t::run_ctx
void * run_ctx
Run language binding context.
Definition flecs.h:868
ecs_observer_t::world
ecs_world_t * world
The world.
Definition flecs.h:876
ecs_observer_t::run_ctx_free
ecs_ctx_free_t run_ctx_free
Callback to free run_ctx.
Definition flecs.h:872
ecs_observer_t::callback_ctx
void * callback_ctx
Callback language binding context.
Definition flecs.h:867
ecs_observer_t::ctx
void * ctx
Observer context.
Definition flecs.h:866
ecs_observer_t::callback_ctx_free
ecs_ctx_free_t callback_ctx_free
Callback to free callback_ctx.
Definition flecs.h:871
ecs_observer_t::query
ecs_query_t * query
Observer query.
Definition flecs.h:857
ecs_query_count_t
Struct returned by ecs_query_count().
Definition flecs.h:5053
ecs_query_count_t::entities
int32_t entities
Number of entities returned by query.
Definition flecs.h:5055
ecs_query_count_t::results
int32_t results
Number of results returned by query.
Definition flecs.h:5054
ecs_query_count_t::tables
int32_t tables
Number of tables returned by query.
Definition flecs.h:5056
ecs_query_desc_t
Used with ecs_query_init().
Definition flecs.h:1251
ecs_query_desc_t::ctx_free
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:1312
ecs_query_desc_t::group_by
ecs_id_t group_by
Component id to be used for grouping.
Definition flecs.h:1282
ecs_query_desc_t::terms
ecs_term_t terms[32]
Query terms.
Definition flecs.h:1256
ecs_query_desc_t::_canary
int32_t _canary
Used for validity testing.
Definition flecs.h:1253
ecs_query_desc_t::ctx
void * ctx
User context to pass to callback.
Definition flecs.h:1306
ecs_query_desc_t::group_by_ctx_free
ecs_ctx_free_t group_by_ctx_free
Function to free group_by_ctx.
Definition flecs.h:1303
ecs_query_desc_t::group_by_ctx
void * group_by_ctx
Context to pass to group_by.
Definition flecs.h:1300
ecs_query_desc_t::binding_ctx
void * binding_ctx
Context to be used for language bindings.
Definition flecs.h:1309
ecs_query_desc_t::order_by
ecs_entity_t order_by
Component to sort on, used together with order_by_callback or order_by_table_callback.
Definition flecs.h:1278
ecs_query_desc_t::order_by_callback
ecs_order_by_action_t order_by_callback
Callback used for ordering query results.
Definition flecs.h:1270
ecs_query_desc_t::on_group_create
ecs_group_create_action_t on_group_create
Callback that is invoked when a new group is created.
Definition flecs.h:1293
ecs_query_desc_t::entity
ecs_entity_t entity
Entity associated with query (optional).
Definition flecs.h:1318
ecs_query_desc_t::binding_ctx_free
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:1315
ecs_query_desc_t::group_by_callback
ecs_group_by_action_t group_by_callback
Callback used for grouping results.
Definition flecs.h:1289
ecs_query_desc_t::on_group_delete
ecs_group_delete_action_t on_group_delete
Callback that is invoked when an existing group is deleted.
Definition flecs.h:1297
ecs_query_desc_t::order_by_table_callback
ecs_sort_table_action_t order_by_table_callback
Callback used for ordering query results.
Definition flecs.h:1274
ecs_query_desc_t::flags
ecs_flags32_t flags
Flags for enabling query features.
Definition flecs.h:1265
ecs_query_desc_t::cache_kind
ecs_query_cache_kind_t cache_kind
Caching policy of query.
Definition flecs.h:1262
ecs_query_desc_t::expr
const char * expr
Query DSL expression (optional).
Definition flecs.h:1259
ecs_query_group_info_t
Type that contains information about a query group.
Definition flecs.h:1511
ecs_query_group_info_t::table_count
int32_t table_count
Number of tables in group.
Definition flecs.h:1514
ecs_query_group_info_t::ctx
void * ctx
Group context, returned by on_group_create.
Definition flecs.h:1515
ecs_query_group_info_t::match_count
int32_t match_count
How often tables have been matched/unmatched.
Definition flecs.h:1513
ecs_query_t
Queries are lists of constraints (terms) that match entities.
Definition flecs.h:813
ecs_query_t::row_fields
ecs_flags32_t row_fields
Fields that must be acquired with field_at.
Definition flecs.h:833
ecs_query_t::data_fields
ecs_flags32_t data_fields
Fields that have data.
Definition flecs.h:830
ecs_query_t::read_fields
ecs_flags32_t read_fields
Fields that read data.
Definition flecs.h:832
ecs_query_t::hdr
ecs_header_t hdr
Object header.
Definition flecs.h:814
ecs_query_t::var_count
int8_t var_count
Number of query variables.
Definition flecs.h:822
ecs_query_t::fixed_fields
ecs_flags32_t fixed_fields
Fields with a fixed source.
Definition flecs.h:827
ecs_query_t::var_fields
ecs_flags32_t var_fields
Fields with non-$this variable source.
Definition flecs.h:828
ecs_query_t::write_fields
ecs_flags32_t write_fields
Fields that write data.
Definition flecs.h:831
ecs_query_t::eval_count
int32_t eval_count
Number of times query is evaluated.
Definition flecs.h:848
ecs_query_t::world
ecs_world_t * world
World or stage query was created with.
Definition flecs.h:846
ecs_query_t::static_id_fields
ecs_flags32_t static_id_fields
Fields with a static (component) id.
Definition flecs.h:829
ecs_query_t::bloom_filter
uint64_t bloom_filter
Bitmask used to quickly discard tables.
Definition flecs.h:820
ecs_query_t::real_world
ecs_world_t * real_world
Actual world.
Definition flecs.h:845
ecs_query_t::set_fields
ecs_flags32_t set_fields
Fields that will be set.
Definition flecs.h:835
ecs_query_t::entity
ecs_entity_t entity
Entity associated with query (optional).
Definition flecs.h:844
ecs_query_t::ctx
void * ctx
User context to pass to callback.
Definition flecs.h:841
ecs_query_t::sizes
int32_t * sizes
Component sizes.
Definition flecs.h:817
ecs_query_t::ids
ecs_id_t * ids
Component ids.
Definition flecs.h:818
ecs_query_t::shared_readonly_fields
ecs_flags32_t shared_readonly_fields
Fields that don't write shared data.
Definition flecs.h:834
ecs_query_t::terms
ecs_term_t * terms
Query terms.
Definition flecs.h:816
ecs_query_t::cache_kind
ecs_query_cache_kind_t cache_kind
Caching policy of query.
Definition flecs.h:837
ecs_query_t::term_count
int8_t term_count
Number of query terms.
Definition flecs.h:823
ecs_query_t::vars
char ** vars
Array with variable names for iterator.
Definition flecs.h:839
ecs_query_t::field_count
int8_t field_count
Number of fields returned by query.
Definition flecs.h:824
ecs_query_t::flags
ecs_flags32_t flags
Query flags.
Definition flecs.h:821
ecs_query_t::binding_ctx
void * binding_ctx
Context to be used for language bindings.
Definition flecs.h:842
ecs_term_ref_t
Type that describes a reference to an entity or variable in a term.
Definition flecs.h:774
ecs_term_ref_t::name
const char * name
Name.
Definition flecs.h:781
ecs_term_ref_t::id
ecs_entity_t id
Entity id.
Definition flecs.h:775
ecs_term_t
Type that describes a term (single element in a query).
Definition flecs.h:789
ecs_term_t::src
ecs_term_ref_t src
Source of term.
Definition flecs.h:795
ecs_term_t::field_index
int8_t field_index
Index of field for term in iterator.
Definition flecs.h:806
ecs_term_t::id
ecs_id_t id
Component id to be matched by term.
Definition flecs.h:790
ecs_term_t::oper
int16_t oper
Operator of term.
Definition flecs.h:804
ecs_term_t::second
ecs_term_ref_t second
Second element of pair.
Definition flecs.h:797
ecs_term_t::flags_
ecs_flags16_t flags_
Flags that help eval, set by ecs_query_init().
Definition flecs.h:807
ecs_term_t::trav
ecs_entity_t trav
Relationship to traverse when looking for the component.
Definition flecs.h:799
ecs_term_t::inout
int16_t inout
Access to contents matched by term.
Definition flecs.h:803
ecs_term_t::first
ecs_term_ref_t first
Component or first element of pair.
Definition flecs.h:796
ecs_type_hooks_t
Definition flecs.h:926
ecs_type_hooks_t::copy_ctor
ecs_copy_t copy_ctor
Ctor + copy.
Definition flecs.h:933
ecs_type_hooks_t::lifecycle_ctx
void * lifecycle_ctx
Component lifecycle context (see meta add-on).
Definition flecs.h:984
ecs_type_hooks_t::ctx
void * ctx
User defined context.
Definition flecs.h:982
ecs_type_hooks_t::on_remove
ecs_iter_action_t on_remove
Callback that is invoked when an instance of the component is removed.
Definition flecs.h:974
ecs_type_hooks_t::binding_ctx
void * binding_ctx
Language binding context.
Definition flecs.h:983
ecs_type_hooks_t::move_dtor
ecs_move_t move_dtor
Move + dtor.
Definition flecs.h:948
ecs_type_hooks_t::flags
ecs_flags32_t flags
Hook flags.
Definition flecs.h:960
ecs_type_hooks_t::cmp
ecs_cmp_t cmp
Compare hook.
Definition flecs.h:951
ecs_type_hooks_t::copy
ecs_copy_t copy
copy assignment
Definition flecs.h:929
ecs_type_hooks_t::lifecycle_ctx_free
ecs_ctx_free_t lifecycle_ctx_free
Callback to free lifecycle_ctx.
Definition flecs.h:988
ecs_type_hooks_t::on_set
ecs_iter_action_t on_set
Callback that is invoked when an instance of the component is set.
Definition flecs.h:969
ecs_type_hooks_t::move
ecs_move_t move
move assignment
Definition flecs.h:930
ecs_type_hooks_t::ctor
ecs_xtor_t ctor
ctor
Definition flecs.h:927
ecs_type_hooks_t::on_replace
ecs_iter_action_t on_replace
Callback that is invoked with the existing and new value before the value is assigned.
Definition flecs.h:980
ecs_type_hooks_t::ctx_free
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:986
ecs_type_hooks_t::on_add
ecs_iter_action_t on_add
Callback that is invoked when an instance of a component is added.
Definition flecs.h:964
ecs_type_hooks_t::binding_ctx_free
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:987
ecs_type_hooks_t::move_ctor
ecs_move_t move_ctor
Ctor + move.
Definition flecs.h:936
ecs_type_hooks_t::equals
ecs_equals_t equals
Equals hook.
Definition flecs.h:954
ecs_type_hooks_t::ctor_move_dtor
ecs_move_t ctor_move_dtor
Ctor + move + dtor (or move_ctor + dtor).
Definition flecs.h:942
ecs_type_hooks_t::dtor
ecs_xtor_t dtor
dtor
Definition flecs.h:928
ecs_type_info_t
Type that contains component information (passed to ctors/dtors/...).
Definition flecs.h:995
ecs_type_info_t::alignment
ecs_size_t alignment
Alignment of type.
Definition flecs.h:997
ecs_type_info_t::size
ecs_size_t size
Size of type.
Definition flecs.h:996
ecs_type_info_t::name
const char * name
Type name.
Definition flecs.h:1000
ecs_type_info_t::component
ecs_entity_t component
Handle to component (do not set).
Definition flecs.h:999
ecs_type_info_t::hooks
ecs_type_hooks_t hooks
Type hooks.
Definition flecs.h:998
ecs_type_t
A type is a list of (component) ids.
Definition flecs.h:378
ecs_type_t::array
ecs_id_t * array
Array with ids.
Definition flecs.h:379
ecs_type_t::count
int32_t count
Number of elements in array.
Definition flecs.h:380
ecs_value_t
Utility to hold a value of a dynamic type.
Definition flecs.h:1009
ecs_value_t::ptr
void * ptr
Pointer to value.
Definition flecs.h:1011
ecs_value_t::type
ecs_entity_t type
Type of value.
Definition flecs.h:1010
ecs_world_info_t
Type that contains information about the world.
Definition flecs.h:1449
ecs_world_info_t::observers_ran_total
int64_t observers_ran_total
Total number of times observer was invoked.
Definition flecs.h:1477
ecs_world_info_t::delta_time
float delta_time
Time passed to or computed by ecs_progress().
Definition flecs.h:1455
ecs_world_info_t::min_id
ecs_entity_t min_id
First allowed entity id.
Definition flecs.h:1451
ecs_world_info_t::systems_ran_total
int64_t systems_ran_total
Total number of systems ran.
Definition flecs.h:1476
ecs_world_info_t::set_count
int64_t set_count
Set commands processed.
Definition flecs.h:1494
ecs_world_info_t::world_time_total
double world_time_total
Time elapsed in simulation.
Definition flecs.h:1463
ecs_world_info_t::tag_id_count
int32_t tag_id_count
Number of tag (no data) ids in the world.
Definition flecs.h:1480
ecs_world_info_t::component_id_count
int32_t component_id_count
Number of component (data) ids in the world.
Definition flecs.h:1481
ecs_world_info_t::pipeline_build_count_total
int64_t pipeline_build_count_total
Total number of pipeline builds.
Definition flecs.h:1475
ecs_world_info_t::eval_comp_monitors_total
int64_t eval_comp_monitors_total
Total number of monitor evaluations.
Definition flecs.h:1468
ecs_world_info_t::table_count
int32_t table_count
Number of tables.
Definition flecs.h:1484
ecs_world_info_t::delta_time_raw
float delta_time_raw
Raw delta time (no time scaling).
Definition flecs.h:1454
ecs_world_info_t::frame_time_total
float frame_time_total
Total time spent processing a frame.
Definition flecs.h:1458
ecs_world_info_t::table_create_total
int64_t table_create_total
Total number of times a table was created.
Definition flecs.h:1473
ecs_world_info_t::system_time_total
float system_time_total
Total time spent in systems.
Definition flecs.h:1459
ecs_world_info_t::id_delete_total
int64_t id_delete_total
Total number of times an id was deleted.
Definition flecs.h:1472
ecs_world_info_t::cmd
struct ecs_world_info_t::@354013130002221015352342176135321160002353227336 cmd
Command statistics.
ecs_world_info_t::merge_time_total
float merge_time_total
Total time spent in merges.
Definition flecs.h:1461
ecs_world_info_t::discard_count
int64_t discard_count
Commands discarded, happens when entity is no longer alive when running the command.
Definition flecs.h:1497
ecs_world_info_t::clear_count
int64_t clear_count
Clear commands processed.
Definition flecs.h:1493
ecs_world_info_t::last_component_id
ecs_entity_t last_component_id
Last issued component entity id.
Definition flecs.h:1450
ecs_world_info_t::frame_count_total
int64_t frame_count_total
Total number of frames.
Definition flecs.h:1466
ecs_world_info_t::max_id
ecs_entity_t max_id
Last allowed entity id.
Definition flecs.h:1452
ecs_world_info_t::merge_count_total
int64_t merge_count_total
Total number of merges.
Definition flecs.h:1467
ecs_world_info_t::other_count
int64_t other_count
Other commands processed.
Definition flecs.h:1499
ecs_world_info_t::batched_command_count
int64_t batched_command_count
Commands batched.
Definition flecs.h:1501
ecs_world_info_t::table_delete_total
int64_t table_delete_total
Total number of times a table was deleted.
Definition flecs.h:1474
ecs_world_info_t::queries_ran_total
int64_t queries_ran_total
Total number of times a query was evaluated.
Definition flecs.h:1478
ecs_world_info_t::delete_count
int64_t delete_count
Delete commands processed.
Definition flecs.h:1492
ecs_world_info_t::rematch_count_total
int64_t rematch_count_total
Total number of rematches.
Definition flecs.h:1469
ecs_world_info_t::id_create_total
int64_t id_create_total
Total number of times a new id was created.
Definition flecs.h:1471
ecs_world_info_t::batched_entity_count
int64_t batched_entity_count
Entities for which commands were batched.
Definition flecs.h:1500
ecs_world_info_t::time_scale
float time_scale
Time scale applied to delta_time.
Definition flecs.h:1456
ecs_world_info_t::pair_id_count
int32_t pair_id_count
Number of pair ids in the world.
Definition flecs.h:1482
ecs_world_info_t::rematch_time_total
float rematch_time_total
Time spent on query rematching.
Definition flecs.h:1462
ecs_world_info_t::ensure_count
int64_t ensure_count
Ensure/emplace commands processed.
Definition flecs.h:1495
ecs_world_info_t::target_fps
float target_fps
Target fps.
Definition flecs.h:1457
ecs_world_info_t::world_time_total_raw
double world_time_total_raw
Time elapsed in simulation (no scaling).
Definition flecs.h:1464
ecs_world_info_t::emit_time_total
float emit_time_total
Total time spent notifying observers.
Definition flecs.h:1460
ecs_world_info_t::creation_time
uint32_t creation_time
Time when world was created.
Definition flecs.h:1486
ecs_world_info_t::modified_count
int64_t modified_count
Modified commands processed.
Definition flecs.h:1496
ecs_world_info_t::name_prefix
const char * name_prefix
Value set by ecs_set_name_prefix().
Definition flecs.h:1504
ecs_world_info_t::event_count
int64_t event_count
Enqueued custom events.
Definition flecs.h:1498
ecs_world_info_t::add_count
int64_t add_count
Add commands processed.
Definition flecs.h:1490
ecs_world_info_t::remove_count
int64_t remove_count
Remove commands processed.
Definition flecs.h:1491