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

| Flecs v4.0 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 1
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
65// #define FLECS_LEGACY
66
72// #define FLECS_ACCURATE_COUNTERS
73
79// #define FLECS_DISABLE_COUNTERS
80
81/* Make sure provided configuration is valid */
82#if defined(FLECS_DEBUG) && defined(FLECS_NDEBUG)
83#warning "invalid configuration: cannot both define FLECS_DEBUG and FLECS_NDEBUG"
84#endif
85#if defined(FLECS_DEBUG) && defined(NDEBUG)
86#warning "invalid configuration: cannot both define FLECS_DEBUG and NDEBUG"
87#endif
88
93#if !defined(FLECS_DEBUG) && !defined(FLECS_NDEBUG)
94#if defined(NDEBUG)
95#define FLECS_NDEBUG
96#else
97#define FLECS_DEBUG
98#endif
99#endif
100
105#ifdef FLECS_SANITIZE
106#ifndef FLECS_DEBUG
107#define FLECS_DEBUG /* If sanitized mode is enabled, so is debug mode */
108#endif
109#endif
110
115#ifdef FLECS_DEBUG
116#ifndef FLECS_DEBUG_INFO
117#define FLECS_DEBUG_INFO
118#endif
119#endif
120
121/* Tip: if you see weird behavior that you think might be a bug, make sure to
122 * test with the FLECS_DEBUG or FLECS_SANITIZE flags enabled. There's a good
123 * chance that this gives you more information about the issue! */
124
138// #define FLECS_SOFT_ASSERT
139
145// #define FLECS_KEEP_ASSERT
146
153// #define FLECS_DEFAULT_TO_UNCACHED_QUERIES
154
163// #define FLECS_CPP_NO_AUTO_REGISTRATION
164
172// #define FLECS_CPP_NO_ENUM_REFLECTION
173
178// #define FLECS_NO_ALWAYS_INLINE
179
207// #define FLECS_CUSTOM_BUILD
208
209#ifndef FLECS_CUSTOM_BUILD
210#define FLECS_ALERTS
211#define FLECS_APP
212// #define FLECS_C /**< C API convenience macros, always enabled */
213#define FLECS_CPP
214#define FLECS_DOC
215// #define FLECS_JOURNAL /**< Journaling addon */
216#define FLECS_JSON
217#define FLECS_HTTP
218#define FLECS_LOG
219#define FLECS_META
220#define FLECS_METRICS
221#define FLECS_MODULE
222#define FLECS_OS_API_IMPL
223// #define FLECS_PERF_TRACE /**< Enable performance tracing */
224#define FLECS_PIPELINE
225#define FLECS_REST
226#define FLECS_PARSER
227#define FLECS_QUERY_DSL
228#define FLECS_SCRIPT
229// #define FLECS_SCRIPT_MATH /**< Math functions for flecs script (may require linking with libm) */
230#define FLECS_SYSTEM
231#define FLECS_STATS
232#define FLECS_TIMER
233#define FLECS_UNITS
234#endif // ifndef FLECS_CUSTOM_BUILD
235
239// #define FLECS_LOW_FOOTPRINT
240#ifdef FLECS_LOW_FOOTPRINT
241#define FLECS_HI_COMPONENT_ID (16)
242#define FLECS_HI_ID_RECORD_ID (16)
243#define FLECS_ENTITY_PAGE_BITS (6)
244#define FLECS_USE_OS_ALLOC
245#define FLECS_DEFAULT_TO_UNCACHED_QUERIES
246#endif
247
262#ifndef FLECS_HI_COMPONENT_ID
263#define FLECS_HI_COMPONENT_ID (256)
264#endif
265
272#ifndef FLECS_HI_ID_RECORD_ID
273#define FLECS_HI_ID_RECORD_ID (1024)
274#endif
275
281#ifndef FLECS_SPARSE_PAGE_BITS
282#define FLECS_SPARSE_PAGE_BITS (6)
283#endif
284
287#ifndef FLECS_ENTITY_PAGE_BITS
288#define FLECS_ENTITY_PAGE_BITS (10)
289#endif
290
295// #define FLECS_USE_OS_ALLOC
296
299#ifndef FLECS_ID_DESC_MAX
300#define FLECS_ID_DESC_MAX (32)
301#endif
302
305#ifndef FLECS_EVENT_DESC_MAX
306#define FLECS_EVENT_DESC_MAX (8)
307#endif
308
311#define FLECS_VARIABLE_COUNT_MAX (64)
312
315#ifndef FLECS_TERM_COUNT_MAX
316#define FLECS_TERM_COUNT_MAX 32
317#endif
318
321#ifndef FLECS_TERM_ARG_COUNT_MAX
322#define FLECS_TERM_ARG_COUNT_MAX (16)
323#endif
324
327#ifndef FLECS_QUERY_VARIABLE_COUNT_MAX
328#define FLECS_QUERY_VARIABLE_COUNT_MAX (64)
329#endif
330
333#ifndef FLECS_QUERY_SCOPE_NESTING_MAX
334#define FLECS_QUERY_SCOPE_NESTING_MAX (8)
335#endif
336
341#ifndef FLECS_DAG_DEPTH_MAX
342#define FLECS_DAG_DEPTH_MAX (128)
343#endif
344
346
347#include "flecs/private/api_defines.h"
348
355
358 typedef uint64_t ecs_id_t;
359
365 typedef ecs_id_t ecs_entity_t;
366
382 typedef struct {
383 ecs_id_t *array;
384 int32_t count;
385} ecs_type_t;
386
409 typedef struct ecs_world_t ecs_world_t;
410
412 typedef struct ecs_stage_t ecs_stage_t;
413
415 typedef struct ecs_table_t ecs_table_t;
416
418 typedef struct ecs_term_t ecs_term_t;
419
421 typedef struct ecs_query_t ecs_query_t;
422
440 typedef struct ecs_observer_t ecs_observer_t;
441
445 typedef struct ecs_observable_t ecs_observable_t;
446
451 typedef struct ecs_iter_t ecs_iter_t;
452
461 typedef struct ecs_ref_t ecs_ref_t;
462
466 typedef struct ecs_type_hooks_t ecs_type_hooks_t;
467
471 typedef struct ecs_type_info_t ecs_type_info_t;
472
474 typedef struct ecs_record_t ecs_record_t;
475
477 typedef struct ecs_component_record_t ecs_component_record_t;
478
498 typedef void ecs_poly_t;
499
501 typedef struct ecs_mixins_t ecs_mixins_t;
502
504 typedef struct ecs_header_t {
505 int32_t type;
506 int32_t refcount;
507 ecs_mixins_t *mixins;
508} ecs_header_t;
509
510typedef struct ecs_table_record_t ecs_table_record_t;
511
513
514#include "flecs/datastructures/vec.h" /* Vector datatype */
515#include "flecs/datastructures/sparse.h" /* Sparse set */
516#include "flecs/datastructures/block_allocator.h" /* Block allocator */
517#include "flecs/datastructures/stack_allocator.h" /* Stack allocator */
518#include "flecs/datastructures/map.h" /* Map */
519#include "flecs/datastructures/allocator.h" /* Allocator */
520#include "flecs/datastructures/strbuf.h" /* String builder */
521#include "flecs/os_api.h" /* Abstraction for operating system functions */
522
523#ifdef __cplusplus
524extern "C" {
525#endif
526
533
534
541
551 typedef void (*ecs_run_action_t)(
552 ecs_iter_t *it);
553
560 typedef void (*ecs_iter_action_t)(
561 ecs_iter_t *it);
562
570 typedef bool (*ecs_iter_next_action_t)(
571 ecs_iter_t *it);
572
578 typedef void (*ecs_iter_fini_action_t)(
579 ecs_iter_t *it);
580
582 typedef int (*ecs_order_by_action_t)(
583 ecs_entity_t e1,
584 const void *ptr1,
585 ecs_entity_t e2,
586 const void *ptr2);
587
589 typedef void (*ecs_sort_table_action_t)(
590 ecs_world_t* world,
591 ecs_table_t* table,
592 ecs_entity_t* entities,
593 void* ptr,
594 int32_t size,
595 int32_t lo,
596 int32_t hi,
597 ecs_order_by_action_t order_by);
598
600 typedef uint64_t (*ecs_group_by_action_t)(
601 ecs_world_t *world,
602 ecs_table_t *table,
603 ecs_id_t group_id,
604 void *ctx);
605
607 typedef void* (*ecs_group_create_action_t)(
608 ecs_world_t *world,
609 uint64_t group_id,
610 void *group_by_ctx); /* from ecs_query_desc_t */
611
613 typedef void (*ecs_group_delete_action_t)(
614 ecs_world_t *world,
615 uint64_t group_id,
616 void *group_ctx, /* return value from ecs_group_create_action_t */
617 void *group_by_ctx); /* from ecs_query_desc_t */
618
620 typedef void (*ecs_module_action_t)(
621 ecs_world_t *world);
622
624 typedef void (*ecs_fini_action_t)(
625 ecs_world_t *world,
626 void *ctx);
627
629 typedef void (*ecs_ctx_free_t)(
630 void *ctx);
631
633 typedef int (*ecs_compare_action_t)(
634 const void *ptr1,
635 const void *ptr2);
636
638 typedef uint64_t (*ecs_hash_value_action_t)(
639 const void *ptr);
640
642 typedef void (*ecs_xtor_t)(
643 void *ptr,
644 int32_t count,
645 const ecs_type_info_t *type_info);
646
648 typedef void (*ecs_copy_t)(
649 void *dst_ptr,
650 const void *src_ptr,
651 int32_t count,
652 const ecs_type_info_t *type_info);
653
655 typedef void (*ecs_move_t)(
656 void *dst_ptr,
657 void *src_ptr,
658 int32_t count,
659 const ecs_type_info_t *type_info);
660
662 typedef int (*ecs_cmp_t)(
663 const void *a_ptr,
664 const void *b_ptr,
665 const ecs_type_info_t *type_info);
666
668 typedef bool (*ecs_equals_t)(
669 const void *a_ptr,
670 const void *b_ptr,
671 const ecs_type_info_t *type_info);
672
674 typedef void (*flecs_poly_dtor_t)(
675 ecs_poly_t *poly);
676
678
685
687 typedef enum ecs_inout_kind_t {
688 EcsInOutDefault,
689 EcsInOutNone,
690 EcsInOutFilter,
691 EcsInOut,
692 EcsIn,
693 EcsOut,
694} ecs_inout_kind_t;
695
697 typedef enum ecs_oper_kind_t {
698 EcsAnd,
699 EcsOr,
700 EcsNot,
701 EcsOptional,
702 EcsAndFrom,
703 EcsOrFrom,
704 EcsNotFrom,
705} ecs_oper_kind_t;
706
708 typedef enum ecs_query_cache_kind_t {
709 EcsQueryCacheDefault,
710 EcsQueryCacheAuto,
711 EcsQueryCacheAll,
712 EcsQueryCacheNone,
713} ecs_query_cache_kind_t;
714
715/* Term id flags */
716
721#define EcsSelf (1llu << 63)
722
727#define EcsUp (1llu << 62)
728
733#define EcsTrav (1llu << 61)
734
739#define EcsCascade (1llu << 60)
740
745#define EcsDesc (1llu << 59)
746
751#define EcsIsVariable (1llu << 58)
752
757#define EcsIsEntity (1llu << 57)
758
763#define EcsIsName (1llu << 56)
764
769#define EcsTraverseFlags (EcsSelf|EcsUp|EcsTrav|EcsCascade|EcsDesc)
770
775#define EcsTermRefFlags (EcsTraverseFlags|EcsIsVariable|EcsIsEntity|EcsIsName)
776
778 typedef struct ecs_term_ref_t {
779 ecs_entity_t id;
784
785 const char *name;
790} ecs_term_ref_t;
791
793 struct ecs_term_t {
794 ecs_id_t id;
798
799 ecs_term_ref_t src;
800 ecs_term_ref_t first;
801 ecs_term_ref_t second;
802
803 ecs_entity_t trav;
806
807 int16_t inout;
808 int16_t oper;
809
810 int8_t field_index;
811 ecs_flags16_t flags_;
812};
813
817 struct ecs_query_t {
818 ecs_header_t hdr;
819
820 ecs_term_t *terms;
821 int32_t *sizes;
822 ecs_id_t *ids;
823
824 uint64_t bloom_filter;
825 ecs_flags32_t flags;
826 int8_t var_count;
827 int8_t term_count;
828 int8_t field_count;
829
830 /* Bitmasks for quick field information lookups */
831 ecs_termset_t fixed_fields;
832 ecs_termset_t var_fields;
833 ecs_termset_t static_id_fields;
834 ecs_termset_t data_fields;
835 ecs_termset_t write_fields;
836 ecs_termset_t read_fields;
837 ecs_termset_t row_fields;
838 ecs_termset_t shared_readonly_fields;
839 ecs_termset_t set_fields;
840
841 ecs_query_cache_kind_t cache_kind;
842
843 char **vars;
844
845 void *ctx;
846 void *binding_ctx;
847
848 ecs_entity_t entity;
849 ecs_world_t *real_world;
850 ecs_world_t *world;
851
852 int32_t eval_count;
853};
854
858 struct ecs_observer_t {
859 ecs_header_t hdr;
860
861 ecs_query_t *query;
862
864 ecs_entity_t events[FLECS_EVENT_DESC_MAX];
865 int32_t event_count;
866
867 ecs_iter_action_t callback;
868 ecs_run_action_t run;
869
870 void *ctx;
871 void *callback_ctx;
872 void *run_ctx;
873
874 ecs_ctx_free_t ctx_free;
875 ecs_ctx_free_t callback_ctx_free;
876 ecs_ctx_free_t run_ctx_free;
877
878 ecs_observable_t *observable;
879
880 ecs_world_t *world;
881 ecs_entity_t entity;
882};
883
885
890
891/* Flags that can be used to check which hooks a type has set */
892#define ECS_TYPE_HOOK_CTOR ECS_CAST(ecs_flags32_t, 1 << 0)
893#define ECS_TYPE_HOOK_DTOR ECS_CAST(ecs_flags32_t, 1 << 1)
894#define ECS_TYPE_HOOK_COPY ECS_CAST(ecs_flags32_t, 1 << 2)
895#define ECS_TYPE_HOOK_MOVE ECS_CAST(ecs_flags32_t, 1 << 3)
896#define ECS_TYPE_HOOK_COPY_CTOR ECS_CAST(ecs_flags32_t, 1 << 4)
897#define ECS_TYPE_HOOK_MOVE_CTOR ECS_CAST(ecs_flags32_t, 1 << 5)
898#define ECS_TYPE_HOOK_CTOR_MOVE_DTOR ECS_CAST(ecs_flags32_t, 1 << 6)
899#define ECS_TYPE_HOOK_MOVE_DTOR ECS_CAST(ecs_flags32_t, 1 << 7)
900#define ECS_TYPE_HOOK_CMP ECS_CAST(ecs_flags32_t, 1 << 8)
901#define ECS_TYPE_HOOK_EQUALS ECS_CAST(ecs_flags32_t, 1 << 9)
902
903
904/* Flags that can be used to set/check which hooks of a type are invalid */
905#define ECS_TYPE_HOOK_CTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 10)
906#define ECS_TYPE_HOOK_DTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 12)
907#define ECS_TYPE_HOOK_COPY_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 13)
908#define ECS_TYPE_HOOK_MOVE_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 14)
909#define ECS_TYPE_HOOK_COPY_CTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 15)
910#define ECS_TYPE_HOOK_MOVE_CTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 16)
911#define ECS_TYPE_HOOK_CTOR_MOVE_DTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 17)
912#define ECS_TYPE_HOOK_MOVE_DTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 18)
913#define ECS_TYPE_HOOK_CMP_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 19)
914#define ECS_TYPE_HOOK_EQUALS_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 20)
915
916
917/* All valid hook flags */
918#define ECS_TYPE_HOOKS (ECS_TYPE_HOOK_CTOR|ECS_TYPE_HOOK_DTOR|\
919 ECS_TYPE_HOOK_COPY|ECS_TYPE_HOOK_MOVE|ECS_TYPE_HOOK_COPY_CTOR|\
920 ECS_TYPE_HOOK_MOVE_CTOR|ECS_TYPE_HOOK_CTOR_MOVE_DTOR|\
921 ECS_TYPE_HOOK_MOVE_DTOR|ECS_TYPE_HOOK_CMP|ECS_TYPE_HOOK_EQUALS)
922
923/* All invalid hook flags */
924#define ECS_TYPE_HOOKS_ILLEGAL (ECS_TYPE_HOOK_CTOR_ILLEGAL|\
925 ECS_TYPE_HOOK_DTOR_ILLEGAL|ECS_TYPE_HOOK_COPY_ILLEGAL|\
926 ECS_TYPE_HOOK_MOVE_ILLEGAL|ECS_TYPE_HOOK_COPY_CTOR_ILLEGAL|\
927 ECS_TYPE_HOOK_MOVE_CTOR_ILLEGAL|ECS_TYPE_HOOK_CTOR_MOVE_DTOR_ILLEGAL|\
928 ECS_TYPE_HOOK_MOVE_DTOR_ILLEGAL|ECS_TYPE_HOOK_CMP_ILLEGAL|\
929 ECS_TYPE_HOOK_EQUALS_ILLEGAL)
930 struct ecs_type_hooks_t {
931 ecs_xtor_t ctor;
932 ecs_xtor_t dtor;
933 ecs_copy_t copy;
934 ecs_move_t move;
935
937 ecs_copy_t copy_ctor;
938
940 ecs_move_t move_ctor;
941
946 ecs_move_t ctor_move_dtor;
947
952 ecs_move_t move_dtor;
953
955 ecs_cmp_t cmp;
956
958 ecs_equals_t equals;
959
964 ecs_flags32_t flags;
965
966
969 ecs_iter_action_t on_add;
970
974 ecs_iter_action_t on_set;
975
979 ecs_iter_action_t on_remove;
980
985 ecs_iter_action_t on_replace;
986
987 void *ctx;
988 void *binding_ctx;
989 void *lifecycle_ctx;
990
991 ecs_ctx_free_t ctx_free;
992 ecs_ctx_free_t binding_ctx_free;
993 ecs_ctx_free_t lifecycle_ctx_free;
994};
995
1000 struct ecs_type_info_t {
1001 ecs_size_t size;
1002 ecs_size_t alignment;
1003 ecs_type_hooks_t hooks;
1004 ecs_entity_t component;
1005 const char *name;
1006};
1007
1008#include "flecs/private/api_types.h" /* Supporting API types */
1009#include "flecs/private/api_support.h" /* Supporting API functions */
1010#include "flecs/datastructures/hashmap.h" /* Hashmap */
1011#include "flecs/private/api_internals.h" /* Supporting API functions */
1012
1014 typedef struct ecs_value_t {
1015 ecs_entity_t type;
1016 void *ptr;
1017} ecs_value_t;
1018
1023 typedef struct ecs_entity_desc_t {
1024 int32_t _canary;
1025
1026 ecs_entity_t id;
1027
1028 ecs_entity_t parent;
1029
1030 const char *name;
1034
1035 const char *sep;
1038
1039 const char *root_sep;
1040
1041 const char *symbol;
1050
1051 bool use_low_id;
1054
1056 const ecs_id_t *add;
1057
1059 const ecs_value_t *set;
1060
1062 const char *add_expr;
1063} ecs_entity_desc_t;
1064
1069 typedef struct ecs_bulk_desc_t {
1070 int32_t _canary;
1071
1072 ecs_entity_t *entities;
1076
1077 int32_t count;
1078
1079 ecs_id_t ids[FLECS_ID_DESC_MAX];
1080
1081 void **data;
1087
1088 ecs_table_t *table;
1092
1093} ecs_bulk_desc_t;
1094
1099 typedef struct ecs_component_desc_t {
1100 int32_t _canary;
1101
1103 ecs_entity_t entity;
1104
1106 ecs_type_info_t type;
1107} ecs_component_desc_t;
1108
1147 struct ecs_iter_t {
1148 /* World */
1149 ecs_world_t *world;
1150 ecs_world_t *real_world;
1151
1152 /* Matched data */
1153 int32_t offset;
1154 int32_t count;
1155 const ecs_entity_t *entities;
1156 void **ptrs;
1157 const ecs_table_record_t **trs;
1158 const ecs_size_t *sizes;
1159 ecs_table_t *table;
1160 ecs_table_t *other_table;
1161 ecs_id_t *ids;
1162 ecs_entity_t *sources;
1163 ecs_flags64_t constrained_vars;
1164 ecs_termset_t set_fields;
1165 ecs_termset_t ref_fields;
1166 ecs_termset_t row_fields;
1167 ecs_termset_t up_fields;
1168
1169 /* Input information */
1170 ecs_entity_t system;
1171 ecs_entity_t event;
1172 ecs_id_t event_id;
1173 int32_t event_cur;
1174
1175 /* Query information */
1176 int8_t field_count;
1177 int8_t term_index;
1180 const ecs_query_t *query;
1181
1182 /* Context */
1183 void *param;
1184 void *ctx;
1185 void *binding_ctx;
1186 void *callback_ctx;
1187 void *run_ctx;
1188
1189 /* Time */
1190 ecs_ftime_t delta_time;
1191 ecs_ftime_t delta_system_time;
1192
1193 /* Iterator counters */
1194 int32_t frame_offset;
1195
1196 /* Misc */
1197 ecs_flags32_t flags;
1198 ecs_entity_t interrupted_by;
1199 ecs_iter_private_t priv_;
1200
1201 /* Chained iterators */
1202 ecs_iter_next_action_t next;
1203 ecs_iter_action_t callback;
1204 ecs_iter_fini_action_t fini;
1205 ecs_iter_t *chain_it;
1206};
1207
1208
1213#define EcsQueryMatchPrefab (1u << 1u)
1214
1219#define EcsQueryMatchDisabled (1u << 2u)
1220
1225#define EcsQueryMatchEmptyTables (1u << 3u)
1226
1231#define EcsQueryAllowUnresolvedByName (1u << 6u)
1232
1237#define EcsQueryTableOnly (1u << 7u)
1238
1249#define EcsQueryDetectChanges (1u << 8u)
1250
1251
1256 typedef struct ecs_query_desc_t {
1258 int32_t _canary;
1259
1261 ecs_term_t terms[FLECS_TERM_COUNT_MAX];
1262
1264 const char *expr;
1265
1267 ecs_query_cache_kind_t cache_kind;
1268
1270 ecs_flags32_t flags;
1271
1275 ecs_order_by_action_t order_by_callback;
1276
1279 ecs_sort_table_action_t order_by_table_callback;
1280
1283 ecs_entity_t order_by;
1284
1287 ecs_id_t group_by;
1288
1294 ecs_group_by_action_t group_by_callback;
1295
1298 ecs_group_create_action_t on_group_create;
1299
1302 ecs_group_delete_action_t on_group_delete;
1303
1305 void *group_by_ctx;
1306
1308 ecs_ctx_free_t group_by_ctx_free;
1309
1311 void *ctx;
1312
1314 void *binding_ctx;
1315
1317 ecs_ctx_free_t ctx_free;
1318
1320 ecs_ctx_free_t binding_ctx_free;
1321
1323 ecs_entity_t entity;
1324} ecs_query_desc_t;
1325
1330 typedef struct ecs_observer_desc_t {
1332 int32_t _canary;
1333
1335 ecs_entity_t entity;
1336
1338 ecs_query_desc_t query;
1339
1341 ecs_entity_t events[FLECS_EVENT_DESC_MAX];
1342
1345 bool yield_existing;
1346
1348 ecs_iter_action_t callback;
1349
1356 ecs_run_action_t run;
1357
1359 void *ctx;
1360
1362 ecs_ctx_free_t ctx_free;
1363
1365 void *callback_ctx;
1366
1368 ecs_ctx_free_t callback_ctx_free;
1369
1371 void *run_ctx;
1372
1374 ecs_ctx_free_t run_ctx_free;
1375
1377 ecs_poly_t *observable;
1378
1381 int32_t *last_event_id;
1382
1384 int8_t term_index_;
1385 ecs_flags32_t flags_;
1386} ecs_observer_desc_t;
1387
1392 typedef struct ecs_event_desc_t {
1394 ecs_entity_t event;
1395
1399 const ecs_type_t *ids;
1400
1402 ecs_table_t *table;
1403
1406 ecs_table_t *other_table;
1407
1409 int32_t offset;
1410
1414 int32_t count;
1415
1417 ecs_entity_t entity;
1418
1423 void *param;
1424
1428 const void *const_param;
1429
1431 ecs_poly_t *observable;
1432
1434 ecs_flags32_t flags;
1435} ecs_event_desc_t;
1436
1437
1444
1446 typedef struct ecs_build_info_t {
1447 const char *compiler;
1448 const char **addons;
1449 const char *version;
1450 int16_t version_major;
1451 int16_t version_minor;
1452 int16_t version_patch;
1453 bool debug;
1454 bool sanitize;
1455 bool perf_trace;
1456} ecs_build_info_t;
1457
1459 typedef struct ecs_world_info_t {
1460 ecs_entity_t last_component_id;
1461 ecs_entity_t min_id;
1462 ecs_entity_t max_id;
1463
1464 ecs_ftime_t delta_time_raw;
1465 ecs_ftime_t delta_time;
1466 ecs_ftime_t time_scale;
1467 ecs_ftime_t target_fps;
1468 ecs_ftime_t frame_time_total;
1469 ecs_ftime_t system_time_total;
1470 ecs_ftime_t emit_time_total;
1471 ecs_ftime_t merge_time_total;
1472 ecs_ftime_t rematch_time_total;
1473 double world_time_total;
1474 double world_time_total_raw;
1475
1476 int64_t frame_count_total;
1477 int64_t merge_count_total;
1478 int64_t eval_comp_monitors_total;
1479 int64_t rematch_count_total;
1480
1481 int64_t id_create_total;
1482 int64_t id_delete_total;
1483 int64_t table_create_total;
1484 int64_t table_delete_total;
1485 int64_t pipeline_build_count_total;
1486 int64_t systems_ran_frame;
1487 int64_t observers_ran_frame;
1488
1489 int32_t tag_id_count;
1490 int32_t component_id_count;
1491 int32_t pair_id_count;
1492
1493 int32_t table_count;
1494
1495 /* -- Command counts -- */
1496 struct {
1497 int64_t add_count;
1498 int64_t remove_count;
1499 int64_t delete_count;
1500 int64_t clear_count;
1501 int64_t set_count;
1502 int64_t ensure_count;
1503 int64_t modified_count;
1504 int64_t discard_count;
1505 int64_t event_count;
1506 int64_t other_count;
1507 int64_t batched_entity_count;
1508 int64_t batched_command_count;
1509 } cmd;
1510
1511 const char *name_prefix;
1515} ecs_world_info_t;
1516
1518 typedef struct ecs_query_group_info_t {
1519 uint64_t id;
1520 int32_t match_count;
1521 int32_t table_count;
1522 void *ctx;
1523} ecs_query_group_info_t;
1524
1526
1533
1535 typedef struct EcsIdentifier {
1536 char *value;
1537 ecs_size_t length;
1538 uint64_t hash;
1539 uint64_t index_hash;
1540 ecs_hashmap_t *index;
1541} EcsIdentifier;
1542
1544 typedef struct EcsComponent {
1545 ecs_size_t size;
1546 ecs_size_t alignment;
1547} EcsComponent;
1548
1550 typedef struct EcsPoly {
1551 ecs_poly_t *poly;
1552} EcsPoly;
1553
1559 typedef struct EcsDefaultChildComponent {
1560 ecs_id_t component;
1561} EcsDefaultChildComponent;
1562
1565
1566/* Only include deprecated definitions if deprecated addon is required */
1567#ifdef FLECS_DEPRECATED
1568#include "flecs/addons/deprecated.h"
1569#endif
1570
1577
1584
1586FLECS_API extern const ecs_id_t ECS_PAIR;
1587
1589FLECS_API extern const ecs_id_t ECS_AUTO_OVERRIDE;
1590
1592FLECS_API extern const ecs_id_t ECS_TOGGLE;
1593
1595
1600
1601/* Builtin component ids */
1602
1604FLECS_API extern const ecs_entity_t ecs_id(EcsComponent);
1605
1607FLECS_API extern const ecs_entity_t ecs_id(EcsIdentifier);
1608
1610FLECS_API extern const ecs_entity_t ecs_id(EcsPoly);
1611
1613FLECS_API extern const ecs_entity_t ecs_id(EcsDefaultChildComponent);
1614
1616FLECS_API extern const ecs_entity_t EcsQuery;
1617
1619FLECS_API extern const ecs_entity_t EcsObserver;
1620
1622FLECS_API extern const ecs_entity_t EcsSystem;
1623
1625FLECS_API extern const ecs_entity_t ecs_id(EcsTickSource);
1626
1628FLECS_API extern const ecs_entity_t ecs_id(EcsPipelineQuery);
1629
1631FLECS_API extern const ecs_entity_t ecs_id(EcsTimer);
1632
1634FLECS_API extern const ecs_entity_t ecs_id(EcsRateFilter);
1635
1637FLECS_API extern const ecs_entity_t EcsFlecs;
1638
1640FLECS_API extern const ecs_entity_t EcsFlecsCore;
1641
1643FLECS_API extern const ecs_entity_t EcsWorld;
1644
1646FLECS_API extern const ecs_entity_t EcsWildcard;
1647
1649FLECS_API extern const ecs_entity_t EcsAny;
1650
1652FLECS_API extern const ecs_entity_t EcsThis;
1653
1655FLECS_API extern const ecs_entity_t EcsVariable;
1656
1664FLECS_API extern const ecs_entity_t EcsTransitive;
1665
1673FLECS_API extern const ecs_entity_t EcsReflexive;
1674
1685FLECS_API extern const ecs_entity_t EcsFinal;
1686
1692FLECS_API extern const ecs_entity_t EcsInheritable;
1693
1695FLECS_API extern const ecs_entity_t EcsOnInstantiate;
1696
1700FLECS_API extern const ecs_entity_t EcsOverride;
1701
1705FLECS_API extern const ecs_entity_t EcsInherit;
1706
1711FLECS_API extern const ecs_entity_t EcsDontInherit;
1712
1720FLECS_API extern const ecs_entity_t EcsSymmetric;
1721
1731FLECS_API extern const ecs_entity_t EcsExclusive;
1732
1734FLECS_API extern const ecs_entity_t EcsAcyclic;
1735
1738FLECS_API extern const ecs_entity_t EcsTraversable;
1739
1749FLECS_API extern const ecs_entity_t EcsWith;
1750
1760FLECS_API extern const ecs_entity_t EcsOneOf;
1761
1763FLECS_API extern const ecs_entity_t EcsCanToggle;
1764
1768FLECS_API extern const ecs_entity_t EcsTrait;
1769
1779FLECS_API extern const ecs_entity_t EcsRelationship;
1780
1790FLECS_API extern const ecs_entity_t EcsTarget;
1791
1794FLECS_API extern const ecs_entity_t EcsPairIsTag;
1795
1797FLECS_API extern const ecs_entity_t EcsName;
1798
1800FLECS_API extern const ecs_entity_t EcsSymbol;
1801
1803FLECS_API extern const ecs_entity_t EcsAlias;
1804
1806FLECS_API extern const ecs_entity_t EcsChildOf;
1807
1809FLECS_API extern const ecs_entity_t EcsIsA;
1810
1812FLECS_API extern const ecs_entity_t EcsDependsOn;
1813
1815FLECS_API extern const ecs_entity_t EcsSlotOf;
1816
1818FLECS_API extern const ecs_entity_t EcsOrderedChildren;
1819
1821FLECS_API extern const ecs_entity_t EcsModule;
1822
1824FLECS_API extern const ecs_entity_t EcsPrivate;
1825
1828FLECS_API extern const ecs_entity_t EcsPrefab;
1829
1832FLECS_API extern const ecs_entity_t EcsDisabled;
1833
1837FLECS_API extern const ecs_entity_t EcsNotQueryable;
1838
1840FLECS_API extern const ecs_entity_t EcsOnAdd;
1841
1843FLECS_API extern const ecs_entity_t EcsOnRemove;
1844
1846FLECS_API extern const ecs_entity_t EcsOnSet;
1847
1849FLECS_API extern const ecs_entity_t EcsMonitor;
1850
1852FLECS_API extern const ecs_entity_t EcsOnTableCreate;
1853
1855FLECS_API extern const ecs_entity_t EcsOnTableDelete;
1856
1858FLECS_API extern const ecs_entity_t EcsOnDelete;
1859
1862FLECS_API extern const ecs_entity_t EcsOnDeleteTarget;
1863
1866FLECS_API extern const ecs_entity_t EcsRemove;
1867
1870FLECS_API extern const ecs_entity_t EcsDelete;
1871
1874FLECS_API extern const ecs_entity_t EcsPanic;
1875
1878FLECS_API extern const ecs_entity_t EcsSingleton;
1879
1881FLECS_API extern const ecs_entity_t EcsSparse;
1882
1884FLECS_API extern const ecs_entity_t EcsDontFragment;
1885
1887FLECS_API extern const ecs_entity_t EcsPredEq;
1888
1890FLECS_API extern const ecs_entity_t EcsPredMatch;
1891
1893FLECS_API extern const ecs_entity_t EcsPredLookup;
1894
1896FLECS_API extern const ecs_entity_t EcsScopeOpen;
1897
1899FLECS_API extern const ecs_entity_t EcsScopeClose;
1900
1905FLECS_API extern const ecs_entity_t EcsEmpty;
1906
1907FLECS_API extern const ecs_entity_t ecs_id(EcsPipeline);
1908FLECS_API extern const ecs_entity_t EcsOnStart;
1909FLECS_API extern const ecs_entity_t EcsPreFrame;
1910FLECS_API extern const ecs_entity_t EcsOnLoad;
1911FLECS_API extern const ecs_entity_t EcsPostLoad;
1912FLECS_API extern const ecs_entity_t EcsPreUpdate;
1913FLECS_API extern const ecs_entity_t EcsOnUpdate;
1914FLECS_API extern const ecs_entity_t EcsOnValidate;
1915FLECS_API extern const ecs_entity_t EcsPostUpdate;
1916FLECS_API extern const ecs_entity_t EcsPreStore;
1917FLECS_API extern const ecs_entity_t EcsOnStore;
1918FLECS_API extern const ecs_entity_t EcsPostFrame;
1919FLECS_API extern const ecs_entity_t EcsPhase;
1920
1921FLECS_API extern const ecs_entity_t EcsConstant;
1922
1925#define EcsLastInternalComponentId (ecs_id(EcsPoly))
1926
1929#define EcsFirstUserComponentId (8)
1930
1933#define EcsFirstUserEntityId (FLECS_HI_COMPONENT_ID + 128)
1934
1935/* When visualized the reserved id ranges look like this:
1936 * - [1..8]: Builtin components
1937 * - [9..FLECS_HI_COMPONENT_ID]: Low ids reserved for application components
1938 * - [FLECS_HI_COMPONENT_ID + 1..EcsFirstUserEntityId]: Builtin entities
1939 */
1940
1943
1950
1955
1962FLECS_API
1963 ecs_world_t* ecs_init(void);
1964
1971FLECS_API
1972 ecs_world_t* ecs_mini(void);
1973
1981FLECS_API
1982 ecs_world_t* ecs_init_w_args(
1983 int argc,
1984 char *argv[]);
1985
1992FLECS_API
1993 int ecs_fini(
1994 ecs_world_t *world);
1995
2003FLECS_API
2004 bool ecs_is_fini(
2005 const ecs_world_t *world);
2006
2014FLECS_API
2015 void ecs_atfini(
2016 ecs_world_t *world,
2017 ecs_fini_action_t action,
2018 void *ctx);
2019
2021 typedef struct ecs_entities_t {
2022 const ecs_entity_t *ids;
2023 int32_t count;
2024 int32_t alive_count;
2025} ecs_entities_t;
2026
2053FLECS_API
2054 ecs_entities_t ecs_get_entities(
2055 const ecs_world_t *world);
2056
2064FLECS_API
2065ecs_flags32_t ecs_world_get_flags(
2066 const ecs_world_t *world);
2067
2069
2074
2093FLECS_API
2094 ecs_ftime_t ecs_frame_begin(
2095 ecs_world_t *world,
2096 ecs_ftime_t delta_time);
2097
2104FLECS_API
2105 void ecs_frame_end(
2106 ecs_world_t *world);
2107
2115FLECS_API
2116 void ecs_run_post_frame(
2117 ecs_world_t *world,
2118 ecs_fini_action_t action,
2119 void *ctx);
2120
2127FLECS_API
2128 void ecs_quit(
2129 ecs_world_t *world);
2130
2137FLECS_API
2138 bool ecs_should_quit(
2139 const ecs_world_t *world);
2140
2152FLECS_API void ecs_measure_frame_time(
2153 ecs_world_t *world,
2154 bool enable);
2155
2166FLECS_API void ecs_measure_system_time(
2167 ecs_world_t *world,
2168 bool enable);
2169
2185FLECS_API
2186 void ecs_set_target_fps(
2187 ecs_world_t *world,
2188 ecs_ftime_t fps);
2189
2203FLECS_API
2204 void ecs_set_default_query_flags(
2205 ecs_world_t *world,
2206 ecs_flags32_t flags);
2207
2209
2214
2284FLECS_API
2285 bool ecs_readonly_begin(
2286 ecs_world_t *world,
2287 bool multi_threaded);
2288
2296FLECS_API
2297 void ecs_readonly_end(
2298 ecs_world_t *world);
2299
2310FLECS_API
2311 void ecs_merge(
2312 ecs_world_t *world);
2313
2329FLECS_API
2330 bool ecs_defer_begin(
2331 ecs_world_t *world);
2332
2343FLECS_API
2344 bool ecs_is_deferred(
2345 const ecs_world_t *world);
2346
2360FLECS_API
2361 bool ecs_defer_end(
2362 ecs_world_t *world);
2363
2378FLECS_API
2379 void ecs_defer_suspend(
2380 ecs_world_t *world);
2381
2392FLECS_API
2393 void ecs_defer_resume(
2394 ecs_world_t *world);
2395
2409FLECS_API
2410 void ecs_set_stage_count(
2411 ecs_world_t *world,
2412 int32_t stages);
2413
2420FLECS_API
2421int32_t ecs_get_stage_count(
2422 const ecs_world_t *world);
2423
2439FLECS_API
2440 ecs_world_t* ecs_get_stage(
2441 const ecs_world_t *world,
2442 int32_t stage_id);
2443
2451FLECS_API
2452 bool ecs_stage_is_readonly(
2453 const ecs_world_t *world);
2454
2462FLECS_API
2463 ecs_world_t* ecs_stage_new(
2464 ecs_world_t *world);
2465
2470FLECS_API
2471 void ecs_stage_free(
2472 ecs_world_t *stage);
2473
2481FLECS_API
2482int32_t ecs_stage_get_id(
2483 const ecs_world_t *world);
2484
2486
2491
2500FLECS_API
2501 void ecs_set_ctx(
2502 ecs_world_t *world,
2503 void *ctx,
2504 ecs_ctx_free_t ctx_free);
2505
2514FLECS_API
2515 void ecs_set_binding_ctx(
2516 ecs_world_t *world,
2517 void *ctx,
2518 ecs_ctx_free_t ctx_free);
2519
2527FLECS_API
2528 void* ecs_get_ctx(
2529 const ecs_world_t *world);
2530
2538FLECS_API
2539 void* ecs_get_binding_ctx(
2540 const ecs_world_t *world);
2541
2547FLECS_API
2548 const ecs_build_info_t* ecs_get_build_info(void);
2549
2555FLECS_API
2556 const ecs_world_info_t* ecs_get_world_info(
2557 const ecs_world_t *world);
2558
2567FLECS_API
2568 void ecs_dim(
2569 ecs_world_t *world,
2570 int32_t entity_count);
2571
2586FLECS_API
2587 void ecs_shrink(
2588 ecs_world_t *world);
2589
2605FLECS_API
2606 void ecs_set_entity_range(
2607 ecs_world_t *world,
2608 ecs_entity_t id_start,
2609 ecs_entity_t id_end);
2610
2621FLECS_API
2622 bool ecs_enable_range_check(
2623 ecs_world_t *world,
2624 bool enable);
2625
2631FLECS_API
2632 ecs_entity_t ecs_get_max_id(
2633 const ecs_world_t *world);
2634
2648FLECS_API
2649 void ecs_run_aperiodic(
2650 ecs_world_t *world,
2651 ecs_flags32_t flags);
2652
2654 typedef struct ecs_delete_empty_tables_desc_t {
2656 uint16_t clear_generation;
2657
2659 uint16_t delete_generation;
2660
2662 double time_budget_seconds;
2663} ecs_delete_empty_tables_desc_t;
2664
2694FLECS_API
2695int32_t ecs_delete_empty_tables(
2696 ecs_world_t *world,
2697 const ecs_delete_empty_tables_desc_t *desc);
2698
2704FLECS_API
2705 const ecs_world_t* ecs_get_world(
2706 const ecs_poly_t *poly);
2707
2713FLECS_API
2714 ecs_entity_t ecs_get_entity(
2715 const ecs_poly_t *poly);
2716
2730FLECS_API
2731 bool flecs_poly_is_(
2732 const ecs_poly_t *object,
2733 int32_t type);
2734
2738#define flecs_poly_is(object, type)\
2739 flecs_poly_is_(object, type##_magic)
2740
2749FLECS_API
2750 ecs_id_t ecs_make_pair(
2751 ecs_entity_t first,
2752 ecs_entity_t second);
2753
2776FLECS_API
2777 void ecs_exclusive_access_begin(
2778 ecs_world_t *world,
2779 const char *thread_name);
2780
2803FLECS_API
2804 void ecs_exclusive_access_end(
2805 ecs_world_t *world,
2806 bool lock_world);
2807
2809
2811
2818
2825
2834FLECS_API
2835 ecs_entity_t ecs_new(
2836 ecs_world_t *world);
2837
2855FLECS_API
2856 ecs_entity_t ecs_new_low_id(
2857 ecs_world_t *world);
2858
2867FLECS_API
2868 ecs_entity_t ecs_new_w_id(
2869 ecs_world_t *world,
2870 ecs_id_t component);
2871
2879FLECS_API
2880 ecs_entity_t ecs_new_w_table(
2881 ecs_world_t *world,
2882 ecs_table_t *table);
2883
2902FLECS_API
2903 ecs_entity_t ecs_entity_init(
2904 ecs_world_t *world,
2905 const ecs_entity_desc_t *desc);
2906
2933FLECS_API
2934 const ecs_entity_t* ecs_bulk_init(
2935 ecs_world_t *world,
2936 const ecs_bulk_desc_t *desc);
2937
2947FLECS_API
2948 const ecs_entity_t* ecs_bulk_new_w_id(
2949 ecs_world_t *world,
2950 ecs_id_t component,
2951 int32_t count);
2952
2968FLECS_API
2969 ecs_entity_t ecs_clone(
2970 ecs_world_t *world,
2971 ecs_entity_t dst,
2972 ecs_entity_t src,
2973 bool copy_value);
2974
2983FLECS_API
2984 void ecs_delete(
2985 ecs_world_t *world,
2986 ecs_entity_t entity);
2987
2995FLECS_API
2996 void ecs_delete_with(
2997 ecs_world_t *world,
2998 ecs_id_t component);
2999
3017FLECS_API
3018 void ecs_set_child_order(
3019 ecs_world_t *world,
3020 ecs_entity_t parent,
3021 const ecs_entity_t *children,
3022 int32_t child_count);
3023
3033FLECS_API
3034 ecs_entities_t ecs_get_ordered_children(
3035 const ecs_world_t *world,
3036 ecs_entity_t parent);
3037
3039
3046
3055FLECS_API
3056 void ecs_add_id(
3057 ecs_world_t *world,
3058 ecs_entity_t entity,
3059 ecs_id_t component);
3060
3069FLECS_API
3070 void ecs_remove_id(
3071 ecs_world_t *world,
3072 ecs_entity_t entity,
3073 ecs_id_t component);
3074
3126FLECS_API
3127 void ecs_auto_override_id(
3128 ecs_world_t *world,
3129 ecs_entity_t entity,
3130 ecs_id_t component);
3131
3138FLECS_API
3139 void ecs_clear(
3140 ecs_world_t *world,
3141 ecs_entity_t entity);
3142
3150FLECS_API
3151 void ecs_remove_all(
3152 ecs_world_t *world,
3153 ecs_id_t component);
3154
3169FLECS_API
3170 ecs_entity_t ecs_set_with(
3171 ecs_world_t *world,
3172 ecs_id_t component);
3173
3181FLECS_API
3182 ecs_id_t ecs_get_with(
3183 const ecs_world_t *world);
3184
3186
3193
3203FLECS_API
3204 void ecs_enable(
3205 ecs_world_t *world,
3206 ecs_entity_t entity,
3207 bool enabled);
3208
3222FLECS_API
3223 void ecs_enable_id(
3224 ecs_world_t *world,
3225 ecs_entity_t entity,
3226 ecs_id_t component,
3227 bool enable);
3228
3239FLECS_API
3240 bool ecs_is_enabled_id(
3241 const ecs_world_t *world,
3242 ecs_entity_t entity,
3243 ecs_id_t component);
3244
3246
3253
3268FLECS_API
3269FLECS_ALWAYS_INLINE const void* ecs_get_id(
3270 const ecs_world_t *world,
3271 ecs_entity_t entity,
3272 ecs_id_t component);
3273
3288FLECS_API
3289FLECS_ALWAYS_INLINE void* ecs_get_mut_id(
3290 const ecs_world_t *world,
3291 ecs_entity_t entity,
3292 ecs_id_t component);
3293
3310FLECS_API
3311 void* ecs_ensure_id(
3312 ecs_world_t *world,
3313 ecs_entity_t entity,
3314 ecs_id_t component,
3315 size_t size);
3316
3327FLECS_ALWAYS_INLINE FLECS_API
3328 ecs_ref_t ecs_ref_init_id(
3329 const ecs_world_t *world,
3330 ecs_entity_t entity,
3331 ecs_id_t component);
3332
3343FLECS_ALWAYS_INLINE FLECS_API
3344 void* ecs_ref_get_id(
3345 const ecs_world_t *world,
3346 ecs_ref_t *ref,
3347 ecs_id_t component);
3348
3356FLECS_ALWAYS_INLINE FLECS_API
3357 void ecs_ref_update(
3358 const ecs_world_t *world,
3359 ecs_ref_t *ref);
3360
3381FLECS_API
3382 void* ecs_emplace_id(
3383 ecs_world_t *world,
3384 ecs_entity_t entity,
3385 ecs_id_t component,
3386 size_t size,
3387 bool *is_new);
3388
3398FLECS_API
3399 void ecs_modified_id(
3400 ecs_world_t *world,
3401 ecs_entity_t entity,
3402 ecs_id_t component);
3403
3419FLECS_API
3420 void ecs_set_id(
3421 ecs_world_t *world,
3422 ecs_entity_t entity,
3423 ecs_id_t component,
3424 size_t size,
3425 const void *ptr);
3426
3428
3435
3455FLECS_API
3456 bool ecs_is_valid(
3457 const ecs_world_t *world,
3458 ecs_entity_t e);
3459
3489FLECS_API
3490 bool ecs_is_alive(
3491 const ecs_world_t *world,
3492 ecs_entity_t e);
3493
3499FLECS_API
3500 ecs_id_t ecs_strip_generation(
3501 ecs_entity_t e);
3502
3519FLECS_API
3520 ecs_entity_t ecs_get_alive(
3521 const ecs_world_t *world,
3522 ecs_entity_t e);
3523
3546FLECS_API
3547 void ecs_make_alive(
3548 ecs_world_t *world,
3549 ecs_entity_t entity);
3550
3569FLECS_API
3570 void ecs_make_alive_id(
3571 ecs_world_t *world,
3572 ecs_id_t component);
3573
3581FLECS_API
3582 bool ecs_exists(
3583 const ecs_world_t *world,
3584 ecs_entity_t entity);
3585
3600FLECS_API
3601 void ecs_set_version(
3602 ecs_world_t *world,
3603 ecs_entity_t entity);
3604
3606
3613
3620FLECS_API
3621 const ecs_type_t* ecs_get_type(
3622 const ecs_world_t *world,
3623 ecs_entity_t entity);
3624
3631FLECS_API
3632 ecs_table_t* ecs_get_table(
3633 const ecs_world_t *world,
3634 ecs_entity_t entity);
3635
3643FLECS_API
3644 char* ecs_type_str(
3645 const ecs_world_t *world,
3646 const ecs_type_t* type);
3647
3659FLECS_API
3660 char* ecs_table_str(
3661 const ecs_world_t *world,
3662 const ecs_table_t *table);
3663
3678FLECS_API
3679 char* ecs_entity_str(
3680 const ecs_world_t *world,
3681 ecs_entity_t entity);
3682
3693FLECS_API
3694FLECS_ALWAYS_INLINE bool ecs_has_id(
3695 const ecs_world_t *world,
3696 ecs_entity_t entity,
3697 ecs_id_t component);
3698
3709FLECS_API
3710FLECS_ALWAYS_INLINE bool ecs_owns_id(
3711 const ecs_world_t *world,
3712 ecs_entity_t entity,
3713 ecs_id_t component);
3714
3729FLECS_API
3730 ecs_entity_t ecs_get_target(
3731 const ecs_world_t *world,
3732 ecs_entity_t entity,
3733 ecs_entity_t rel,
3734 int32_t index);
3735
3749FLECS_API
3750 ecs_entity_t ecs_get_parent(
3751 const ecs_world_t *world,
3752 ecs_entity_t entity);
3753
3774FLECS_API
3775 ecs_entity_t ecs_get_target_for_id(
3776 const ecs_world_t *world,
3777 ecs_entity_t entity,
3778 ecs_entity_t rel,
3779 ecs_id_t component);
3780
3791FLECS_API
3792int32_t ecs_get_depth(
3793 const ecs_world_t *world,
3794 ecs_entity_t entity,
3795 ecs_entity_t rel);
3796
3804FLECS_API
3805int32_t ecs_count_id(
3806 const ecs_world_t *world,
3807 ecs_id_t entity);
3808
3810
3811
3818
3828FLECS_API
3829 const char* ecs_get_name(
3830 const ecs_world_t *world,
3831 ecs_entity_t entity);
3832
3842FLECS_API
3843 const char* ecs_get_symbol(
3844 const ecs_world_t *world,
3845 ecs_entity_t entity);
3846
3860FLECS_API
3861 ecs_entity_t ecs_set_name(
3862 ecs_world_t *world,
3863 ecs_entity_t entity,
3864 const char *name);
3865
3879FLECS_API
3880 ecs_entity_t ecs_set_symbol(
3881 ecs_world_t *world,
3882 ecs_entity_t entity,
3883 const char *symbol);
3884
3896FLECS_API
3897 void ecs_set_alias(
3898 ecs_world_t *world,
3899 ecs_entity_t entity,
3900 const char *alias);
3901
3917FLECS_API
3918 ecs_entity_t ecs_lookup(
3919 const ecs_world_t *world,
3920 const char *path);
3921
3936FLECS_API
3937 ecs_entity_t ecs_lookup_child(
3938 const ecs_world_t *world,
3939 ecs_entity_t parent,
3940 const char *name);
3941
3964FLECS_API
3965 ecs_entity_t ecs_lookup_path_w_sep(
3966 const ecs_world_t *world,
3967 ecs_entity_t parent,
3968 const char *path,
3969 const char *sep,
3970 const char *prefix,
3971 bool recursive);
3972
3990FLECS_API
3991 ecs_entity_t ecs_lookup_symbol(
3992 const ecs_world_t *world,
3993 const char *symbol,
3994 bool lookup_as_path,
3995 bool recursive);
3996
4018FLECS_API
4019 char* ecs_get_path_w_sep(
4020 const ecs_world_t *world,
4021 ecs_entity_t parent,
4022 ecs_entity_t child,
4023 const char *sep,
4024 const char *prefix);
4025
4038FLECS_API
4039 void ecs_get_path_w_sep_buf(
4040 const ecs_world_t *world,
4041 ecs_entity_t parent,
4042 ecs_entity_t child,
4043 const char *sep,
4044 const char *prefix,
4045 ecs_strbuf_t *buf,
4046 bool escape);
4047
4063FLECS_API
4064 ecs_entity_t ecs_new_from_path_w_sep(
4065 ecs_world_t *world,
4066 ecs_entity_t parent,
4067 const char *path,
4068 const char *sep,
4069 const char *prefix);
4070
4085FLECS_API
4086 ecs_entity_t ecs_add_path_w_sep(
4087 ecs_world_t *world,
4088 ecs_entity_t entity,
4089 ecs_entity_t parent,
4090 const char *path,
4091 const char *sep,
4092 const char *prefix);
4093
4107FLECS_API
4108 ecs_entity_t ecs_set_scope(
4109 ecs_world_t *world,
4110 ecs_entity_t scope);
4111
4119FLECS_API
4120 ecs_entity_t ecs_get_scope(
4121 const ecs_world_t *world);
4122
4132FLECS_API
4133 const char* ecs_set_name_prefix(
4134 ecs_world_t *world,
4135 const char *prefix);
4136
4163FLECS_API
4164 ecs_entity_t* ecs_set_lookup_path(
4165 ecs_world_t *world,
4166 const ecs_entity_t *lookup_path);
4167
4174FLECS_API
4175 ecs_entity_t* ecs_get_lookup_path(
4176 const ecs_world_t *world);
4177
4179
4181
4188
4202FLECS_API
4203 ecs_entity_t ecs_component_init(
4204 ecs_world_t *world,
4205 const ecs_component_desc_t *desc);
4206
4216FLECS_API
4217 const ecs_type_info_t* ecs_get_type_info(
4218 const ecs_world_t *world,
4219 ecs_id_t component);
4220
4232FLECS_API
4233 void ecs_set_hooks_id(
4234 ecs_world_t *world,
4235 ecs_entity_t component,
4236 const ecs_type_hooks_t *hooks);
4237
4244FLECS_API
4245 const ecs_type_hooks_t* ecs_get_hooks_id(
4246 const ecs_world_t *world,
4247 ecs_entity_t component);
4248
4250
4257
4272FLECS_API
4273 bool ecs_id_is_tag(
4274 const ecs_world_t *world,
4275 ecs_id_t component);
4276
4285FLECS_API
4286 bool ecs_id_in_use(
4287 const ecs_world_t *world,
4288 ecs_id_t component);
4289
4309FLECS_API
4310 ecs_entity_t ecs_get_typeid(
4311 const ecs_world_t *world,
4312 ecs_id_t component);
4313
4322FLECS_API
4323 bool ecs_id_match(
4324 ecs_id_t component,
4325 ecs_id_t pattern);
4326
4332FLECS_API
4333 bool ecs_id_is_pair(
4334 ecs_id_t component);
4335
4341FLECS_API
4342 bool ecs_id_is_wildcard(
4343 ecs_id_t component);
4344
4350 bool ecs_id_is_any(
4351 ecs_id_t component);
4352
4366FLECS_API
4367 bool ecs_id_is_valid(
4368 const ecs_world_t *world,
4369 ecs_id_t component);
4370
4379FLECS_API
4380ecs_flags32_t ecs_id_get_flags(
4381 const ecs_world_t *world,
4382 ecs_id_t component);
4383
4394FLECS_API
4395 const char* ecs_id_flag_str(
4396 ecs_id_t component_flags);
4397
4413FLECS_API
4414 char* ecs_id_str(
4415 const ecs_world_t *world,
4416 ecs_id_t component);
4417
4425FLECS_API
4426 void ecs_id_str_buf(
4427 const ecs_world_t *world,
4428 ecs_id_t component,
4429 ecs_strbuf_t *buf);
4430
4438FLECS_API
4439 ecs_id_t ecs_id_from_str(
4440 const ecs_world_t *world,
4441 const char *expr);
4442
4444
4450
4458FLECS_API
4459 bool ecs_term_ref_is_set(
4460 const ecs_term_ref_t *ref);
4461
4473FLECS_API
4474 bool ecs_term_is_initialized(
4475 const ecs_term_t *term);
4476
4491FLECS_API
4492 bool ecs_term_match_this(
4493 const ecs_term_t *term);
4494
4507FLECS_API
4508 bool ecs_term_match_0(
4509 const ecs_term_t *term);
4510
4519FLECS_API
4520 char* ecs_term_str(
4521 const ecs_world_t *world,
4522 const ecs_term_t *term);
4523
4531FLECS_API
4532 char* ecs_query_str(
4533 const ecs_query_t *query);
4534
4536
4542
4575FLECS_API
4576 ecs_iter_t ecs_each_id(
4577 const ecs_world_t *world,
4578 ecs_id_t component);
4579
4585FLECS_API
4586 bool ecs_each_next(
4587 ecs_iter_t *it);
4588
4605FLECS_API
4606 ecs_iter_t ecs_children(
4607 const ecs_world_t *world,
4608 ecs_entity_t parent);
4609
4615FLECS_API
4616 bool ecs_children_next(
4617 ecs_iter_t *it);
4618
4620
4627
4634FLECS_API
4635 ecs_query_t* ecs_query_init(
4636 ecs_world_t *world,
4637 const ecs_query_desc_t *desc);
4638
4643FLECS_API
4644 void ecs_query_fini(
4645 ecs_query_t *query);
4646
4655FLECS_API
4656int32_t ecs_query_find_var(
4657 const ecs_query_t *query,
4658 const char *name);
4659
4667FLECS_API
4668 const char* ecs_query_var_name(
4669 const ecs_query_t *query,
4670 int32_t var_id);
4671
4682FLECS_API
4683 bool ecs_query_var_is_entity(
4684 const ecs_query_t *query,
4685 int32_t var_id);
4686
4755FLECS_API
4756 ecs_iter_t ecs_query_iter(
4757 const ecs_world_t *world,
4758 const ecs_query_t *query);
4759
4767FLECS_API
4768 bool ecs_query_next(
4769 ecs_iter_t *it);
4770
4789FLECS_API
4790 bool ecs_query_has(
4791 ecs_query_t *query,
4792 ecs_entity_t entity,
4793 ecs_iter_t *it);
4794
4813FLECS_API
4814 bool ecs_query_has_table(
4815 ecs_query_t *query,
4816 ecs_table_t *table,
4817 ecs_iter_t *it);
4818
4845FLECS_API
4846 bool ecs_query_has_range(
4847 ecs_query_t *query,
4848 ecs_table_range_t *range,
4849 ecs_iter_t *it);
4850
4858FLECS_API
4859int32_t ecs_query_match_count(
4860 const ecs_query_t *query);
4861
4871FLECS_API
4872 char* ecs_query_plan(
4873 const ecs_query_t *query);
4874
4889FLECS_API
4890 char* ecs_query_plan_w_profile(
4891 const ecs_query_t *query,
4892 const ecs_iter_t *it);
4893
4911FLECS_API
4912 const char* ecs_query_args_parse(
4913 ecs_query_t *query,
4914 ecs_iter_t *it,
4915 const char *expr);
4916
4944FLECS_API
4945 bool ecs_query_changed(
4946 ecs_query_t *query);
4947
4956FLECS_API
4957 const ecs_query_t* ecs_query_get(
4958 const ecs_world_t *world,
4959 ecs_entity_t query);
4960
4971FLECS_API
4972 void ecs_iter_skip(
4973 ecs_iter_t *it);
4974
4997FLECS_API
4998 void ecs_iter_set_group(
4999 ecs_iter_t *it,
5000 uint64_t group_id);
5001
5010FLECS_API
5011 void* ecs_query_get_group_ctx(
5012 const ecs_query_t *query,
5013 uint64_t group_id);
5014
5023FLECS_API
5024 const ecs_query_group_info_t* ecs_query_get_group_info(
5025 const ecs_query_t *query,
5026 uint64_t group_id);
5027
5029 typedef struct ecs_query_count_t {
5030 int32_t results;
5031 int32_t entities;
5032 int32_t tables;
5035} ecs_query_count_t;
5036
5043FLECS_API
5044 ecs_query_count_t ecs_query_count(
5045 const ecs_query_t *query);
5046
5052FLECS_API
5053 bool ecs_query_is_true(
5054 const ecs_query_t *query);
5055
5064FLECS_API
5065 const ecs_query_t* ecs_query_get_cache_query(
5066 const ecs_query_t *query);
5067
5069
5076
5096FLECS_API
5097 void ecs_emit(
5098 ecs_world_t *world,
5099 ecs_event_desc_t *desc);
5100
5111FLECS_API
5112 void ecs_enqueue(
5113 ecs_world_t *world,
5114 ecs_event_desc_t *desc);
5115
5126FLECS_API
5127 ecs_entity_t ecs_observer_init(
5128 ecs_world_t *world,
5129 const ecs_observer_desc_t *desc);
5130
5139FLECS_API
5140 const ecs_observer_t* ecs_observer_get(
5141 const ecs_world_t *world,
5142 ecs_entity_t observer);
5143
5145
5152
5166FLECS_API
5167 bool ecs_iter_next(
5168 ecs_iter_t *it);
5169
5179FLECS_API
5180 void ecs_iter_fini(
5181 ecs_iter_t *it);
5182
5194FLECS_API
5195int32_t ecs_iter_count(
5196 ecs_iter_t *it);
5197
5210FLECS_API
5211 bool ecs_iter_is_true(
5212 ecs_iter_t *it);
5213
5221FLECS_API
5222 ecs_entity_t ecs_iter_first(
5223 ecs_iter_t *it);
5224
5263FLECS_API
5264 void ecs_iter_set_var(
5265 ecs_iter_t *it,
5266 int32_t var_id,
5267 ecs_entity_t entity);
5268
5279FLECS_API
5280 void ecs_iter_set_var_as_table(
5281 ecs_iter_t *it,
5282 int32_t var_id,
5283 const ecs_table_t *table);
5284
5295FLECS_API
5296 void ecs_iter_set_var_as_range(
5297 ecs_iter_t *it,
5298 int32_t var_id,
5299 const ecs_table_range_t *range);
5300
5313FLECS_API
5314 ecs_entity_t ecs_iter_get_var(
5315 ecs_iter_t *it,
5316 int32_t var_id);
5317
5324FLECS_API
5325 const char* ecs_iter_get_var_name(
5326 const ecs_iter_t *it,
5327 int32_t var_id);
5328
5334FLECS_API
5335int32_t ecs_iter_get_var_count(
5336 const ecs_iter_t *it);
5337
5343FLECS_API
5344ecs_var_t* ecs_iter_get_vars(
5345 const ecs_iter_t *it);
5346
5360FLECS_API
5361 ecs_table_t* ecs_iter_get_var_as_table(
5362 ecs_iter_t *it,
5363 int32_t var_id);
5364
5378FLECS_API
5379ecs_table_range_t ecs_iter_get_var_as_range(
5380 ecs_iter_t *it,
5381 int32_t var_id);
5382
5394FLECS_API
5395 bool ecs_iter_var_is_constrained(
5396 ecs_iter_t *it,
5397 int32_t var_id);
5398
5410FLECS_API
5411uint64_t ecs_iter_get_group(
5412 const ecs_iter_t *it);
5413
5425FLECS_API
5426 bool ecs_iter_changed(
5427 ecs_iter_t *it);
5428
5440FLECS_API
5441 char* ecs_iter_str(
5442 const ecs_iter_t *it);
5443
5459FLECS_API
5460 ecs_iter_t ecs_page_iter(
5461 const ecs_iter_t *it,
5462 int32_t offset,
5463 int32_t limit);
5464
5471FLECS_API
5472 bool ecs_page_next(
5473 ecs_iter_t *it);
5474
5495FLECS_API
5496 ecs_iter_t ecs_worker_iter(
5497 const ecs_iter_t *it,
5498 int32_t index,
5499 int32_t count);
5500
5507FLECS_API
5508 bool ecs_worker_next(
5509 ecs_iter_t *it);
5510
5552FLECS_API
5553 void* ecs_field_w_size(
5554 const ecs_iter_t *it,
5555 size_t size,
5556 int8_t index);
5557
5579FLECS_API
5580 void* ecs_field_at_w_size(
5581 const ecs_iter_t *it,
5582 size_t size,
5583 int8_t index,
5584 int32_t row);
5585
5594FLECS_API
5595 bool ecs_field_is_readonly(
5596 const ecs_iter_t *it,
5597 int8_t index);
5598
5609FLECS_API
5610 bool ecs_field_is_writeonly(
5611 const ecs_iter_t *it,
5612 int8_t index);
5613
5620FLECS_API
5621 bool ecs_field_is_set(
5622 const ecs_iter_t *it,
5623 int8_t index);
5624
5631FLECS_API
5632 ecs_id_t ecs_field_id(
5633 const ecs_iter_t *it,
5634 int8_t index);
5635
5644FLECS_API
5645int32_t ecs_field_column(
5646 const ecs_iter_t *it,
5647 int8_t index);
5648
5656FLECS_API
5657 ecs_entity_t ecs_field_src(
5658 const ecs_iter_t *it,
5659 int8_t index);
5660
5668FLECS_API
5669 size_t ecs_field_size(
5670 const ecs_iter_t *it,
5671 int8_t index);
5672
5686FLECS_API
5687 bool ecs_field_is_self(
5688 const ecs_iter_t *it,
5689 int8_t index);
5690
5692
5699
5706FLECS_API
5707 const ecs_type_t* ecs_table_get_type(
5708 const ecs_table_t *table);
5709
5720FLECS_API
5721int32_t ecs_table_get_type_index(
5722 const ecs_world_t *world,
5723 const ecs_table_t *table,
5724 ecs_id_t component);
5725
5735FLECS_API
5736int32_t ecs_table_get_column_index(
5737 const ecs_world_t *world,
5738 const ecs_table_t *table,
5739 ecs_id_t component);
5740
5748FLECS_API
5749int32_t ecs_table_column_count(
5750 const ecs_table_t *table);
5751
5765FLECS_API
5766int32_t ecs_table_type_to_column_index(
5767 const ecs_table_t *table,
5768 int32_t index);
5769
5778FLECS_API
5779int32_t ecs_table_column_to_type_index(
5780 const ecs_table_t *table,
5781 int32_t index);
5782
5791FLECS_API
5792 void* ecs_table_get_column(
5793 const ecs_table_t *table,
5794 int32_t index,
5795 int32_t offset);
5796
5806FLECS_API
5807 void* ecs_table_get_id(
5808 const ecs_world_t *world,
5809 const ecs_table_t *table,
5810 ecs_id_t component,
5811 int32_t offset);
5812
5820FLECS_API
5821 size_t ecs_table_get_column_size(
5822 const ecs_table_t *table,
5823 int32_t index);
5824
5831FLECS_API
5832int32_t ecs_table_count(
5833 const ecs_table_t *table);
5834
5842FLECS_API
5843int32_t ecs_table_size(
5844 const ecs_table_t *table);
5845
5852FLECS_API
5853 const ecs_entity_t* ecs_table_entities(
5854 const ecs_table_t *table);
5855
5866FLECS_API
5867 bool ecs_table_has_id(
5868 const ecs_world_t *world,
5869 const ecs_table_t *table,
5870 ecs_id_t component);
5871
5882FLECS_API
5883int32_t ecs_table_get_depth(
5884 const ecs_world_t *world,
5885 const ecs_table_t *table,
5886 ecs_entity_t rel);
5887
5897FLECS_API
5898 ecs_table_t* ecs_table_add_id(
5899 ecs_world_t *world,
5900 ecs_table_t *table,
5901 ecs_id_t component);
5902
5913FLECS_API
5914 ecs_table_t* ecs_table_find(
5915 ecs_world_t *world,
5916 const ecs_id_t *ids,
5917 int32_t id_count);
5918
5928FLECS_API
5929 ecs_table_t* ecs_table_remove_id(
5930 ecs_world_t *world,
5931 ecs_table_t *table,
5932 ecs_id_t component);
5933
5949FLECS_API
5950 void ecs_table_lock(
5951 ecs_world_t *world,
5952 ecs_table_t *table);
5953
5960FLECS_API
5961 void ecs_table_unlock(
5962 ecs_world_t *world,
5963 ecs_table_t *table);
5964
5974FLECS_API
5975 bool ecs_table_has_flags(
5976 ecs_table_t *table,
5977 ecs_flags32_t flags);
5978
5986FLECS_API
5987 bool ecs_table_has_traversable(
5988 const ecs_table_t *table);
5989
5997FLECS_API
5998 void ecs_table_swap_rows(
5999 ecs_world_t* world,
6000 ecs_table_t* table,
6001 int32_t row_1,
6002 int32_t row_2);
6003
6026FLECS_API
6027 bool ecs_commit(
6028 ecs_world_t *world,
6029 ecs_entity_t entity,
6030 ecs_record_t *record,
6031 ecs_table_t *table,
6032 const ecs_type_t *added,
6033 const ecs_type_t *removed);
6034
6035
6055FLECS_API
6056int32_t ecs_search(
6057 const ecs_world_t *world,
6058 const ecs_table_t *table,
6059 ecs_id_t component,
6060 ecs_id_t *component_out);
6061
6097FLECS_API
6098int32_t ecs_search_offset(
6099 const ecs_world_t *world,
6100 const ecs_table_t *table,
6101 int32_t offset,
6102 ecs_id_t component,
6103 ecs_id_t *component_out);
6104
6146FLECS_API
6147int32_t ecs_search_relation(
6148 const ecs_world_t *world,
6149 const ecs_table_t *table,
6150 int32_t offset,
6151 ecs_id_t component,
6152 ecs_entity_t rel,
6153 ecs_flags64_t flags, /* EcsSelf and/or EcsUp */
6154 ecs_entity_t *subject_out,
6155 ecs_id_t *component_out,
6156 struct ecs_table_record_t **tr_out);
6157
6165FLECS_API
6166 void ecs_table_clear_entities(
6167 ecs_world_t* world,
6168 ecs_table_t* table);
6169
6171
6178
6186FLECS_API
6187 int ecs_value_init(
6188 const ecs_world_t *world,
6189 ecs_entity_t type,
6190 void *ptr);
6191
6199FLECS_API
6200 int ecs_value_init_w_type_info(
6201 const ecs_world_t *world,
6202 const ecs_type_info_t *ti,
6203 void *ptr);
6204
6211FLECS_API
6212 void* ecs_value_new(
6213 ecs_world_t *world,
6214 ecs_entity_t type);
6215
6222 void* ecs_value_new_w_type_info(
6223 ecs_world_t *world,
6224 const ecs_type_info_t *ti);
6225
6233 int ecs_value_fini_w_type_info(
6234 const ecs_world_t *world,
6235 const ecs_type_info_t *ti,
6236 void *ptr);
6237
6245FLECS_API
6246 int ecs_value_fini(
6247 const ecs_world_t *world,
6248 ecs_entity_t type,
6249 void* ptr);
6250
6258FLECS_API
6259 int ecs_value_free(
6260 ecs_world_t *world,
6261 ecs_entity_t type,
6262 void* ptr);
6263
6272FLECS_API
6273 int ecs_value_copy_w_type_info(
6274 const ecs_world_t *world,
6275 const ecs_type_info_t *ti,
6276 void* dst,
6277 const void *src);
6278
6287FLECS_API
6288 int ecs_value_copy(
6289 const ecs_world_t *world,
6290 ecs_entity_t type,
6291 void* dst,
6292 const void *src);
6293
6302 int ecs_value_move_w_type_info(
6303 const ecs_world_t *world,
6304 const ecs_type_info_t *ti,
6305 void* dst,
6306 void *src);
6307
6316 int ecs_value_move(
6317 const ecs_world_t *world,
6318 ecs_entity_t type,
6319 void* dst,
6320 void *src);
6321
6330 int ecs_value_move_ctor_w_type_info(
6331 const ecs_world_t *world,
6332 const ecs_type_info_t *ti,
6333 void* dst,
6334 void *src);
6335
6344 int ecs_value_move_ctor(
6345 const ecs_world_t *world,
6346 ecs_entity_t type,
6347 void* dst,
6348 void *src);
6349
6351
6353
6362
6363#include "flecs/addons/flecs_c.h"
6364
6365#ifdef __cplusplus
6366}
6367#endif
6368
6369#include "flecs/private/addons.h"
6370
6371#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 *world)
Merge world or 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_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:477
ecs_stage_t
struct ecs_stage_t ecs_stage_t
A stage enables modification while iterating and from multiple threads.
Definition flecs.h:412
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:461
ecs_entity_t
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:365
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:409
ecs_mixins_t
struct ecs_mixins_t ecs_mixins_t
Type that stores poly mixins.
Definition flecs.h:501
ecs_id_t
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
Definition flecs.h:358
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:445
ecs_record_t
struct ecs_record_t ecs_record_t
Information about an entity, like its table and row.
Definition flecs.h:474
ecs_table_t
struct ecs_table_t ecs_table_t
A table stores entities and components for a specific type.
Definition flecs.h:415
ecs_poly_t
void ecs_poly_t
A poly object.
Definition flecs.h:498
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_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:620
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:600
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:662
ecs_hash_value_action_t
uint64_t(* ecs_hash_value_action_t)(const void *ptr)
Callback used for hashing values.
Definition flecs.h:638
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:613
ecs_iter_fini_action_t
void(* ecs_iter_fini_action_t)(ecs_iter_t *it)
Function prototype for freeing an iterator.
Definition flecs.h:578
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:607
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:589
ecs_iter_next_action_t
bool(* ecs_iter_next_action_t)(ecs_iter_t *it)
Function prototype for iterating an iterator.
Definition flecs.h:570
ecs_iter_action_t
void(* ecs_iter_action_t)(ecs_iter_t *it)
Function prototype for iterables.
Definition flecs.h:560
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:648
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:668
ecs_compare_action_t
int(* ecs_compare_action_t)(const void *ptr1, const void *ptr2)
Callback used for sorting values.
Definition flecs.h:633
ecs_fini_action_t
void(* ecs_fini_action_t)(ecs_world_t *world, void *ctx)
Action callback on world exit.
Definition flecs.h:624
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:655
flecs_poly_dtor_t
void(* flecs_poly_dtor_t)(ecs_poly_t *poly)
Destructor function for poly objects.
Definition flecs.h:674
ecs_run_action_t
void(* ecs_run_action_t)(ecs_iter_t *it)
Function prototype for runnables (systems, observers).
Definition flecs.h:551
ecs_ctx_free_t
void(* ecs_ctx_free_t)(void *ctx)
Function to cleanup context data.
Definition flecs.h:629
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:582
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:642
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:306
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:300
FLECS_TERM_COUNT_MAX
#define FLECS_TERM_COUNT_MAX
Maximum number of terms in queries.
Definition flecs.h:316
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:708
ecs_inout_kind_t
ecs_inout_kind_t
Specify read/write access for term.
Definition flecs.h:687
ecs_oper_kind_t
ecs_oper_kind_t
Specify operator for term.
Definition flecs.h:697
EcsQueryCacheAll
@ EcsQueryCacheAll
Require that all query terms can be cached.
Definition flecs.h:711
EcsQueryCacheDefault
@ EcsQueryCacheDefault
Behavior determined by query creation context.
Definition flecs.h:709
EcsQueryCacheNone
@ EcsQueryCacheNone
No caching.
Definition flecs.h:712
EcsQueryCacheAuto
@ EcsQueryCacheAuto
Cache query terms that are cacheable.
Definition flecs.h:710
EcsOut
@ EcsOut
Term is only written.
Definition flecs.h:693
EcsInOut
@ EcsInOut
Term is both read and written.
Definition flecs.h:691
EcsInOutFilter
@ EcsInOutFilter
Same as InOutNone + prevents term from triggering observers.
Definition flecs.h:690
EcsInOutDefault
@ EcsInOutDefault
InOut for regular terms, In for shared terms.
Definition flecs.h:688
EcsInOutNone
@ EcsInOutNone
Term is neither read nor written.
Definition flecs.h:689
EcsIn
@ EcsIn
Term is only read.
Definition flecs.h:692
EcsNot
@ EcsNot
The term must not match.
Definition flecs.h:700
EcsOptional
@ EcsOptional
The term may match.
Definition flecs.h:701
EcsOr
@ EcsOr
One of the terms in an or chain must match.
Definition flecs.h:699
EcsOrFrom
@ EcsOrFrom
Term must match at least one component from term id.
Definition flecs.h:703
EcsAnd
@ EcsAnd
The term must match.
Definition flecs.h:698
EcsNotFrom
@ EcsNotFrom
Term must match none of the components from term id.
Definition flecs.h:704
EcsAndFrom
@ EcsAndFrom
Term must match all components from term id.
Definition flecs.h:702
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_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:1544
EcsComponent::size
ecs_size_t size
Component size.
Definition flecs.h:1545
EcsComponent::alignment
ecs_size_t alignment
Component alignment.
Definition flecs.h:1546
EcsDefaultChildComponent
When added to an entity this informs serialization formats which component to use when a value is ass...
Definition flecs.h:1559
EcsDefaultChildComponent::component
ecs_id_t component
Default component id.
Definition flecs.h:1560
EcsIdentifier
A (string) identifier.
Definition flecs.h:1535
EcsIdentifier::length
ecs_size_t length
Length of identifier.
Definition flecs.h:1537
EcsIdentifier::value
char * value
Identifier string.
Definition flecs.h:1536
EcsIdentifier::index
ecs_hashmap_t * index
Current index.
Definition flecs.h:1540
EcsIdentifier::hash
uint64_t hash
Hash of current value.
Definition flecs.h:1538
EcsIdentifier::index_hash
uint64_t index_hash
Hash of existing record in current index.
Definition flecs.h:1539
EcsPoly
Component for storing a poly object.
Definition flecs.h:1550
EcsPoly::poly
ecs_poly_t * poly
Pointer to poly object.
Definition flecs.h:1551
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:1446
ecs_build_info_t::version_major
int16_t version_major
Major flecs version.
Definition flecs.h:1450
ecs_build_info_t::addons
const char ** addons
Addons included in build.
Definition flecs.h:1448
ecs_build_info_t::version
const char * version
Stringified version.
Definition flecs.h:1449
ecs_build_info_t::compiler
const char * compiler
Compiler used to compile flecs.
Definition flecs.h:1447
ecs_build_info_t::sanitize
bool sanitize
Is this a sanitize build.
Definition flecs.h:1454
ecs_build_info_t::perf_trace
bool perf_trace
Is this a perf tracing build.
Definition flecs.h:1455
ecs_build_info_t::version_minor
int16_t version_minor
Minor flecs version.
Definition flecs.h:1451
ecs_build_info_t::debug
bool debug
Is this a debug build.
Definition flecs.h:1453
ecs_build_info_t::version_patch
int16_t version_patch
Patch flecs version.
Definition flecs.h:1452
ecs_bulk_desc_t
Used with ecs_bulk_init().
Definition flecs.h:1069
ecs_bulk_desc_t::data
void ** data
Array with component data to insert.
Definition flecs.h:1081
ecs_bulk_desc_t::ids
ecs_id_t ids[(32)]
Ids to create the entities with.
Definition flecs.h:1079
ecs_bulk_desc_t::count
int32_t count
Number of entities to create/populate.
Definition flecs.h:1077
ecs_bulk_desc_t::_canary
int32_t _canary
Used for validity testing.
Definition flecs.h:1070
ecs_bulk_desc_t::entities
ecs_entity_t * entities
Entities to bulk insert.
Definition flecs.h:1072
ecs_bulk_desc_t::table
ecs_table_t * table
Table to insert the entities into.
Definition flecs.h:1088
ecs_component_desc_t
Used with ecs_component_init().
Definition flecs.h:1099
ecs_component_desc_t::_canary
int32_t _canary
Used for validity testing.
Definition flecs.h:1100
ecs_component_desc_t::type
ecs_type_info_t type
Parameters for type (size, hooks, ...)
Definition flecs.h:1106
ecs_component_desc_t::entity
ecs_entity_t entity
Existing entity to associate with observer (optional)
Definition flecs.h:1103
ecs_delete_empty_tables_desc_t
Used with ecs_delete_empty_tables().
Definition flecs.h:2654
ecs_delete_empty_tables_desc_t::delete_generation
uint16_t delete_generation
Delete table when generation > delete_generation.
Definition flecs.h:2659
ecs_delete_empty_tables_desc_t::time_budget_seconds
double time_budget_seconds
Amount of time operation is allowed to spend.
Definition flecs.h:2662
ecs_delete_empty_tables_desc_t::clear_generation
uint16_t clear_generation
Free table data when generation > clear_generation.
Definition flecs.h:2656
ecs_entities_t
Type returned by ecs_get_entities().
Definition flecs.h:2021
ecs_entities_t::alive_count
int32_t alive_count
Number of alive entity ids.
Definition flecs.h:2024
ecs_entities_t::count
int32_t count
Total number of entity ids.
Definition flecs.h:2023
ecs_entities_t::ids
const ecs_entity_t * ids
Array with all entity ids in the world.
Definition flecs.h:2022
ecs_entity_desc_t
Used with ecs_entity_init().
Definition flecs.h:1023
ecs_entity_desc_t::sep
const char * sep
Optional custom separator for hierarchical names.
Definition flecs.h:1035
ecs_entity_desc_t::root_sep
const char * root_sep
Optional, used for identifiers relative to root.
Definition flecs.h:1039
ecs_entity_desc_t::name
const char * name
Name of the entity.
Definition flecs.h:1030
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:1051
ecs_entity_desc_t::symbol
const char * symbol
Optional entity symbol.
Definition flecs.h:1041
ecs_entity_desc_t::_canary
int32_t _canary
Used for validity testing.
Definition flecs.h:1024
ecs_entity_desc_t::add
const ecs_id_t * add
0-terminated array of ids to add to the entity.
Definition flecs.h:1056
ecs_entity_desc_t::add_expr
const char * add_expr
String expression with components to add.
Definition flecs.h:1062
ecs_entity_desc_t::set
const ecs_value_t * set
0-terminated array of values to set on the entity.
Definition flecs.h:1059
ecs_entity_desc_t::id
ecs_entity_t id
Set to modify existing entity (optional)
Definition flecs.h:1026
ecs_entity_desc_t::parent
ecs_entity_t parent
Parent entity.
Definition flecs.h:1028
ecs_event_desc_t
Used with ecs_emit().
Definition flecs.h:1392
ecs_event_desc_t::entity
ecs_entity_t entity
Single-entity alternative to setting table / offset / count.
Definition flecs.h:1417
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:1428
ecs_event_desc_t::table
ecs_table_t * table
The table for which to notify.
Definition flecs.h:1402
ecs_event_desc_t::count
int32_t count
Limit number of notified entities to count.
Definition flecs.h:1414
ecs_event_desc_t::other_table
ecs_table_t * other_table
Optional 2nd table to notify.
Definition flecs.h:1406
ecs_event_desc_t::offset
int32_t offset
Limit notified entities to ones starting from offset (row) in table.
Definition flecs.h:1409
ecs_event_desc_t::ids
const ecs_type_t * ids
Component ids.
Definition flecs.h:1399
ecs_event_desc_t::observable
ecs_poly_t * observable
Observable (usually the world)
Definition flecs.h:1431
ecs_event_desc_t::event
ecs_entity_t event
The event id.
Definition flecs.h:1394
ecs_event_desc_t::flags
ecs_flags32_t flags
Event flags.
Definition flecs.h:1434
ecs_event_desc_t::param
void * param
Optional context.
Definition flecs.h:1423
ecs_header_t
Header for ecs_poly_t objects.
Definition flecs.h:504
ecs_header_t::type
int32_t type
Magic number indicating which type of flecs object.
Definition flecs.h:505
ecs_header_t::refcount
int32_t refcount
Refcount, to enable RAII handles.
Definition flecs.h:506
ecs_header_t::mixins
ecs_mixins_t * mixins
Table with offsets to (optional) mixins.
Definition flecs.h:507
ecs_iter_t
Iterator.
Definition flecs.h:1147
ecs_iter_t::real_world
ecs_world_t * real_world
Actual world.
Definition flecs.h:1150
ecs_iter_t::param
void * param
Param passed to ecs_run.
Definition flecs.h:1183
ecs_iter_t::event
ecs_entity_t event
The event (if applicable)
Definition flecs.h:1171
ecs_iter_t::frame_offset
int32_t frame_offset
Offset relative to start of iteration.
Definition flecs.h:1194
ecs_iter_t::ref_fields
ecs_flags32_t ref_fields
Bitset with fields that aren't component arrays.
Definition flecs.h:1165
ecs_iter_t::interrupted_by
ecs_entity_t interrupted_by
When set, system execution is interrupted.
Definition flecs.h:1198
ecs_iter_t::flags
ecs_flags32_t flags
Iterator flags.
Definition flecs.h:1197
ecs_iter_t::chain_it
ecs_iter_t * chain_it
Optional, allows for creating iterator chains.
Definition flecs.h:1205
ecs_iter_t::ctx
void * ctx
System context.
Definition flecs.h:1184
ecs_iter_t::run_ctx
void * run_ctx
Run language binding context.
Definition flecs.h:1187
ecs_iter_t::table
ecs_table_t * table
Current table.
Definition flecs.h:1159
ecs_iter_t::offset
int32_t offset
Offset relative to current table.
Definition flecs.h:1153
ecs_iter_t::event_id
ecs_id_t event_id
The (component) id for the event.
Definition flecs.h:1172
ecs_iter_t::fini
ecs_iter_fini_action_t fini
Function to cleanup iterator resources.
Definition flecs.h:1204
ecs_iter_t::priv_
ecs_iter_private_t priv_
Private data.
Definition flecs.h:1199
ecs_iter_t::world
ecs_world_t * world
The world.
Definition flecs.h:1149
ecs_iter_t::callback_ctx
void * callback_ctx
Callback language binding context.
Definition flecs.h:1186
ecs_iter_t::sources
ecs_entity_t * sources
Entity on which the id was matched (0 if same as entities)
Definition flecs.h:1162
ecs_iter_t::binding_ctx
void * binding_ctx
System binding context.
Definition flecs.h:1185
ecs_iter_t::row_fields
ecs_flags32_t row_fields
Fields that must be obtained with field_at.
Definition flecs.h:1166
ecs_iter_t::delta_system_time
float delta_system_time
Time elapsed since last system invocation.
Definition flecs.h:1191
ecs_iter_t::query
const ecs_query_t * query
Query being evaluated.
Definition flecs.h:1180
ecs_iter_t::term_index
int8_t term_index
Index of term that emitted an event.
Definition flecs.h:1177
ecs_iter_t::system
ecs_entity_t system
The system (if applicable)
Definition flecs.h:1170
ecs_iter_t::set_fields
ecs_flags32_t set_fields
Fields that are set.
Definition flecs.h:1164
ecs_iter_t::sizes
const ecs_size_t * sizes
Component sizes.
Definition flecs.h:1158
ecs_iter_t::delta_time
float delta_time
Time elapsed since last frame.
Definition flecs.h:1190
ecs_iter_t::up_fields
ecs_flags32_t up_fields
Bitset with fields matched through up traversal.
Definition flecs.h:1167
ecs_iter_t::callback
ecs_iter_action_t callback
Callback of system or observer.
Definition flecs.h:1203
ecs_iter_t::field_count
int8_t field_count
Number of fields in iterator.
Definition flecs.h:1176
ecs_iter_t::other_table
ecs_table_t * other_table
Prev or next table when adding/removing.
Definition flecs.h:1160
ecs_iter_t::event_cur
int32_t event_cur
Unique event id.
Definition flecs.h:1173
ecs_iter_t::trs
const ecs_table_record_t ** trs
Info on where to find field in table.
Definition flecs.h:1157
ecs_iter_t::count
int32_t count
Number of entities to iterate.
Definition flecs.h:1154
ecs_iter_t::ptrs
void ** ptrs
Component pointers.
Definition flecs.h:1156
ecs_iter_t::next
ecs_iter_next_action_t next
Function to progress iterator.
Definition flecs.h:1202
ecs_iter_t::entities
const ecs_entity_t * entities
Entity identifiers.
Definition flecs.h:1155
ecs_iter_t::ids
ecs_id_t * ids
(Component) ids
Definition flecs.h:1161
ecs_iter_t::constrained_vars
ecs_flags64_t constrained_vars
Bitset that marks constrained variables.
Definition flecs.h:1163
ecs_observer_desc_t
Used with ecs_observer_init().
Definition flecs.h:1330
ecs_observer_desc_t::run_ctx_free
ecs_ctx_free_t run_ctx_free
Callback to free run ctx.
Definition flecs.h:1374
ecs_observer_desc_t::ctx_free
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:1362
ecs_observer_desc_t::run_ctx
void * run_ctx
Context associated with run (for language bindings).
Definition flecs.h:1371
ecs_observer_desc_t::entity
ecs_entity_t entity
Existing entity to associate with observer (optional)
Definition flecs.h:1335
ecs_observer_desc_t::events
ecs_entity_t events[(8)]
Events to observe (OnAdd, OnRemove, OnSet)
Definition flecs.h:1341
ecs_observer_desc_t::last_event_id
int32_t * last_event_id
Optional shared last event id for multiple observers.
Definition flecs.h:1381
ecs_observer_desc_t::callback_ctx
void * callback_ctx
Context associated with callback (for language bindings).
Definition flecs.h:1365
ecs_observer_desc_t::ctx
void * ctx
User context to pass to callback.
Definition flecs.h:1359
ecs_observer_desc_t::query
ecs_query_desc_t query
Query for observer.
Definition flecs.h:1338
ecs_observer_desc_t::observable
ecs_poly_t * observable
Observable with which to register the observer.
Definition flecs.h:1377
ecs_observer_desc_t::callback_ctx_free
ecs_ctx_free_t callback_ctx_free
Callback to free callback ctx.
Definition flecs.h:1368
ecs_observer_desc_t::term_index_
int8_t term_index_
Used for internal purposes.
Definition flecs.h:1384
ecs_observer_desc_t::callback
ecs_iter_action_t callback
Callback to invoke on an event, invoked when the observer matches.
Definition flecs.h:1348
ecs_observer_desc_t::yield_existing
bool yield_existing
When observer is created, generate events from existing data.
Definition flecs.h:1345
ecs_observer_desc_t::run
ecs_run_action_t run
Callback invoked on an event.
Definition flecs.h:1356
ecs_observer_desc_t::_canary
int32_t _canary
Used for validity testing.
Definition flecs.h:1332
ecs_observer_t
An observer reacts to events matching a query.
Definition flecs.h:858
ecs_observer_t::event_count
int32_t event_count
Number of events.
Definition flecs.h:865
ecs_observer_t::callback
ecs_iter_action_t callback
See ecs_observer_desc_t::callback.
Definition flecs.h:867
ecs_observer_t::entity
ecs_entity_t entity
Entity associated with observer.
Definition flecs.h:881
ecs_observer_t::observable
ecs_observable_t * observable
Observable for observer.
Definition flecs.h:878
ecs_observer_t::run
ecs_run_action_t run
See ecs_observer_desc_t::run.
Definition flecs.h:868
ecs_observer_t::hdr
ecs_header_t hdr
Object header.
Definition flecs.h:859
ecs_observer_t::ctx_free
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:874
ecs_observer_t::run_ctx
void * run_ctx
Run language binding context.
Definition flecs.h:872
ecs_observer_t::world
ecs_world_t * world
The world.
Definition flecs.h:880
ecs_observer_t::run_ctx_free
ecs_ctx_free_t run_ctx_free
Callback to free run_ctx.
Definition flecs.h:876
ecs_observer_t::callback_ctx
void * callback_ctx
Callback language binding context.
Definition flecs.h:871
ecs_observer_t::ctx
void * ctx
Observer context.
Definition flecs.h:870
ecs_observer_t::events
ecs_entity_t events[(8)]
Observer events.
Definition flecs.h:864
ecs_observer_t::callback_ctx_free
ecs_ctx_free_t callback_ctx_free
Callback to free callback_ctx.
Definition flecs.h:875
ecs_observer_t::query
ecs_query_t * query
Observer query.
Definition flecs.h:861
ecs_query_count_t
Struct returned by ecs_query_count().
Definition flecs.h:5029
ecs_query_count_t::entities
int32_t entities
Number of entities returned by query.
Definition flecs.h:5031
ecs_query_count_t::results
int32_t results
Number of results returned by query.
Definition flecs.h:5030
ecs_query_count_t::tables
int32_t tables
Number of tables returned by query.
Definition flecs.h:5032
ecs_query_desc_t
Used with ecs_query_init().
Definition flecs.h:1256
ecs_query_desc_t::ctx_free
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:1317
ecs_query_desc_t::group_by
ecs_id_t group_by
Component id to be used for grouping.
Definition flecs.h:1287
ecs_query_desc_t::terms
ecs_term_t terms[32]
Query terms.
Definition flecs.h:1261
ecs_query_desc_t::_canary
int32_t _canary
Used for validity testing.
Definition flecs.h:1258
ecs_query_desc_t::ctx
void * ctx
User context to pass to callback.
Definition flecs.h:1311
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:1308
ecs_query_desc_t::group_by_ctx
void * group_by_ctx
Context to pass to group_by.
Definition flecs.h:1305
ecs_query_desc_t::binding_ctx
void * binding_ctx
Context to be used for language bindings.
Definition flecs.h:1314
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:1283
ecs_query_desc_t::order_by_callback
ecs_order_by_action_t order_by_callback
Callback used for ordering query results.
Definition flecs.h:1275
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:1298
ecs_query_desc_t::entity
ecs_entity_t entity
Entity associated with query (optional)
Definition flecs.h:1323
ecs_query_desc_t::binding_ctx_free
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:1320
ecs_query_desc_t::group_by_callback
ecs_group_by_action_t group_by_callback
Callback used for grouping results.
Definition flecs.h:1294
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:1302
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:1279
ecs_query_desc_t::flags
ecs_flags32_t flags
Flags for enabling query features.
Definition flecs.h:1270
ecs_query_desc_t::cache_kind
ecs_query_cache_kind_t cache_kind
Caching policy of query.
Definition flecs.h:1267
ecs_query_desc_t::expr
const char * expr
Query DSL expression (optional)
Definition flecs.h:1264
ecs_query_group_info_t
Type that contains information about a query group.
Definition flecs.h:1518
ecs_query_group_info_t::table_count
int32_t table_count
Number of tables in group.
Definition flecs.h:1521
ecs_query_group_info_t::ctx
void * ctx
Group context, returned by on_group_create.
Definition flecs.h:1522
ecs_query_group_info_t::match_count
int32_t match_count
How often tables have been matched/unmatched.
Definition flecs.h:1520
ecs_query_t
Queries are lists of constraints (terms) that match entities.
Definition flecs.h:817
ecs_query_t::row_fields
ecs_flags32_t row_fields
Fields that must be acquired with field_at.
Definition flecs.h:837
ecs_query_t::data_fields
ecs_flags32_t data_fields
Fields that have data.
Definition flecs.h:834
ecs_query_t::read_fields
ecs_flags32_t read_fields
Fields that read data.
Definition flecs.h:836
ecs_query_t::hdr
ecs_header_t hdr
Object header.
Definition flecs.h:818
ecs_query_t::var_count
int8_t var_count
Number of query variables.
Definition flecs.h:826
ecs_query_t::fixed_fields
ecs_flags32_t fixed_fields
Fields with a fixed source.
Definition flecs.h:831
ecs_query_t::var_fields
ecs_flags32_t var_fields
Fields with non-$this variable source.
Definition flecs.h:832
ecs_query_t::write_fields
ecs_flags32_t write_fields
Fields that write data.
Definition flecs.h:835
ecs_query_t::eval_count
int32_t eval_count
Number of times query is evaluated.
Definition flecs.h:852
ecs_query_t::world
ecs_world_t * world
World or stage query was created with.
Definition flecs.h:850
ecs_query_t::static_id_fields
ecs_flags32_t static_id_fields
Fields with a static (component) id.
Definition flecs.h:833
ecs_query_t::bloom_filter
uint64_t bloom_filter
Bitmask used to quickly discard tables.
Definition flecs.h:824
ecs_query_t::real_world
ecs_world_t * real_world
Actual world.
Definition flecs.h:849
ecs_query_t::set_fields
ecs_flags32_t set_fields
Fields that will be set.
Definition flecs.h:839
ecs_query_t::entity
ecs_entity_t entity
Entity associated with query (optional)
Definition flecs.h:848
ecs_query_t::ctx
void * ctx
User context to pass to callback.
Definition flecs.h:845
ecs_query_t::sizes
int32_t * sizes
Component sizes.
Definition flecs.h:821
ecs_query_t::ids
ecs_id_t * ids
Component ids.
Definition flecs.h:822
ecs_query_t::shared_readonly_fields
ecs_flags32_t shared_readonly_fields
Fields that don't write shared data.
Definition flecs.h:838
ecs_query_t::terms
ecs_term_t * terms
Query terms.
Definition flecs.h:820
ecs_query_t::cache_kind
ecs_query_cache_kind_t cache_kind
Caching policy of query.
Definition flecs.h:841
ecs_query_t::term_count
int8_t term_count
Number of query terms.
Definition flecs.h:827
ecs_query_t::vars
char ** vars
Array with variable names for iterator.
Definition flecs.h:843
ecs_query_t::field_count
int8_t field_count
Number of fields returned by query.
Definition flecs.h:828
ecs_query_t::flags
ecs_flags32_t flags
Query flags.
Definition flecs.h:825
ecs_query_t::binding_ctx
void * binding_ctx
Context to be used for language bindings.
Definition flecs.h:846
ecs_term_ref_t
Type that describes a reference to an entity or variable in a term.
Definition flecs.h:778
ecs_term_ref_t::name
const char * name
Name.
Definition flecs.h:785
ecs_term_ref_t::id
ecs_entity_t id
Entity id.
Definition flecs.h:779
ecs_term_t
Type that describes a term (single element in a query).
Definition flecs.h:793
ecs_term_t::src
ecs_term_ref_t src
Source of term.
Definition flecs.h:799
ecs_term_t::field_index
int8_t field_index
Index of field for term in iterator.
Definition flecs.h:810
ecs_term_t::id
ecs_id_t id
Component id to be matched by term.
Definition flecs.h:794
ecs_term_t::oper
int16_t oper
Operator of term.
Definition flecs.h:808
ecs_term_t::second
ecs_term_ref_t second
Second element of pair.
Definition flecs.h:801
ecs_term_t::flags_
ecs_flags16_t flags_
Flags that help eval, set by ecs_query_init()
Definition flecs.h:811
ecs_term_t::trav
ecs_entity_t trav
Relationship to traverse when looking for the component.
Definition flecs.h:803
ecs_term_t::inout
int16_t inout
Access to contents matched by term.
Definition flecs.h:807
ecs_term_t::first
ecs_term_ref_t first
Component or first element of pair.
Definition flecs.h:800
ecs_type_hooks_t
Definition flecs.h:930
ecs_type_hooks_t::copy_ctor
ecs_copy_t copy_ctor
Ctor + copy.
Definition flecs.h:937
ecs_type_hooks_t::lifecycle_ctx
void * lifecycle_ctx
Component lifecycle context (see meta add-on)
Definition flecs.h:989
ecs_type_hooks_t::ctx
void * ctx
User defined context.
Definition flecs.h:987
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:979
ecs_type_hooks_t::binding_ctx
void * binding_ctx
Language binding context.
Definition flecs.h:988
ecs_type_hooks_t::move_dtor
ecs_move_t move_dtor
Move + dtor.
Definition flecs.h:952
ecs_type_hooks_t::flags
ecs_flags32_t flags
Hook flags.
Definition flecs.h:964
ecs_type_hooks_t::cmp
ecs_cmp_t cmp
Compare hook.
Definition flecs.h:955
ecs_type_hooks_t::copy
ecs_copy_t copy
copy assignment
Definition flecs.h:933
ecs_type_hooks_t::lifecycle_ctx_free
ecs_ctx_free_t lifecycle_ctx_free
Callback to free lifecycle_ctx.
Definition flecs.h:993
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:974
ecs_type_hooks_t::move
ecs_move_t move
move assignment
Definition flecs.h:934
ecs_type_hooks_t::ctor
ecs_xtor_t ctor
ctor
Definition flecs.h:931
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:985
ecs_type_hooks_t::ctx_free
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:991
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:969
ecs_type_hooks_t::binding_ctx_free
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:992
ecs_type_hooks_t::move_ctor
ecs_move_t move_ctor
Ctor + move.
Definition flecs.h:940
ecs_type_hooks_t::equals
ecs_equals_t equals
Equals hook.
Definition flecs.h:958
ecs_type_hooks_t::ctor_move_dtor
ecs_move_t ctor_move_dtor
Ctor + move + dtor (or move_ctor + dtor).
Definition flecs.h:946
ecs_type_hooks_t::dtor
ecs_xtor_t dtor
dtor
Definition flecs.h:932
ecs_type_info_t
Type that contains component information (passed to ctors/dtors/...)
Definition flecs.h:1000
ecs_type_info_t::alignment
ecs_size_t alignment
Alignment of type.
Definition flecs.h:1002
ecs_type_info_t::size
ecs_size_t size
Size of type.
Definition flecs.h:1001
ecs_type_info_t::name
const char * name
Type name.
Definition flecs.h:1005
ecs_type_info_t::component
ecs_entity_t component
Handle to component (do not set)
Definition flecs.h:1004
ecs_type_info_t::hooks
ecs_type_hooks_t hooks
Type hooks.
Definition flecs.h:1003
ecs_type_t
A type is a list of (component) ids.
Definition flecs.h:382
ecs_type_t::array
ecs_id_t * array
Array with ids.
Definition flecs.h:383
ecs_type_t::count
int32_t count
Number of elements in array.
Definition flecs.h:384
ecs_value_t
Utility to hold a value of a dynamic type.
Definition flecs.h:1014
ecs_value_t::ptr
void * ptr
Pointer to value.
Definition flecs.h:1016
ecs_value_t::type
ecs_entity_t type
Type of value.
Definition flecs.h:1015
ecs_world_info_t
Type that contains information about the world.
Definition flecs.h:1459
ecs_world_info_t::delta_time
float delta_time
Time passed to or computed by ecs_progress()
Definition flecs.h:1465
ecs_world_info_t::min_id
ecs_entity_t min_id
First allowed entity id.
Definition flecs.h:1461
ecs_world_info_t::set_count
int64_t set_count
Set commands processed.
Definition flecs.h:1501
ecs_world_info_t::world_time_total
double world_time_total
Time elapsed in simulation.
Definition flecs.h:1473
ecs_world_info_t::tag_id_count
int32_t tag_id_count
Number of tag (no data) ids in the world.
Definition flecs.h:1489
ecs_world_info_t::component_id_count
int32_t component_id_count
Number of component (data) ids in the world.
Definition flecs.h:1490
ecs_world_info_t::pipeline_build_count_total
int64_t pipeline_build_count_total
Total number of pipeline builds.
Definition flecs.h:1485
ecs_world_info_t::eval_comp_monitors_total
int64_t eval_comp_monitors_total
Total number of monitor evaluations.
Definition flecs.h:1478
ecs_world_info_t::table_count
int32_t table_count
Number of tables.
Definition flecs.h:1493
ecs_world_info_t::delta_time_raw
float delta_time_raw
Raw delta time (no time scaling)
Definition flecs.h:1464
ecs_world_info_t::frame_time_total
float frame_time_total
Total time spent processing a frame.
Definition flecs.h:1468
ecs_world_info_t::table_create_total
int64_t table_create_total
Total number of times a table was created.
Definition flecs.h:1483
ecs_world_info_t::observers_ran_frame
int64_t observers_ran_frame
Total number of times observer was invoked.
Definition flecs.h:1487
ecs_world_info_t::system_time_total
float system_time_total
Total time spent in systems.
Definition flecs.h:1469
ecs_world_info_t::id_delete_total
int64_t id_delete_total
Total number of times an id was deleted.
Definition flecs.h:1482
ecs_world_info_t::systems_ran_frame
int64_t systems_ran_frame
Total number of systems ran in last frame.
Definition flecs.h:1486
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:1471
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:1504
ecs_world_info_t::clear_count
int64_t clear_count
Clear commands processed.
Definition flecs.h:1500
ecs_world_info_t::last_component_id
ecs_entity_t last_component_id
Last issued component entity id.
Definition flecs.h:1460
ecs_world_info_t::frame_count_total
int64_t frame_count_total
Total number of frames.
Definition flecs.h:1476
ecs_world_info_t::max_id
ecs_entity_t max_id
Last allowed entity id.
Definition flecs.h:1462
ecs_world_info_t::merge_count_total
int64_t merge_count_total
Total number of merges.
Definition flecs.h:1477
ecs_world_info_t::other_count
int64_t other_count
Other commands processed.
Definition flecs.h:1506
ecs_world_info_t::batched_command_count
int64_t batched_command_count
Commands batched.
Definition flecs.h:1508
ecs_world_info_t::table_delete_total
int64_t table_delete_total
Total number of times a table was deleted.
Definition flecs.h:1484
ecs_world_info_t::delete_count
int64_t delete_count
Selete commands processed.
Definition flecs.h:1499
ecs_world_info_t::rematch_count_total
int64_t rematch_count_total
Total number of rematches.
Definition flecs.h:1479
ecs_world_info_t::id_create_total
int64_t id_create_total
Total number of times a new id was created.
Definition flecs.h:1481
ecs_world_info_t::batched_entity_count
int64_t batched_entity_count
Entities for which commands were batched.
Definition flecs.h:1507
ecs_world_info_t::time_scale
float time_scale
Time scale applied to delta_time.
Definition flecs.h:1466
ecs_world_info_t::pair_id_count
int32_t pair_id_count
Number of pair ids in the world.
Definition flecs.h:1491
ecs_world_info_t::rematch_time_total
float rematch_time_total
Time spent on query rematching.
Definition flecs.h:1472
ecs_world_info_t::ensure_count
int64_t ensure_count
Ensure/emplace commands processed.
Definition flecs.h:1502
ecs_world_info_t::target_fps
float target_fps
Target fps.
Definition flecs.h:1467
ecs_world_info_t::world_time_total_raw
double world_time_total_raw
Time elapsed in simulation (no scaling)
Definition flecs.h:1474
ecs_world_info_t::emit_time_total
float emit_time_total
Total time spent notifying observers.
Definition flecs.h:1470
ecs_world_info_t::modified_count
int64_t modified_count
Modified commands processed.
Definition flecs.h:1503
ecs_world_info_t::name_prefix
const char * name_prefix
Value set by ecs_set_name_prefix().
Definition flecs.h:1511
ecs_world_info_t::event_count
int64_t event_count
Enqueued custom events.
Definition flecs.h:1505
ecs_world_info_t::add_count
int64_t add_count
Add commands processed.
Definition flecs.h:1497
ecs_world_info_t::remove_count
int64_t remove_count
Remove commands processed.
Definition flecs.h:1498