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 0
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#error "invalid configuration: cannot both define FLECS_DEBUG and FLECS_NDEBUG"
84#endif
85#if defined(FLECS_DEBUG) && defined(NDEBUG)
86#error "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
258#ifndef FLECS_HI_COMPONENT_ID
259#define FLECS_HI_COMPONENT_ID (256)
260#endif
261
268#ifndef FLECS_HI_ID_RECORD_ID
269#define FLECS_HI_ID_RECORD_ID (1024)
270#endif
271
277#ifndef FLECS_SPARSE_PAGE_BITS
278#define FLECS_SPARSE_PAGE_BITS (6)
279#endif
280
283#ifndef FLECS_ENTITY_PAGE_BITS
284#define FLECS_ENTITY_PAGE_BITS (10)
285#endif
286
291// #define FLECS_USE_OS_ALLOC
292
295#ifndef FLECS_ID_DESC_MAX
296#define FLECS_ID_DESC_MAX (32)
297#endif
298
301#ifndef FLECS_EVENT_DESC_MAX
302#define FLECS_EVENT_DESC_MAX (8)
303#endif
304
307#define FLECS_VARIABLE_COUNT_MAX (64)
308
311#ifndef FLECS_TERM_COUNT_MAX
312#define FLECS_TERM_COUNT_MAX 32
313#endif
314
317#ifndef FLECS_TERM_ARG_COUNT_MAX
318#define FLECS_TERM_ARG_COUNT_MAX (16)
319#endif
320
323#ifndef FLECS_QUERY_VARIABLE_COUNT_MAX
324#define FLECS_QUERY_VARIABLE_COUNT_MAX (64)
325#endif
326
329#ifndef FLECS_QUERY_SCOPE_NESTING_MAX
330#define FLECS_QUERY_SCOPE_NESTING_MAX (8)
331#endif
332
337#ifndef FLECS_DAG_DEPTH_MAX
338#define FLECS_DAG_DEPTH_MAX (128)
339#endif
340
342
343#include "flecs/private/api_defines.h"
344#include "flecs/datastructures/vec.h" /* Vector datatype */
345#include "flecs/datastructures/sparse.h" /* Sparse set */
346#include "flecs/datastructures/block_allocator.h" /* Block allocator */
347#include "flecs/datastructures/stack_allocator.h" /* Stack allocator */
348#include "flecs/datastructures/map.h" /* Map */
349#include "flecs/datastructures/allocator.h" /* Allocator */
350#include "flecs/datastructures/strbuf.h" /* String builder */
351#include "flecs/os_api.h" /* Abstraction for operating system functions */
352
353#ifdef __cplusplus
354extern "C" {
355#endif
356
363
370
373 typedef uint64_t ecs_id_t;
374
380 typedef ecs_id_t ecs_entity_t;
381
397 typedef struct {
398 ecs_id_t *array;
399 int32_t count;
400} ecs_type_t;
401
424 typedef struct ecs_world_t ecs_world_t;
425
427 typedef struct ecs_stage_t ecs_stage_t;
428
430 typedef struct ecs_table_t ecs_table_t;
431
433 typedef struct ecs_term_t ecs_term_t;
434
436 typedef struct ecs_query_t ecs_query_t;
437
455 typedef struct ecs_observer_t ecs_observer_t;
456
460 typedef struct ecs_observable_t ecs_observable_t;
461
466 typedef struct ecs_iter_t ecs_iter_t;
467
476 typedef struct ecs_ref_t ecs_ref_t;
477
481 typedef struct ecs_type_hooks_t ecs_type_hooks_t;
482
486 typedef struct ecs_type_info_t ecs_type_info_t;
487
489 typedef struct ecs_record_t ecs_record_t;
490
492 typedef struct ecs_component_record_t ecs_component_record_t;
493
513 typedef void ecs_poly_t;
514
516 typedef struct ecs_mixins_t ecs_mixins_t;
517
519 typedef struct ecs_header_t {
520 int32_t type;
521 int32_t refcount;
522 ecs_mixins_t *mixins;
523} ecs_header_t;
524
525typedef struct ecs_table_record_t ecs_table_record_t;
526
528
535
545 typedef void (*ecs_run_action_t)(
546 ecs_iter_t *it);
547
554 typedef void (*ecs_iter_action_t)(
555 ecs_iter_t *it);
556
564 typedef bool (*ecs_iter_next_action_t)(
565 ecs_iter_t *it);
566
572 typedef void (*ecs_iter_fini_action_t)(
573 ecs_iter_t *it);
574
576 typedef int (*ecs_order_by_action_t)(
577 ecs_entity_t e1,
578 const void *ptr1,
579 ecs_entity_t e2,
580 const void *ptr2);
581
583 typedef void (*ecs_sort_table_action_t)(
584 ecs_world_t* world,
585 ecs_table_t* table,
586 ecs_entity_t* entities,
587 void* ptr,
588 int32_t size,
589 int32_t lo,
590 int32_t hi,
591 ecs_order_by_action_t order_by);
592
594 typedef uint64_t (*ecs_group_by_action_t)(
595 ecs_world_t *world,
596 ecs_table_t *table,
597 ecs_id_t group_id,
598 void *ctx);
599
601 typedef void* (*ecs_group_create_action_t)(
602 ecs_world_t *world,
603 uint64_t group_id,
604 void *group_by_ctx); /* from ecs_query_desc_t */
605
607 typedef void (*ecs_group_delete_action_t)(
608 ecs_world_t *world,
609 uint64_t group_id,
610 void *group_ctx, /* return value from ecs_group_create_action_t */
611 void *group_by_ctx); /* from ecs_query_desc_t */
612
614 typedef void (*ecs_module_action_t)(
615 ecs_world_t *world);
616
618 typedef void (*ecs_fini_action_t)(
619 ecs_world_t *world,
620 void *ctx);
621
623 typedef void (*ecs_ctx_free_t)(
624 void *ctx);
625
627 typedef int (*ecs_compare_action_t)(
628 const void *ptr1,
629 const void *ptr2);
630
632 typedef uint64_t (*ecs_hash_value_action_t)(
633 const void *ptr);
634
636 typedef void (*ecs_xtor_t)(
637 void *ptr,
638 int32_t count,
639 const ecs_type_info_t *type_info);
640
642 typedef void (*ecs_copy_t)(
643 void *dst_ptr,
644 const void *src_ptr,
645 int32_t count,
646 const ecs_type_info_t *type_info);
647
649 typedef void (*ecs_move_t)(
650 void *dst_ptr,
651 void *src_ptr,
652 int32_t count,
653 const ecs_type_info_t *type_info);
654
656 typedef int (*ecs_cmp_t)(
657 const void *a_ptr,
658 const void *b_ptr,
659 const ecs_type_info_t *type_info);
660
662 typedef bool (*ecs_equals_t)(
663 const void *a_ptr,
664 const void *b_ptr,
665 const ecs_type_info_t *type_info);
666
668 typedef void (*flecs_poly_dtor_t)(
669 ecs_poly_t *poly);
670
672
679
681 typedef enum ecs_inout_kind_t {
682 EcsInOutDefault,
683 EcsInOutNone,
684 EcsInOutFilter,
685 EcsInOut,
686 EcsIn,
687 EcsOut,
688} ecs_inout_kind_t;
689
691 typedef enum ecs_oper_kind_t {
692 EcsAnd,
693 EcsOr,
694 EcsNot,
695 EcsOptional,
696 EcsAndFrom,
697 EcsOrFrom,
698 EcsNotFrom,
699} ecs_oper_kind_t;
700
702 typedef enum ecs_query_cache_kind_t {
703 EcsQueryCacheDefault,
704 EcsQueryCacheAuto,
705 EcsQueryCacheAll,
706 EcsQueryCacheNone,
707} ecs_query_cache_kind_t;
708
709/* Term id flags */
710
715#define EcsSelf (1llu << 63)
716
721#define EcsUp (1llu << 62)
722
727#define EcsTrav (1llu << 61)
728
733#define EcsCascade (1llu << 60)
734
739#define EcsDesc (1llu << 59)
740
745#define EcsIsVariable (1llu << 58)
746
751#define EcsIsEntity (1llu << 57)
752
757#define EcsIsName (1llu << 56)
758
763#define EcsTraverseFlags (EcsSelf|EcsUp|EcsTrav|EcsCascade|EcsDesc)
764
769#define EcsTermRefFlags (EcsTraverseFlags|EcsIsVariable|EcsIsEntity|EcsIsName)
770
772 typedef struct ecs_term_ref_t {
773 ecs_entity_t id;
778
779 const char *name;
784} ecs_term_ref_t;
785
787 struct ecs_term_t {
788 ecs_id_t id;
792
793 ecs_term_ref_t src;
794 ecs_term_ref_t first;
795 ecs_term_ref_t second;
796
797 ecs_entity_t trav;
800
801 int16_t inout;
802 int16_t oper;
803
804 int8_t field_index;
805 ecs_flags16_t flags_;
806};
807
811 struct ecs_query_t {
812 ecs_header_t hdr;
813
814 ecs_term_t *terms;
815 int32_t *sizes;
816 ecs_id_t *ids;
817
818 uint64_t bloom_filter;
819 ecs_flags32_t flags;
820 int8_t var_count;
821 int8_t term_count;
822 int8_t field_count;
823
824 /* Bitmasks for quick field information lookups */
825 ecs_termset_t fixed_fields;
826 ecs_termset_t var_fields;
827 ecs_termset_t static_id_fields;
828 ecs_termset_t data_fields;
829 ecs_termset_t write_fields;
830 ecs_termset_t read_fields;
831 ecs_termset_t row_fields;
832 ecs_termset_t shared_readonly_fields;
833 ecs_termset_t set_fields;
834
835 ecs_query_cache_kind_t cache_kind;
836
837 char **vars;
838
839 void *ctx;
840 void *binding_ctx;
841
842 ecs_entity_t entity;
843 ecs_world_t *real_world;
844 ecs_world_t *world;
845
846 int32_t eval_count;
847};
848
852 struct ecs_observer_t {
853 ecs_header_t hdr;
854
855 ecs_query_t *query;
856
858 ecs_entity_t events[FLECS_EVENT_DESC_MAX];
859 int32_t event_count;
860
861 ecs_iter_action_t callback;
862 ecs_run_action_t run;
863
864 void *ctx;
865 void *callback_ctx;
866 void *run_ctx;
867
868 ecs_ctx_free_t ctx_free;
869 ecs_ctx_free_t callback_ctx_free;
870 ecs_ctx_free_t run_ctx_free;
871
872 ecs_observable_t *observable;
873
874 ecs_world_t *world;
875 ecs_entity_t entity;
876};
877
879
884
885/* Flags that can be used to check which hooks a type has set */
886#define ECS_TYPE_HOOK_CTOR ECS_CAST(ecs_flags32_t, 1 << 0)
887#define ECS_TYPE_HOOK_DTOR ECS_CAST(ecs_flags32_t, 1 << 1)
888#define ECS_TYPE_HOOK_COPY ECS_CAST(ecs_flags32_t, 1 << 2)
889#define ECS_TYPE_HOOK_MOVE ECS_CAST(ecs_flags32_t, 1 << 3)
890#define ECS_TYPE_HOOK_COPY_CTOR ECS_CAST(ecs_flags32_t, 1 << 4)
891#define ECS_TYPE_HOOK_MOVE_CTOR ECS_CAST(ecs_flags32_t, 1 << 5)
892#define ECS_TYPE_HOOK_CTOR_MOVE_DTOR ECS_CAST(ecs_flags32_t, 1 << 6)
893#define ECS_TYPE_HOOK_MOVE_DTOR ECS_CAST(ecs_flags32_t, 1 << 7)
894#define ECS_TYPE_HOOK_CMP ECS_CAST(ecs_flags32_t, 1 << 8)
895#define ECS_TYPE_HOOK_EQUALS ECS_CAST(ecs_flags32_t, 1 << 9)
896
897
898/* Flags that can be used to set/check which hooks of a type are invalid */
899#define ECS_TYPE_HOOK_CTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 10)
900#define ECS_TYPE_HOOK_DTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 12)
901#define ECS_TYPE_HOOK_COPY_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 13)
902#define ECS_TYPE_HOOK_MOVE_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 14)
903#define ECS_TYPE_HOOK_COPY_CTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 15)
904#define ECS_TYPE_HOOK_MOVE_CTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 16)
905#define ECS_TYPE_HOOK_CTOR_MOVE_DTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 17)
906#define ECS_TYPE_HOOK_MOVE_DTOR_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 18)
907#define ECS_TYPE_HOOK_CMP_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 19)
908#define ECS_TYPE_HOOK_EQUALS_ILLEGAL ECS_CAST(ecs_flags32_t, 1 << 20)
909
910
911/* All valid hook flags */
912#define ECS_TYPE_HOOKS (ECS_TYPE_HOOK_CTOR|ECS_TYPE_HOOK_DTOR|\
913 ECS_TYPE_HOOK_COPY|ECS_TYPE_HOOK_MOVE|ECS_TYPE_HOOK_COPY_CTOR|\
914 ECS_TYPE_HOOK_MOVE_CTOR|ECS_TYPE_HOOK_CTOR_MOVE_DTOR|\
915 ECS_TYPE_HOOK_MOVE_DTOR|ECS_TYPE_HOOK_CMP|ECS_TYPE_HOOK_EQUALS)
916
917/* All invalid hook flags */
918#define ECS_TYPE_HOOKS_ILLEGAL (ECS_TYPE_HOOK_CTOR_ILLEGAL|\
919 ECS_TYPE_HOOK_DTOR_ILLEGAL|ECS_TYPE_HOOK_COPY_ILLEGAL|\
920 ECS_TYPE_HOOK_MOVE_ILLEGAL|ECS_TYPE_HOOK_COPY_CTOR_ILLEGAL|\
921 ECS_TYPE_HOOK_MOVE_CTOR_ILLEGAL|ECS_TYPE_HOOK_CTOR_MOVE_DTOR_ILLEGAL|\
922 ECS_TYPE_HOOK_MOVE_DTOR_ILLEGAL|ECS_TYPE_HOOK_CMP_ILLEGAL|\
923 ECS_TYPE_HOOK_EQUALS_ILLEGAL)
924 struct ecs_type_hooks_t {
925 ecs_xtor_t ctor;
926 ecs_xtor_t dtor;
927 ecs_copy_t copy;
928 ecs_move_t move;
929
931 ecs_copy_t copy_ctor;
932
934 ecs_move_t move_ctor;
935
940 ecs_move_t ctor_move_dtor;
941
946 ecs_move_t move_dtor;
947
949 ecs_cmp_t cmp;
950
952 ecs_equals_t equals;
953
958 ecs_flags32_t flags;
959
960
963 ecs_iter_action_t on_add;
964
968 ecs_iter_action_t on_set;
969
973 ecs_iter_action_t on_remove;
974
975 void *ctx;
976 void *binding_ctx;
977 void *lifecycle_ctx;
978
979 ecs_ctx_free_t ctx_free;
980 ecs_ctx_free_t binding_ctx_free;
981 ecs_ctx_free_t lifecycle_ctx_free;
982};
983
988 struct ecs_type_info_t {
989 ecs_size_t size;
990 ecs_size_t alignment;
991 ecs_type_hooks_t hooks;
992 ecs_entity_t component;
993 const char *name;
994};
995
996#include "flecs/private/api_types.h" /* Supporting API types */
997#include "flecs/private/api_support.h" /* Supporting API functions */
998#include "flecs/datastructures/hashmap.h" /* Hashmap */
999#include "flecs/private/api_internals.h" /* Supporting API functions */
1000
1002 typedef struct ecs_value_t {
1003 ecs_entity_t type;
1004 void *ptr;
1005} ecs_value_t;
1006
1011 typedef struct ecs_entity_desc_t {
1012 int32_t _canary;
1013
1014 ecs_entity_t id;
1015
1016 ecs_entity_t parent;
1017
1018 const char *name;
1022
1023 const char *sep;
1026
1027 const char *root_sep;
1028
1029 const char *symbol;
1038
1039 bool use_low_id;
1042
1044 const ecs_id_t *add;
1045
1047 const ecs_value_t *set;
1048
1050 const char *add_expr;
1051} ecs_entity_desc_t;
1052
1057 typedef struct ecs_bulk_desc_t {
1058 int32_t _canary;
1059
1060 ecs_entity_t *entities;
1064
1065 int32_t count;
1066
1067 ecs_id_t ids[FLECS_ID_DESC_MAX];
1068
1069 void **data;
1075
1076 ecs_table_t *table;
1080
1081} ecs_bulk_desc_t;
1082
1087 typedef struct ecs_component_desc_t {
1088 int32_t _canary;
1089
1091 ecs_entity_t entity;
1092
1094 ecs_type_info_t type;
1095} ecs_component_desc_t;
1096
1135 struct ecs_iter_t {
1136 /* World */
1137 ecs_world_t *world;
1138 ecs_world_t *real_world;
1139
1140 /* Matched data */
1141 int32_t offset;
1142 int32_t count;
1143 const ecs_entity_t *entities;
1144 void **ptrs;
1145 const ecs_table_record_t **trs;
1146 const ecs_size_t *sizes;
1147 ecs_table_t *table;
1148 ecs_table_t *other_table;
1149 ecs_id_t *ids;
1150 ecs_entity_t *sources;
1151 ecs_flags64_t constrained_vars;
1152 ecs_termset_t set_fields;
1153 ecs_termset_t ref_fields;
1154 ecs_termset_t row_fields;
1155 ecs_termset_t up_fields;
1156
1157 /* Input information */
1158 ecs_entity_t system;
1159 ecs_entity_t event;
1160 ecs_id_t event_id;
1161 int32_t event_cur;
1162
1163 /* Query information */
1164 int8_t field_count;
1165 int8_t term_index;
1168 const ecs_query_t *query;
1169
1170 /* Context */
1171 void *param;
1172 void *ctx;
1173 void *binding_ctx;
1174 void *callback_ctx;
1175 void *run_ctx;
1176
1177 /* Time */
1178 ecs_ftime_t delta_time;
1179 ecs_ftime_t delta_system_time;
1180
1181 /* Iterator counters */
1182 int32_t frame_offset;
1183
1184 /* Misc */
1185 ecs_flags32_t flags;
1186 ecs_entity_t interrupted_by;
1187 ecs_iter_private_t priv_;
1188
1189 /* Chained iterators */
1190 ecs_iter_next_action_t next;
1191 ecs_iter_action_t callback;
1192 ecs_iter_fini_action_t fini;
1193 ecs_iter_t *chain_it;
1194};
1195
1196
1201#define EcsQueryMatchPrefab (1u << 1u)
1202
1207#define EcsQueryMatchDisabled (1u << 2u)
1208
1213#define EcsQueryMatchEmptyTables (1u << 3u)
1214
1219#define EcsQueryAllowUnresolvedByName (1u << 6u)
1220
1225#define EcsQueryTableOnly (1u << 7u)
1226
1237#define EcsQueryDetectChanges (1u << 8u)
1238
1239
1244 typedef struct ecs_query_desc_t {
1246 int32_t _canary;
1247
1249 ecs_term_t terms[FLECS_TERM_COUNT_MAX];
1250
1252 const char *expr;
1253
1255 ecs_query_cache_kind_t cache_kind;
1256
1258 ecs_flags32_t flags;
1259
1263 ecs_order_by_action_t order_by_callback;
1264
1267 ecs_sort_table_action_t order_by_table_callback;
1268
1271 ecs_entity_t order_by;
1272
1275 ecs_id_t group_by;
1276
1282 ecs_group_by_action_t group_by_callback;
1283
1286 ecs_group_create_action_t on_group_create;
1287
1290 ecs_group_delete_action_t on_group_delete;
1291
1293 void *group_by_ctx;
1294
1296 ecs_ctx_free_t group_by_ctx_free;
1297
1299 void *ctx;
1300
1302 void *binding_ctx;
1303
1305 ecs_ctx_free_t ctx_free;
1306
1308 ecs_ctx_free_t binding_ctx_free;
1309
1311 ecs_entity_t entity;
1312} ecs_query_desc_t;
1313
1318 typedef struct ecs_observer_desc_t {
1320 int32_t _canary;
1321
1323 ecs_entity_t entity;
1324
1326 ecs_query_desc_t query;
1327
1329 ecs_entity_t events[FLECS_EVENT_DESC_MAX];
1330
1333 bool yield_existing;
1334
1336 ecs_iter_action_t callback;
1337
1344 ecs_run_action_t run;
1345
1347 void *ctx;
1348
1350 ecs_ctx_free_t ctx_free;
1351
1353 void *callback_ctx;
1354
1356 ecs_ctx_free_t callback_ctx_free;
1357
1359 void *run_ctx;
1360
1362 ecs_ctx_free_t run_ctx_free;
1363
1365 ecs_poly_t *observable;
1366
1369 int32_t *last_event_id;
1370
1372 int8_t term_index_;
1373 ecs_flags32_t flags_;
1374} ecs_observer_desc_t;
1375
1380 typedef struct ecs_event_desc_t {
1382 ecs_entity_t event;
1383
1387 const ecs_type_t *ids;
1388
1390 ecs_table_t *table;
1391
1394 ecs_table_t *other_table;
1395
1397 int32_t offset;
1398
1402 int32_t count;
1403
1405 ecs_entity_t entity;
1406
1411 void *param;
1412
1416 const void *const_param;
1417
1419 ecs_poly_t *observable;
1420
1422 ecs_flags32_t flags;
1423} ecs_event_desc_t;
1424
1425
1432
1434 typedef struct ecs_build_info_t {
1435 const char *compiler;
1436 const char **addons;
1437 const char *version;
1438 int16_t version_major;
1439 int16_t version_minor;
1440 int16_t version_patch;
1441 bool debug;
1442 bool sanitize;
1443 bool perf_trace;
1444} ecs_build_info_t;
1445
1447 typedef struct ecs_world_info_t {
1448 ecs_entity_t last_component_id;
1449 ecs_entity_t min_id;
1450 ecs_entity_t max_id;
1451
1452 ecs_ftime_t delta_time_raw;
1453 ecs_ftime_t delta_time;
1454 ecs_ftime_t time_scale;
1455 ecs_ftime_t target_fps;
1456 ecs_ftime_t frame_time_total;
1457 ecs_ftime_t system_time_total;
1458 ecs_ftime_t emit_time_total;
1459 ecs_ftime_t merge_time_total;
1460 ecs_ftime_t rematch_time_total;
1461 double world_time_total;
1462 double world_time_total_raw;
1463
1464 int64_t frame_count_total;
1465 int64_t merge_count_total;
1466 int64_t eval_comp_monitors_total;
1467 int64_t rematch_count_total;
1468
1469 int64_t id_create_total;
1470 int64_t id_delete_total;
1471 int64_t table_create_total;
1472 int64_t table_delete_total;
1473 int64_t pipeline_build_count_total;
1474 int64_t systems_ran_frame;
1475 int64_t observers_ran_frame;
1476
1477 int32_t tag_id_count;
1478 int32_t component_id_count;
1479 int32_t pair_id_count;
1480
1481 int32_t table_count;
1482
1483 /* -- Command counts -- */
1484 struct {
1485 int64_t add_count;
1486 int64_t remove_count;
1487 int64_t delete_count;
1488 int64_t clear_count;
1489 int64_t set_count;
1490 int64_t ensure_count;
1491 int64_t modified_count;
1492 int64_t discard_count;
1493 int64_t event_count;
1494 int64_t other_count;
1495 int64_t batched_entity_count;
1496 int64_t batched_command_count;
1497 } cmd;
1498
1499 const char *name_prefix;
1503} ecs_world_info_t;
1504
1506 typedef struct ecs_query_group_info_t {
1507 uint64_t id;
1508 int32_t match_count;
1509 int32_t table_count;
1510 void *ctx;
1511} ecs_query_group_info_t;
1512
1514
1521
1523 typedef struct EcsIdentifier {
1524 char *value;
1525 ecs_size_t length;
1526 uint64_t hash;
1527 uint64_t index_hash;
1528 ecs_hashmap_t *index;
1529} EcsIdentifier;
1530
1532 typedef struct EcsComponent {
1533 ecs_size_t size;
1534 ecs_size_t alignment;
1535} EcsComponent;
1536
1538 typedef struct EcsPoly {
1539 ecs_poly_t *poly;
1540} EcsPoly;
1541
1547 typedef struct EcsDefaultChildComponent {
1548 ecs_id_t component;
1549} EcsDefaultChildComponent;
1550
1553
1554/* Only include deprecated definitions if deprecated addon is required */
1555#ifdef FLECS_DEPRECATED
1556#include "flecs/addons/deprecated.h"
1557#endif
1558
1565
1572
1574FLECS_API extern const ecs_id_t ECS_PAIR;
1575
1577FLECS_API extern const ecs_id_t ECS_AUTO_OVERRIDE;
1578
1580FLECS_API extern const ecs_id_t ECS_TOGGLE;
1581
1583
1588
1589/* Builtin component ids */
1590
1592FLECS_API extern const ecs_entity_t ecs_id(EcsComponent);
1593
1595FLECS_API extern const ecs_entity_t ecs_id(EcsIdentifier);
1596
1598FLECS_API extern const ecs_entity_t ecs_id(EcsPoly);
1599
1601FLECS_API extern const ecs_entity_t ecs_id(EcsDefaultChildComponent);
1602
1604FLECS_API extern const ecs_entity_t EcsQuery;
1605
1607FLECS_API extern const ecs_entity_t EcsObserver;
1608
1610FLECS_API extern const ecs_entity_t EcsSystem;
1611
1613FLECS_API extern const ecs_entity_t ecs_id(EcsTickSource);
1614
1616FLECS_API extern const ecs_entity_t ecs_id(EcsPipelineQuery);
1617
1619FLECS_API extern const ecs_entity_t ecs_id(EcsTimer);
1620
1622FLECS_API extern const ecs_entity_t ecs_id(EcsRateFilter);
1623
1625FLECS_API extern const ecs_entity_t EcsFlecs;
1626
1628FLECS_API extern const ecs_entity_t EcsFlecsCore;
1629
1631FLECS_API extern const ecs_entity_t EcsWorld;
1632
1634FLECS_API extern const ecs_entity_t EcsWildcard;
1635
1637FLECS_API extern const ecs_entity_t EcsAny;
1638
1640FLECS_API extern const ecs_entity_t EcsThis;
1641
1643FLECS_API extern const ecs_entity_t EcsVariable;
1644
1646#define EcsSingleton EcsVariable
1647
1655FLECS_API extern const ecs_entity_t EcsTransitive;
1656
1664FLECS_API extern const ecs_entity_t EcsReflexive;
1665
1676FLECS_API extern const ecs_entity_t EcsFinal;
1677
1683FLECS_API extern const ecs_entity_t EcsInheritable;
1684
1686FLECS_API extern const ecs_entity_t EcsOnInstantiate;
1687
1691FLECS_API extern const ecs_entity_t EcsOverride;
1692
1696FLECS_API extern const ecs_entity_t EcsInherit;
1697
1702FLECS_API extern const ecs_entity_t EcsDontInherit;
1703
1711FLECS_API extern const ecs_entity_t EcsSymmetric;
1712
1722FLECS_API extern const ecs_entity_t EcsExclusive;
1723
1725FLECS_API extern const ecs_entity_t EcsAcyclic;
1726
1729FLECS_API extern const ecs_entity_t EcsTraversable;
1730
1740FLECS_API extern const ecs_entity_t EcsWith;
1741
1751FLECS_API extern const ecs_entity_t EcsOneOf;
1752
1754FLECS_API extern const ecs_entity_t EcsCanToggle;
1755
1759FLECS_API extern const ecs_entity_t EcsTrait;
1760
1770FLECS_API extern const ecs_entity_t EcsRelationship;
1771
1781FLECS_API extern const ecs_entity_t EcsTarget;
1782
1785FLECS_API extern const ecs_entity_t EcsPairIsTag;
1786
1788FLECS_API extern const ecs_entity_t EcsName;
1789
1791FLECS_API extern const ecs_entity_t EcsSymbol;
1792
1794FLECS_API extern const ecs_entity_t EcsAlias;
1795
1797FLECS_API extern const ecs_entity_t EcsChildOf;
1798
1800FLECS_API extern const ecs_entity_t EcsIsA;
1801
1803FLECS_API extern const ecs_entity_t EcsDependsOn;
1804
1806FLECS_API extern const ecs_entity_t EcsSlotOf;
1807
1809FLECS_API extern const ecs_entity_t EcsOrderedChildren;
1810
1812FLECS_API extern const ecs_entity_t EcsModule;
1813
1815FLECS_API extern const ecs_entity_t EcsPrivate;
1816
1819FLECS_API extern const ecs_entity_t EcsPrefab;
1820
1823FLECS_API extern const ecs_entity_t EcsDisabled;
1824
1828FLECS_API extern const ecs_entity_t EcsNotQueryable;
1829
1831FLECS_API extern const ecs_entity_t EcsOnAdd;
1832
1834FLECS_API extern const ecs_entity_t EcsOnRemove;
1835
1837FLECS_API extern const ecs_entity_t EcsOnSet;
1838
1840FLECS_API extern const ecs_entity_t EcsMonitor;
1841
1843FLECS_API extern const ecs_entity_t EcsOnTableCreate;
1844
1846FLECS_API extern const ecs_entity_t EcsOnTableDelete;
1847
1849FLECS_API extern const ecs_entity_t EcsOnDelete;
1850
1853FLECS_API extern const ecs_entity_t EcsOnDeleteTarget;
1854
1857FLECS_API extern const ecs_entity_t EcsRemove;
1858
1861FLECS_API extern const ecs_entity_t EcsDelete;
1862
1865FLECS_API extern const ecs_entity_t EcsPanic;
1866
1868FLECS_API extern const ecs_entity_t EcsSparse;
1869
1871FLECS_API extern const ecs_entity_t EcsDontFragment;
1872
1874FLECS_API extern const ecs_entity_t EcsPredEq;
1875
1877FLECS_API extern const ecs_entity_t EcsPredMatch;
1878
1880FLECS_API extern const ecs_entity_t EcsPredLookup;
1881
1883FLECS_API extern const ecs_entity_t EcsScopeOpen;
1884
1886FLECS_API extern const ecs_entity_t EcsScopeClose;
1887
1892FLECS_API extern const ecs_entity_t EcsEmpty;
1893
1894FLECS_API extern const ecs_entity_t ecs_id(EcsPipeline);
1895FLECS_API extern const ecs_entity_t EcsOnStart;
1896FLECS_API extern const ecs_entity_t EcsPreFrame;
1897FLECS_API extern const ecs_entity_t EcsOnLoad;
1898FLECS_API extern const ecs_entity_t EcsPostLoad;
1899FLECS_API extern const ecs_entity_t EcsPreUpdate;
1900FLECS_API extern const ecs_entity_t EcsOnUpdate;
1901FLECS_API extern const ecs_entity_t EcsOnValidate;
1902FLECS_API extern const ecs_entity_t EcsPostUpdate;
1903FLECS_API extern const ecs_entity_t EcsPreStore;
1904FLECS_API extern const ecs_entity_t EcsOnStore;
1905FLECS_API extern const ecs_entity_t EcsPostFrame;
1906FLECS_API extern const ecs_entity_t EcsPhase;
1907
1908FLECS_API extern const ecs_entity_t EcsConstant;
1909
1912#define EcsLastInternalComponentId (ecs_id(EcsPoly))
1913
1916#define EcsFirstUserComponentId (8)
1917
1920#define EcsFirstUserEntityId (FLECS_HI_COMPONENT_ID + 128)
1921
1922/* When visualized the reserved id ranges look like this:
1923 * - [1..8]: Builtin components
1924 * - [9..FLECS_HI_COMPONENT_ID]: Low ids reserved for application components
1925 * - [FLECS_HI_COMPONENT_ID + 1..EcsFirstUserEntityId]: Builtin entities
1926 */
1927
1930
1937
1942
1949FLECS_API
1950 ecs_world_t* ecs_init(void);
1951
1958FLECS_API
1959 ecs_world_t* ecs_mini(void);
1960
1968FLECS_API
1969 ecs_world_t* ecs_init_w_args(
1970 int argc,
1971 char *argv[]);
1972
1979FLECS_API
1980 int ecs_fini(
1981 ecs_world_t *world);
1982
1990FLECS_API
1991 bool ecs_is_fini(
1992 const ecs_world_t *world);
1993
2001FLECS_API
2002 void ecs_atfini(
2003 ecs_world_t *world,
2004 ecs_fini_action_t action,
2005 void *ctx);
2006
2008 typedef struct ecs_entities_t {
2009 const ecs_entity_t *ids;
2010 int32_t count;
2011 int32_t alive_count;
2012} ecs_entities_t;
2013
2040FLECS_API
2041 ecs_entities_t ecs_get_entities(
2042 const ecs_world_t *world);
2043
2051FLECS_API
2052ecs_flags32_t ecs_world_get_flags(
2053 const ecs_world_t *world);
2054
2056
2061
2080FLECS_API
2081 ecs_ftime_t ecs_frame_begin(
2082 ecs_world_t *world,
2083 ecs_ftime_t delta_time);
2084
2091FLECS_API
2092 void ecs_frame_end(
2093 ecs_world_t *world);
2094
2102FLECS_API
2103 void ecs_run_post_frame(
2104 ecs_world_t *world,
2105 ecs_fini_action_t action,
2106 void *ctx);
2107
2114FLECS_API
2115 void ecs_quit(
2116 ecs_world_t *world);
2117
2124FLECS_API
2125 bool ecs_should_quit(
2126 const ecs_world_t *world);
2127
2139FLECS_API void ecs_measure_frame_time(
2140 ecs_world_t *world,
2141 bool enable);
2142
2153FLECS_API void ecs_measure_system_time(
2154 ecs_world_t *world,
2155 bool enable);
2156
2172FLECS_API
2173 void ecs_set_target_fps(
2174 ecs_world_t *world,
2175 ecs_ftime_t fps);
2176
2190FLECS_API
2191 void ecs_set_default_query_flags(
2192 ecs_world_t *world,
2193 ecs_flags32_t flags);
2194
2196
2201
2271FLECS_API
2272 bool ecs_readonly_begin(
2273 ecs_world_t *world,
2274 bool multi_threaded);
2275
2283FLECS_API
2284 void ecs_readonly_end(
2285 ecs_world_t *world);
2286
2297FLECS_API
2298 void ecs_merge(
2299 ecs_world_t *world);
2300
2316FLECS_API
2317 bool ecs_defer_begin(
2318 ecs_world_t *world);
2319
2330FLECS_API
2331 bool ecs_is_deferred(
2332 const ecs_world_t *world);
2333
2347FLECS_API
2348 bool ecs_defer_end(
2349 ecs_world_t *world);
2350
2365FLECS_API
2366 void ecs_defer_suspend(
2367 ecs_world_t *world);
2368
2379FLECS_API
2380 void ecs_defer_resume(
2381 ecs_world_t *world);
2382
2396FLECS_API
2397 void ecs_set_stage_count(
2398 ecs_world_t *world,
2399 int32_t stages);
2400
2407FLECS_API
2408int32_t ecs_get_stage_count(
2409 const ecs_world_t *world);
2410
2426FLECS_API
2427 ecs_world_t* ecs_get_stage(
2428 const ecs_world_t *world,
2429 int32_t stage_id);
2430
2438FLECS_API
2439 bool ecs_stage_is_readonly(
2440 const ecs_world_t *world);
2441
2449FLECS_API
2450 ecs_world_t* ecs_stage_new(
2451 ecs_world_t *world);
2452
2457FLECS_API
2458 void ecs_stage_free(
2459 ecs_world_t *stage);
2460
2468FLECS_API
2469int32_t ecs_stage_get_id(
2470 const ecs_world_t *world);
2471
2473
2478
2487FLECS_API
2488 void ecs_set_ctx(
2489 ecs_world_t *world,
2490 void *ctx,
2491 ecs_ctx_free_t ctx_free);
2492
2501FLECS_API
2502 void ecs_set_binding_ctx(
2503 ecs_world_t *world,
2504 void *ctx,
2505 ecs_ctx_free_t ctx_free);
2506
2514FLECS_API
2515 void* ecs_get_ctx(
2516 const ecs_world_t *world);
2517
2525FLECS_API
2526 void* ecs_get_binding_ctx(
2527 const ecs_world_t *world);
2528
2534FLECS_API
2535 const ecs_build_info_t* ecs_get_build_info(void);
2536
2542FLECS_API
2543 const ecs_world_info_t* ecs_get_world_info(
2544 const ecs_world_t *world);
2545
2554FLECS_API
2555 void ecs_dim(
2556 ecs_world_t *world,
2557 int32_t entity_count);
2558
2573FLECS_API
2574 void ecs_shrink(
2575 ecs_world_t *world);
2576
2592FLECS_API
2593 void ecs_set_entity_range(
2594 ecs_world_t *world,
2595 ecs_entity_t id_start,
2596 ecs_entity_t id_end);
2597
2608FLECS_API
2609 bool ecs_enable_range_check(
2610 ecs_world_t *world,
2611 bool enable);
2612
2618FLECS_API
2619 ecs_entity_t ecs_get_max_id(
2620 const ecs_world_t *world);
2621
2635FLECS_API
2636 void ecs_run_aperiodic(
2637 ecs_world_t *world,
2638 ecs_flags32_t flags);
2639
2641 typedef struct ecs_delete_empty_tables_desc_t {
2643 uint16_t clear_generation;
2644
2646 uint16_t delete_generation;
2647
2649 double time_budget_seconds;
2650} ecs_delete_empty_tables_desc_t;
2651
2681FLECS_API
2682int32_t ecs_delete_empty_tables(
2683 ecs_world_t *world,
2684 const ecs_delete_empty_tables_desc_t *desc);
2685
2691FLECS_API
2692 const ecs_world_t* ecs_get_world(
2693 const ecs_poly_t *poly);
2694
2700FLECS_API
2701 ecs_entity_t ecs_get_entity(
2702 const ecs_poly_t *poly);
2703
2717FLECS_API
2718 bool flecs_poly_is_(
2719 const ecs_poly_t *object,
2720 int32_t type);
2721
2725#define flecs_poly_is(object, type)\
2726 flecs_poly_is_(object, type##_magic)
2727
2736FLECS_API
2737 ecs_id_t ecs_make_pair(
2738 ecs_entity_t first,
2739 ecs_entity_t second);
2740
2763FLECS_API
2764 void ecs_exclusive_access_begin(
2765 ecs_world_t *world,
2766 const char *thread_name);
2767
2790FLECS_API
2791 void ecs_exclusive_access_end(
2792 ecs_world_t *world,
2793 bool lock_world);
2794
2796
2798
2805
2812
2821FLECS_API
2822 ecs_entity_t ecs_new(
2823 ecs_world_t *world);
2824
2842FLECS_API
2843 ecs_entity_t ecs_new_low_id(
2844 ecs_world_t *world);
2845
2854FLECS_API
2855 ecs_entity_t ecs_new_w_id(
2856 ecs_world_t *world,
2857 ecs_id_t id);
2858
2866FLECS_API
2867 ecs_entity_t ecs_new_w_table(
2868 ecs_world_t *world,
2869 ecs_table_t *table);
2870
2889FLECS_API
2890 ecs_entity_t ecs_entity_init(
2891 ecs_world_t *world,
2892 const ecs_entity_desc_t *desc);
2893
2920FLECS_API
2921 const ecs_entity_t* ecs_bulk_init(
2922 ecs_world_t *world,
2923 const ecs_bulk_desc_t *desc);
2924
2934FLECS_API
2935 const ecs_entity_t* ecs_bulk_new_w_id(
2936 ecs_world_t *world,
2937 ecs_id_t id,
2938 int32_t count);
2939
2955FLECS_API
2956 ecs_entity_t ecs_clone(
2957 ecs_world_t *world,
2958 ecs_entity_t dst,
2959 ecs_entity_t src,
2960 bool copy_value);
2961
2970FLECS_API
2971 void ecs_delete(
2972 ecs_world_t *world,
2973 ecs_entity_t entity);
2974
2982FLECS_API
2983 void ecs_delete_with(
2984 ecs_world_t *world,
2985 ecs_id_t id);
2986
3004FLECS_API
3005 void ecs_set_child_order(
3006 ecs_world_t *world,
3007 ecs_entity_t parent,
3008 const ecs_entity_t *children,
3009 int32_t child_count);
3010
3020FLECS_API
3021 ecs_entities_t ecs_get_ordered_children(
3022 const ecs_world_t *world,
3023 ecs_entity_t parent);
3024
3026
3033
3042FLECS_API
3043 void ecs_add_id(
3044 ecs_world_t *world,
3045 ecs_entity_t entity,
3046 ecs_id_t id);
3047
3056FLECS_API
3057 void ecs_remove_id(
3058 ecs_world_t *world,
3059 ecs_entity_t entity,
3060 ecs_id_t id);
3061
3113FLECS_API
3114 void ecs_auto_override_id(
3115 ecs_world_t *world,
3116 ecs_entity_t entity,
3117 ecs_id_t id);
3118
3125FLECS_API
3126 void ecs_clear(
3127 ecs_world_t *world,
3128 ecs_entity_t entity);
3129
3137FLECS_API
3138 void ecs_remove_all(
3139 ecs_world_t *world,
3140 ecs_id_t id);
3141
3149FLECS_API
3150 ecs_entity_t ecs_set_with(
3151 ecs_world_t *world,
3152 ecs_id_t id);
3153
3160FLECS_API
3161 ecs_id_t ecs_get_with(
3162 const ecs_world_t *world);
3163
3165
3172
3182FLECS_API
3183 void ecs_enable(
3184 ecs_world_t *world,
3185 ecs_entity_t entity,
3186 bool enabled);
3187
3201FLECS_API
3202 void ecs_enable_id(
3203 ecs_world_t *world,
3204 ecs_entity_t entity,
3205 ecs_id_t id,
3206 bool enable);
3207
3218FLECS_API
3219 bool ecs_is_enabled_id(
3220 const ecs_world_t *world,
3221 ecs_entity_t entity,
3222 ecs_id_t id);
3223
3225
3232
3247FLECS_API
3248FLECS_ALWAYS_INLINE const void* ecs_get_id(
3249 const ecs_world_t *world,
3250 ecs_entity_t entity,
3251 ecs_id_t id);
3252
3264FLECS_API
3265FLECS_ALWAYS_INLINE void* ecs_get_mut_id(
3266 const ecs_world_t *world,
3267 ecs_entity_t entity,
3268 ecs_id_t id);
3269
3287FLECS_API
3288 void* ecs_ensure_id(
3289 ecs_world_t *world,
3290 ecs_entity_t entity,
3291 ecs_id_t id);
3292
3304FLECS_API
3305 void* ecs_ensure_modified_id(
3306 ecs_world_t *world,
3307 ecs_entity_t entity,
3308 ecs_id_t id);
3309
3321FLECS_API
3322 void* ecs_get_mut_modified_id(
3323 ecs_world_t *world,
3324 ecs_entity_t entity,
3325 ecs_id_t id);
3326
3337FLECS_API
3338 ecs_ref_t ecs_ref_init_id(
3339 const ecs_world_t *world,
3340 ecs_entity_t entity,
3341 ecs_id_t id);
3342
3351FLECS_API
3352 void* ecs_ref_get_id(
3353 const ecs_world_t *world,
3354 ecs_ref_t *ref,
3355 ecs_id_t id);
3356
3364FLECS_API
3365 void ecs_ref_update(
3366 const ecs_world_t *world,
3367 ecs_ref_t *ref);
3368
3388FLECS_API
3389 void* ecs_emplace_id(
3390 ecs_world_t *world,
3391 ecs_entity_t entity,
3392 ecs_id_t id,
3393 bool *is_new);
3394
3404FLECS_API
3405 void ecs_modified_id(
3406 ecs_world_t *world,
3407 ecs_entity_t entity,
3408 ecs_id_t id);
3409
3425FLECS_API
3426 void ecs_set_id(
3427 ecs_world_t *world,
3428 ecs_entity_t entity,
3429 ecs_id_t id,
3430 size_t size,
3431 const void *ptr);
3432
3434
3441
3460FLECS_API
3461 bool ecs_is_valid(
3462 const ecs_world_t *world,
3463 ecs_entity_t e);
3464
3490FLECS_API
3491 bool ecs_is_alive(
3492 const ecs_world_t *world,
3493 ecs_entity_t e);
3494
3500FLECS_API
3501 ecs_id_t ecs_strip_generation(
3502 ecs_entity_t e);
3503
3520FLECS_API
3521 ecs_entity_t ecs_get_alive(
3522 const ecs_world_t *world,
3523 ecs_entity_t e);
3524
3547FLECS_API
3548 void ecs_make_alive(
3549 ecs_world_t *world,
3550 ecs_entity_t entity);
3551
3570FLECS_API
3571 void ecs_make_alive_id(
3572 ecs_world_t *world,
3573 ecs_id_t id);
3574
3582FLECS_API
3583 bool ecs_exists(
3584 const ecs_world_t *world,
3585 ecs_entity_t entity);
3586
3601FLECS_API
3602 void ecs_set_version(
3603 ecs_world_t *world,
3604 ecs_entity_t entity);
3605
3607
3614
3621FLECS_API
3622 const ecs_type_t* ecs_get_type(
3623 const ecs_world_t *world,
3624 ecs_entity_t entity);
3625
3632FLECS_API
3633 ecs_table_t* ecs_get_table(
3634 const ecs_world_t *world,
3635 ecs_entity_t entity);
3636
3644FLECS_API
3645 char* ecs_type_str(
3646 const ecs_world_t *world,
3647 const ecs_type_t* type);
3648
3660FLECS_API
3661 char* ecs_table_str(
3662 const ecs_world_t *world,
3663 const ecs_table_t *table);
3664
3679FLECS_API
3680 char* ecs_entity_str(
3681 const ecs_world_t *world,
3682 ecs_entity_t entity);
3683
3694FLECS_API
3695FLECS_ALWAYS_INLINE bool ecs_has_id(
3696 const ecs_world_t *world,
3697 ecs_entity_t entity,
3698 ecs_id_t id);
3699
3710FLECS_API
3711FLECS_ALWAYS_INLINE bool ecs_owns_id(
3712 const ecs_world_t *world,
3713 ecs_entity_t entity,
3714 ecs_id_t id);
3715
3730FLECS_API
3731 ecs_entity_t ecs_get_target(
3732 const ecs_world_t *world,
3733 ecs_entity_t entity,
3734 ecs_entity_t rel,
3735 int32_t index);
3736
3750FLECS_API
3751 ecs_entity_t ecs_get_parent(
3752 const ecs_world_t *world,
3753 ecs_entity_t entity);
3754
3775FLECS_API
3776 ecs_entity_t ecs_get_target_for_id(
3777 const ecs_world_t *world,
3778 ecs_entity_t entity,
3779 ecs_entity_t rel,
3780 ecs_id_t id);
3781
3792FLECS_API
3793int32_t ecs_get_depth(
3794 const ecs_world_t *world,
3795 ecs_entity_t entity,
3796 ecs_entity_t rel);
3797
3805FLECS_API
3806int32_t ecs_count_id(
3807 const ecs_world_t *world,
3808 ecs_id_t entity);
3809
3811
3812
3819
3829FLECS_API
3830 const char* ecs_get_name(
3831 const ecs_world_t *world,
3832 ecs_entity_t entity);
3833
3843FLECS_API
3844 const char* ecs_get_symbol(
3845 const ecs_world_t *world,
3846 ecs_entity_t entity);
3847
3861FLECS_API
3862 ecs_entity_t ecs_set_name(
3863 ecs_world_t *world,
3864 ecs_entity_t entity,
3865 const char *name);
3866
3880FLECS_API
3881 ecs_entity_t ecs_set_symbol(
3882 ecs_world_t *world,
3883 ecs_entity_t entity,
3884 const char *symbol);
3885
3897FLECS_API
3898 void ecs_set_alias(
3899 ecs_world_t *world,
3900 ecs_entity_t entity,
3901 const char *alias);
3902
3918FLECS_API
3919 ecs_entity_t ecs_lookup(
3920 const ecs_world_t *world,
3921 const char *path);
3922
3937FLECS_API
3938 ecs_entity_t ecs_lookup_child(
3939 const ecs_world_t *world,
3940 ecs_entity_t parent,
3941 const char *name);
3942
3965FLECS_API
3966 ecs_entity_t ecs_lookup_path_w_sep(
3967 const ecs_world_t *world,
3968 ecs_entity_t parent,
3969 const char *path,
3970 const char *sep,
3971 const char *prefix,
3972 bool recursive);
3973
3991FLECS_API
3992 ecs_entity_t ecs_lookup_symbol(
3993 const ecs_world_t *world,
3994 const char *symbol,
3995 bool lookup_as_path,
3996 bool recursive);
3997
4019FLECS_API
4020 char* ecs_get_path_w_sep(
4021 const ecs_world_t *world,
4022 ecs_entity_t parent,
4023 ecs_entity_t child,
4024 const char *sep,
4025 const char *prefix);
4026
4039FLECS_API
4040 void ecs_get_path_w_sep_buf(
4041 const ecs_world_t *world,
4042 ecs_entity_t parent,
4043 ecs_entity_t child,
4044 const char *sep,
4045 const char *prefix,
4046 ecs_strbuf_t *buf,
4047 bool escape);
4048
4064FLECS_API
4065 ecs_entity_t ecs_new_from_path_w_sep(
4066 ecs_world_t *world,
4067 ecs_entity_t parent,
4068 const char *path,
4069 const char *sep,
4070 const char *prefix);
4071
4086FLECS_API
4087 ecs_entity_t ecs_add_path_w_sep(
4088 ecs_world_t *world,
4089 ecs_entity_t entity,
4090 ecs_entity_t parent,
4091 const char *path,
4092 const char *sep,
4093 const char *prefix);
4094
4108FLECS_API
4109 ecs_entity_t ecs_set_scope(
4110 ecs_world_t *world,
4111 ecs_entity_t scope);
4112
4120FLECS_API
4121 ecs_entity_t ecs_get_scope(
4122 const ecs_world_t *world);
4123
4133FLECS_API
4134 const char* ecs_set_name_prefix(
4135 ecs_world_t *world,
4136 const char *prefix);
4137
4164FLECS_API
4165 ecs_entity_t* ecs_set_lookup_path(
4166 ecs_world_t *world,
4167 const ecs_entity_t *lookup_path);
4168
4175FLECS_API
4176 ecs_entity_t* ecs_get_lookup_path(
4177 const ecs_world_t *world);
4178
4180
4182
4189
4203FLECS_API
4204 ecs_entity_t ecs_component_init(
4205 ecs_world_t *world,
4206 const ecs_component_desc_t *desc);
4207
4217FLECS_API
4218 const ecs_type_info_t* ecs_get_type_info(
4219 const ecs_world_t *world,
4220 ecs_id_t id);
4221
4233FLECS_API
4234 void ecs_set_hooks_id(
4235 ecs_world_t *world,
4236 ecs_entity_t id,
4237 const ecs_type_hooks_t *hooks);
4238
4245FLECS_API
4246 const ecs_type_hooks_t* ecs_get_hooks_id(
4247 const ecs_world_t *world,
4248 ecs_entity_t id);
4249
4251
4258
4273FLECS_API
4274 bool ecs_id_is_tag(
4275 const ecs_world_t *world,
4276 ecs_id_t id);
4277
4286FLECS_API
4287 bool ecs_id_in_use(
4288 const ecs_world_t *world,
4289 ecs_id_t id);
4290
4310FLECS_API
4311 ecs_entity_t ecs_get_typeid(
4312 const ecs_world_t *world,
4313 ecs_id_t id);
4314
4323FLECS_API
4324 bool ecs_id_match(
4325 ecs_id_t id,
4326 ecs_id_t pattern);
4327
4333FLECS_API
4334 bool ecs_id_is_pair(
4335 ecs_id_t id);
4336
4342FLECS_API
4343 bool ecs_id_is_wildcard(
4344 ecs_id_t id);
4345
4351 bool ecs_id_is_any(
4352 ecs_id_t id);
4353
4367FLECS_API
4368 bool ecs_id_is_valid(
4369 const ecs_world_t *world,
4370 ecs_id_t id);
4371
4380FLECS_API
4381ecs_flags32_t ecs_id_get_flags(
4382 const ecs_world_t *world,
4383 ecs_id_t id);
4384
4391FLECS_API
4392 const char* ecs_id_flag_str(
4393 ecs_id_t id_flags);
4394
4402FLECS_API
4403 char* ecs_id_str(
4404 const ecs_world_t *world,
4405 ecs_id_t id);
4406
4414FLECS_API
4415 void ecs_id_str_buf(
4416 const ecs_world_t *world,
4417 ecs_id_t id,
4418 ecs_strbuf_t *buf);
4419
4427FLECS_API
4428 ecs_id_t ecs_id_from_str(
4429 const ecs_world_t *world,
4430 const char *expr);
4431
4433
4439
4445FLECS_API
4446 bool ecs_term_ref_is_set(
4447 const ecs_term_ref_t *id);
4448
4460FLECS_API
4461 bool ecs_term_is_initialized(
4462 const ecs_term_t *term);
4463
4478FLECS_API
4479 bool ecs_term_match_this(
4480 const ecs_term_t *term);
4481
4494FLECS_API
4495 bool ecs_term_match_0(
4496 const ecs_term_t *term);
4497
4506FLECS_API
4507 char* ecs_term_str(
4508 const ecs_world_t *world,
4509 const ecs_term_t *term);
4510
4518FLECS_API
4519 char* ecs_query_str(
4520 const ecs_query_t *query);
4521
4523
4529
4562FLECS_API
4563 ecs_iter_t ecs_each_id(
4564 const ecs_world_t *world,
4565 ecs_id_t id);
4566
4572FLECS_API
4573 bool ecs_each_next(
4574 ecs_iter_t *it);
4575
4592FLECS_API
4593 ecs_iter_t ecs_children(
4594 const ecs_world_t *world,
4595 ecs_entity_t parent);
4596
4602FLECS_API
4603 bool ecs_children_next(
4604 ecs_iter_t *it);
4605
4607
4614
4621FLECS_API
4622 ecs_query_t* ecs_query_init(
4623 ecs_world_t *world,
4624 const ecs_query_desc_t *desc);
4625
4630FLECS_API
4631 void ecs_query_fini(
4632 ecs_query_t *query);
4633
4642FLECS_API
4643int32_t ecs_query_find_var(
4644 const ecs_query_t *query,
4645 const char *name);
4646
4654FLECS_API
4655 const char* ecs_query_var_name(
4656 const ecs_query_t *query,
4657 int32_t var_id);
4658
4669FLECS_API
4670 bool ecs_query_var_is_entity(
4671 const ecs_query_t *query,
4672 int32_t var_id);
4673
4742FLECS_API
4743 ecs_iter_t ecs_query_iter(
4744 const ecs_world_t *world,
4745 const ecs_query_t *query);
4746
4754FLECS_API
4755 bool ecs_query_next(
4756 ecs_iter_t *it);
4757
4776FLECS_API
4777 bool ecs_query_has(
4778 ecs_query_t *query,
4779 ecs_entity_t entity,
4780 ecs_iter_t *it);
4781
4800FLECS_API
4801 bool ecs_query_has_table(
4802 ecs_query_t *query,
4803 ecs_table_t *table,
4804 ecs_iter_t *it);
4805
4832FLECS_API
4833 bool ecs_query_has_range(
4834 ecs_query_t *query,
4835 ecs_table_range_t *range,
4836 ecs_iter_t *it);
4837
4845FLECS_API
4846int32_t ecs_query_match_count(
4847 const ecs_query_t *query);
4848
4858FLECS_API
4859 char* ecs_query_plan(
4860 const ecs_query_t *query);
4861
4876FLECS_API
4877 char* ecs_query_plan_w_profile(
4878 const ecs_query_t *query,
4879 const ecs_iter_t *it);
4880
4898FLECS_API
4899 const char* ecs_query_args_parse(
4900 ecs_query_t *query,
4901 ecs_iter_t *it,
4902 const char *expr);
4903
4931FLECS_API
4932 bool ecs_query_changed(
4933 ecs_query_t *query);
4934
4943FLECS_API
4944 const ecs_query_t* ecs_query_get(
4945 const ecs_world_t *world,
4946 ecs_entity_t query);
4947
4958FLECS_API
4959 void ecs_iter_skip(
4960 ecs_iter_t *it);
4961
4984FLECS_API
4985 void ecs_iter_set_group(
4986 ecs_iter_t *it,
4987 uint64_t group_id);
4988
4997FLECS_API
4998 void* ecs_query_get_group_ctx(
4999 const ecs_query_t *query,
5000 uint64_t group_id);
5001
5010FLECS_API
5011 const ecs_query_group_info_t* ecs_query_get_group_info(
5012 const ecs_query_t *query,
5013 uint64_t group_id);
5014
5016 typedef struct ecs_query_count_t {
5017 int32_t results;
5018 int32_t entities;
5019 int32_t tables;
5022} ecs_query_count_t;
5023
5030FLECS_API
5031 ecs_query_count_t ecs_query_count(
5032 const ecs_query_t *query);
5033
5039FLECS_API
5040 bool ecs_query_is_true(
5041 const ecs_query_t *query);
5042
5051FLECS_API
5052 const ecs_query_t* ecs_query_get_cache_query(
5053 const ecs_query_t *query);
5054
5056
5063
5083FLECS_API
5084 void ecs_emit(
5085 ecs_world_t *world,
5086 ecs_event_desc_t *desc);
5087
5098FLECS_API
5099 void ecs_enqueue(
5100 ecs_world_t *world,
5101 ecs_event_desc_t *desc);
5102
5113FLECS_API
5114 ecs_entity_t ecs_observer_init(
5115 ecs_world_t *world,
5116 const ecs_observer_desc_t *desc);
5117
5126FLECS_API
5127 const ecs_observer_t* ecs_observer_get(
5128 const ecs_world_t *world,
5129 ecs_entity_t observer);
5130
5132
5139
5153FLECS_API
5154 bool ecs_iter_next(
5155 ecs_iter_t *it);
5156
5166FLECS_API
5167 void ecs_iter_fini(
5168 ecs_iter_t *it);
5169
5181FLECS_API
5182int32_t ecs_iter_count(
5183 ecs_iter_t *it);
5184
5197FLECS_API
5198 bool ecs_iter_is_true(
5199 ecs_iter_t *it);
5200
5208FLECS_API
5209 ecs_entity_t ecs_iter_first(
5210 ecs_iter_t *it);
5211
5250FLECS_API
5251 void ecs_iter_set_var(
5252 ecs_iter_t *it,
5253 int32_t var_id,
5254 ecs_entity_t entity);
5255
5266FLECS_API
5267 void ecs_iter_set_var_as_table(
5268 ecs_iter_t *it,
5269 int32_t var_id,
5270 const ecs_table_t *table);
5271
5282FLECS_API
5283 void ecs_iter_set_var_as_range(
5284 ecs_iter_t *it,
5285 int32_t var_id,
5286 const ecs_table_range_t *range);
5287
5300FLECS_API
5301 ecs_entity_t ecs_iter_get_var(
5302 ecs_iter_t *it,
5303 int32_t var_id);
5304
5311FLECS_API
5312 const char* ecs_iter_get_var_name(
5313 const ecs_iter_t *it,
5314 int32_t var_id);
5315
5321FLECS_API
5322int32_t ecs_iter_get_var_count(
5323 const ecs_iter_t *it);
5324
5330FLECS_API
5331ecs_var_t* ecs_iter_get_vars(
5332 const ecs_iter_t *it);
5333
5347FLECS_API
5348 ecs_table_t* ecs_iter_get_var_as_table(
5349 ecs_iter_t *it,
5350 int32_t var_id);
5351
5365FLECS_API
5366ecs_table_range_t ecs_iter_get_var_as_range(
5367 ecs_iter_t *it,
5368 int32_t var_id);
5369
5381FLECS_API
5382 bool ecs_iter_var_is_constrained(
5383 ecs_iter_t *it,
5384 int32_t var_id);
5385
5397FLECS_API
5398uint64_t ecs_iter_get_group(
5399 const ecs_iter_t *it);
5400
5412FLECS_API
5413 bool ecs_iter_changed(
5414 ecs_iter_t *it);
5415
5427FLECS_API
5428 char* ecs_iter_str(
5429 const ecs_iter_t *it);
5430
5446FLECS_API
5447 ecs_iter_t ecs_page_iter(
5448 const ecs_iter_t *it,
5449 int32_t offset,
5450 int32_t limit);
5451
5458FLECS_API
5459 bool ecs_page_next(
5460 ecs_iter_t *it);
5461
5482FLECS_API
5483 ecs_iter_t ecs_worker_iter(
5484 const ecs_iter_t *it,
5485 int32_t index,
5486 int32_t count);
5487
5494FLECS_API
5495 bool ecs_worker_next(
5496 ecs_iter_t *it);
5497
5539FLECS_API
5540 void* ecs_field_w_size(
5541 const ecs_iter_t *it,
5542 size_t size,
5543 int8_t index);
5544
5566FLECS_API
5567 void* ecs_field_at_w_size(
5568 const ecs_iter_t *it,
5569 size_t size,
5570 int8_t index,
5571 int32_t row);
5572
5581FLECS_API
5582 bool ecs_field_is_readonly(
5583 const ecs_iter_t *it,
5584 int8_t index);
5585
5596FLECS_API
5597 bool ecs_field_is_writeonly(
5598 const ecs_iter_t *it,
5599 int8_t index);
5600
5607FLECS_API
5608 bool ecs_field_is_set(
5609 const ecs_iter_t *it,
5610 int8_t index);
5611
5618FLECS_API
5619 ecs_id_t ecs_field_id(
5620 const ecs_iter_t *it,
5621 int8_t index);
5622
5631FLECS_API
5632int32_t ecs_field_column(
5633 const ecs_iter_t *it,
5634 int8_t index);
5635
5643FLECS_API
5644 ecs_entity_t ecs_field_src(
5645 const ecs_iter_t *it,
5646 int8_t index);
5647
5655FLECS_API
5656 size_t ecs_field_size(
5657 const ecs_iter_t *it,
5658 int8_t index);
5659
5673FLECS_API
5674 bool ecs_field_is_self(
5675 const ecs_iter_t *it,
5676 int8_t index);
5677
5679
5686
5693FLECS_API
5694 const ecs_type_t* ecs_table_get_type(
5695 const ecs_table_t *table);
5696
5707FLECS_API
5708int32_t ecs_table_get_type_index(
5709 const ecs_world_t *world,
5710 const ecs_table_t *table,
5711 ecs_id_t id);
5712
5722FLECS_API
5723int32_t ecs_table_get_column_index(
5724 const ecs_world_t *world,
5725 const ecs_table_t *table,
5726 ecs_id_t id);
5727
5735FLECS_API
5736int32_t ecs_table_column_count(
5737 const ecs_table_t *table);
5738
5752FLECS_API
5753int32_t ecs_table_type_to_column_index(
5754 const ecs_table_t *table,
5755 int32_t index);
5756
5765FLECS_API
5766int32_t ecs_table_column_to_type_index(
5767 const ecs_table_t *table,
5768 int32_t index);
5769
5778FLECS_API
5779 void* ecs_table_get_column(
5780 const ecs_table_t *table,
5781 int32_t index,
5782 int32_t offset);
5783
5793FLECS_API
5794 void* ecs_table_get_id(
5795 const ecs_world_t *world,
5796 const ecs_table_t *table,
5797 ecs_id_t id,
5798 int32_t offset);
5799
5807FLECS_API
5808 size_t ecs_table_get_column_size(
5809 const ecs_table_t *table,
5810 int32_t index);
5811
5818FLECS_API
5819int32_t ecs_table_count(
5820 const ecs_table_t *table);
5821
5829FLECS_API
5830int32_t ecs_table_size(
5831 const ecs_table_t *table);
5832
5839FLECS_API
5840 const ecs_entity_t* ecs_table_entities(
5841 const ecs_table_t *table);
5842
5853FLECS_API
5854 bool ecs_table_has_id(
5855 const ecs_world_t *world,
5856 const ecs_table_t *table,
5857 ecs_id_t id);
5858
5869FLECS_API
5870int32_t ecs_table_get_depth(
5871 const ecs_world_t *world,
5872 const ecs_table_t *table,
5873 ecs_entity_t rel);
5874
5884FLECS_API
5885 ecs_table_t* ecs_table_add_id(
5886 ecs_world_t *world,
5887 ecs_table_t *table,
5888 ecs_id_t id);
5889
5900FLECS_API
5901 ecs_table_t* ecs_table_find(
5902 ecs_world_t *world,
5903 const ecs_id_t *ids,
5904 int32_t id_count);
5905
5915FLECS_API
5916 ecs_table_t* ecs_table_remove_id(
5917 ecs_world_t *world,
5918 ecs_table_t *table,
5919 ecs_id_t id);
5920
5936FLECS_API
5937 void ecs_table_lock(
5938 ecs_world_t *world,
5939 ecs_table_t *table);
5940
5947FLECS_API
5948 void ecs_table_unlock(
5949 ecs_world_t *world,
5950 ecs_table_t *table);
5951
5961FLECS_API
5962 bool ecs_table_has_flags(
5963 ecs_table_t *table,
5964 ecs_flags32_t flags);
5965
5973FLECS_API
5974 void ecs_table_swap_rows(
5975 ecs_world_t* world,
5976 ecs_table_t* table,
5977 int32_t row_1,
5978 int32_t row_2);
5979
6002FLECS_API
6003 bool ecs_commit(
6004 ecs_world_t *world,
6005 ecs_entity_t entity,
6006 ecs_record_t *record,
6007 ecs_table_t *table,
6008 const ecs_type_t *added,
6009 const ecs_type_t *removed);
6010
6011
6030FLECS_API
6031int32_t ecs_search(
6032 const ecs_world_t *world,
6033 const ecs_table_t *table,
6034 ecs_id_t id,
6035 ecs_id_t *id_out);
6036
6072FLECS_API
6073int32_t ecs_search_offset(
6074 const ecs_world_t *world,
6075 const ecs_table_t *table,
6076 int32_t offset,
6077 ecs_id_t id,
6078 ecs_id_t *id_out);
6079
6121FLECS_API
6122int32_t ecs_search_relation(
6123 const ecs_world_t *world,
6124 const ecs_table_t *table,
6125 int32_t offset,
6126 ecs_id_t id,
6127 ecs_entity_t rel,
6128 ecs_flags64_t flags, /* EcsSelf and/or EcsUp */
6129 ecs_entity_t *subject_out,
6130 ecs_id_t *id_out,
6131 struct ecs_table_record_t **tr_out);
6132
6140FLECS_API
6141 void ecs_table_clear_entities(
6142 ecs_world_t* world,
6143 ecs_table_t* table);
6144
6146
6153
6161FLECS_API
6162 int ecs_value_init(
6163 const ecs_world_t *world,
6164 ecs_entity_t type,
6165 void *ptr);
6166
6174FLECS_API
6175 int ecs_value_init_w_type_info(
6176 const ecs_world_t *world,
6177 const ecs_type_info_t *ti,
6178 void *ptr);
6179
6186FLECS_API
6187 void* ecs_value_new(
6188 ecs_world_t *world,
6189 ecs_entity_t type);
6190
6197 void* ecs_value_new_w_type_info(
6198 ecs_world_t *world,
6199 const ecs_type_info_t *ti);
6200
6208 int ecs_value_fini_w_type_info(
6209 const ecs_world_t *world,
6210 const ecs_type_info_t *ti,
6211 void *ptr);
6212
6220FLECS_API
6221 int ecs_value_fini(
6222 const ecs_world_t *world,
6223 ecs_entity_t type,
6224 void* ptr);
6225
6233FLECS_API
6234 int ecs_value_free(
6235 ecs_world_t *world,
6236 ecs_entity_t type,
6237 void* ptr);
6238
6247FLECS_API
6248 int ecs_value_copy_w_type_info(
6249 const ecs_world_t *world,
6250 const ecs_type_info_t *ti,
6251 void* dst,
6252 const void *src);
6253
6262FLECS_API
6263 int ecs_value_copy(
6264 const ecs_world_t *world,
6265 ecs_entity_t type,
6266 void* dst,
6267 const void *src);
6268
6277 int ecs_value_move_w_type_info(
6278 const ecs_world_t *world,
6279 const ecs_type_info_t *ti,
6280 void* dst,
6281 void *src);
6282
6291 int ecs_value_move(
6292 const ecs_world_t *world,
6293 ecs_entity_t type,
6294 void* dst,
6295 void *src);
6296
6305 int ecs_value_move_ctor_w_type_info(
6306 const ecs_world_t *world,
6307 const ecs_type_info_t *ti,
6308 void* dst,
6309 void *src);
6310
6319 int ecs_value_move_ctor(
6320 const ecs_world_t *world,
6321 ecs_entity_t type,
6322 void* dst,
6323 void *src);
6324
6326
6328
6337
6338#include "flecs/addons/flecs_c.h"
6339
6340#ifdef __cplusplus
6341}
6342#endif
6343
6344#include "flecs/private/addons.h"
6345
6346#endif
deprecated.h
The deprecated addon contains deprecated operations.
flecs_c.h
Extends the core API with convenience macros for C applications.
ecs_set_with
ecs_entity_t ecs_set_with(ecs_world_t *world, ecs_id_t id)
Set current with id.
ecs_add_id
void ecs_add_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Add a (component) id to an entity.
ecs_remove_id
void ecs_remove_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Remove a (component) id from an entity.
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 current with id.
ecs_remove_all
void ecs_remove_all(ecs_world_t *world, ecs_id_t id)
Remove all instances of the specified (component) id.
ecs_auto_override_id
void ecs_auto_override_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Add auto override for (component) id.
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.
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_component_init
ecs_entity_t ecs_component_init(ecs_world_t *world, const ecs_component_desc_t *desc)
Find or create a component.
ecs_set_hooks_id
void ecs_set_hooks_id(ecs_world_t *world, ecs_entity_t id, const ecs_type_hooks_t *hooks)
Register hooks for component.
ecs_get_type_info
const ecs_type_info_t * ecs_get_type_info(const ecs_world_t *world, ecs_id_t id)
Get the type for an id.
ecs_get_hooks_id
const ecs_type_hooks_t * ecs_get_hooks_id(const ecs_world_t *world, ecs_entity_t id)
Get 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:492
ecs_stage_t
struct ecs_stage_t ecs_stage_t
A stage enables modification while iterating and from multiple threads.
Definition flecs.h:427
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:476
ecs_entity_t
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:380
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:424
ecs_mixins_t
struct ecs_mixins_t ecs_mixins_t
Type that stores poly mixins.
Definition flecs.h:516
ecs_id_t
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
Definition flecs.h:373
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:460
ecs_record_t
struct ecs_record_t ecs_record_t
Information about an entity, like its table and row.
Definition flecs.h:489
ecs_table_t
struct ecs_table_t ecs_table_t
A table stores entities and components for a specific type.
Definition flecs.h:430
ecs_poly_t
void ecs_poly_t
A poly object.
Definition flecs.h:513
ecs_new_low_id
ecs_entity_t ecs_new_low_id(ecs_world_t *world)
Create new low id.
ecs_new_w_id
ecs_entity_t ecs_new_w_id(ecs_world_t *world, ecs_id_t id)
Create new entity with (component) 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_bulk_new_w_id
const ecs_entity_t * ecs_bulk_new_w_id(ecs_world_t *world, ecs_id_t id, int32_t count)
Create N new entities.
ecs_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_with
void ecs_delete_with(ecs_world_t *world, ecs_id_t id)
Delete all entities with the specified id.
ecs_delete
void ecs_delete(ecs_world_t *world, ecs_entity_t entity)
Delete an entity.
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_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_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_each_id
ecs_iter_t ecs_each_id(const ecs_world_t *world, ecs_id_t id)
Iterate all entities with specified (component id).
ecs_is_enabled_id
bool ecs_is_enabled_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Test if component is enabled.
ecs_enable_id
void ecs_enable_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id, bool enable)
Enable or disable component.
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_type
const ecs_type_t * ecs_get_type(const ecs_world_t *world, ecs_entity_t entity)
Get the type of an entity.
ecs_has_id
bool ecs_has_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Test if an entity has an id.
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_owns_id
bool ecs_owns_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Test if an entity owns an 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_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 id)
Get the target of a relationship for a given id.
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_module_action_t
void(* ecs_module_action_t)(ecs_world_t *world)
Initialization action for modules.
Definition flecs.h:614
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:594
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:656
ecs_hash_value_action_t
uint64_t(* ecs_hash_value_action_t)(const void *ptr)
Callback used for hashing values.
Definition flecs.h:632
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:607
ecs_iter_fini_action_t
void(* ecs_iter_fini_action_t)(ecs_iter_t *it)
Function prototype for freeing an iterator.
Definition flecs.h:572
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:601
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:583
ecs_iter_next_action_t
bool(* ecs_iter_next_action_t)(ecs_iter_t *it)
Function prototype for iterating an iterator.
Definition flecs.h:564
ecs_iter_action_t
void(* ecs_iter_action_t)(ecs_iter_t *it)
Function prototype for iterables.
Definition flecs.h:554
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:642
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:662
ecs_compare_action_t
int(* ecs_compare_action_t)(const void *ptr1, const void *ptr2)
Callback used for sorting values.
Definition flecs.h:627
ecs_fini_action_t
void(* ecs_fini_action_t)(ecs_world_t *world, void *ctx)
Action callback on world exit.
Definition flecs.h:618
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:649
flecs_poly_dtor_t
void(* flecs_poly_dtor_t)(ecs_poly_t *poly)
Destructor function for poly objects.
Definition flecs.h:668
ecs_run_action_t
void(* ecs_run_action_t)(ecs_iter_t *it)
Function prototype for runnables (systems, observers).
Definition flecs.h:545
ecs_ctx_free_t
void(* ecs_ctx_free_t)(void *ctx)
Function to cleanup context data.
Definition flecs.h:623
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:576
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:636
ecs_get_mut_id
void * ecs_get_mut_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Get a mutable pointer to a component.
ecs_ref_init_id
ecs_ref_t ecs_ref_init_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Create a component ref.
ecs_ref_update
void ecs_ref_update(const ecs_world_t *world, ecs_ref_t *ref)
Update ref.
ecs_emplace_id
void * ecs_emplace_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id, bool *is_new)
Emplace a component.
ecs_ensure_id
void * ecs_ensure_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Get a mutable pointer to a component.
ecs_set_id
void ecs_set_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id, size_t size, const void *ptr)
Set the value of a component.
ecs_ensure_modified_id
void * ecs_ensure_modified_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Combines ensure + modified in single operation.
ecs_ref_get_id
void * ecs_ref_get_id(const ecs_world_t *world, ecs_ref_t *ref, ecs_id_t id)
Get component from ref.
ecs_get_id
const void * ecs_get_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Get an immutable pointer to a component.
ecs_modified_id
void ecs_modified_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Signal that a component has been modified.
ecs_get_mut_modified_id
void * ecs_get_mut_modified_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Combines get_mut + modified in single operation.
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_is_valid
bool ecs_id_is_valid(const ecs_world_t *world, ecs_id_t id)
Utility to check if id is valid.
ecs_id_is_pair
bool ecs_id_is_pair(ecs_id_t id)
Utility to check if id is a pair.
ecs_get_typeid
ecs_entity_t ecs_get_typeid(const ecs_world_t *world, ecs_id_t id)
Get the type for an id.
ecs_id_match
bool ecs_id_match(ecs_id_t id, ecs_id_t pattern)
Utility to match an id with a pattern.
ecs_id_flag_str
const char * ecs_id_flag_str(ecs_id_t id_flags)
Convert id flag to string.
ecs_id_in_use
bool ecs_id_in_use(const ecs_world_t *world, ecs_id_t id)
Returns whether specified id is in use.
ecs_id_is_tag
bool ecs_id_is_tag(const ecs_world_t *world, ecs_id_t id)
Returns whether specified id a tag.
ecs_id_str_buf
void ecs_id_str_buf(const ecs_world_t *world, ecs_id_t id, ecs_strbuf_t *buf)
Write (component) id string to buffer.
ecs_id_str
char * ecs_id_str(const ecs_world_t *world, ecs_id_t id)
Convert (component) id to string.
ecs_id_is_any
bool ecs_id_is_any(ecs_id_t id)
Utility to check if id is an any wildcard.
ecs_id_is_wildcard
bool ecs_id_is_wildcard(ecs_id_t id)
Utility to check if id is a wildcard.
ecs_id_from_str
ecs_id_t ecs_id_from_str(const ecs_world_t *world, const char *expr)
Convert string to a (component) id.
ecs_id_get_flags
ecs_flags32_t ecs_id_get_flags(const ecs_world_t *world, ecs_id_t id)
Get flags associated with id.
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_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_make_alive_id
void ecs_make_alive_id(ecs_world_t *world, ecs_id_t id)
Same as ecs_make_alive(), but for (component) ids.
ecs_get_alive
ecs_entity_t ecs_get_alive(const ecs_world_t *world, ecs_entity_t e)
Get alive identifier.
ecs_exists
bool ecs_exists(const ecs_world_t *world, ecs_entity_t entity)
Test whether an entity exists.
ecs_is_alive
bool ecs_is_alive(const ecs_world_t *world, ecs_entity_t e)
Test whether an entity is alive.
ecs_set_version
void ecs_set_version(ecs_world_t *world, ecs_entity_t entity)
Override the generation of an entity.
ecs_emit
void ecs_emit(ecs_world_t *world, ecs_event_desc_t *desc)
Send event.
ecs_enqueue
void ecs_enqueue(ecs_world_t *world, ecs_event_desc_t *desc)
Enqueue event.
ecs_observer_init
ecs_entity_t ecs_observer_init(ecs_world_t *world, const ecs_observer_desc_t *desc)
Create observer.
ecs_observer_get
const ecs_observer_t * ecs_observer_get(const ecs_world_t *world, ecs_entity_t observer)
Get observer object.
FLECS_EVENT_DESC_MAX
#define FLECS_EVENT_DESC_MAX
Maximum number of events in ecs_observer_desc_t.
Definition flecs.h:302
ecs_ftime_t
#define ecs_ftime_t
Customizable precision for scalar time values.
Definition flecs.h:59
FLECS_ID_DESC_MAX
#define FLECS_ID_DESC_MAX
Maximum number of ids to add ecs_entity_desc_t / ecs_bulk_desc_t.
Definition flecs.h:296
FLECS_TERM_COUNT_MAX
#define FLECS_TERM_COUNT_MAX
Maximum number of terms in queries.
Definition flecs.h:312
ecs_get_path_w_sep
char * ecs_get_path_w_sep(const ecs_world_t *world, ecs_entity_t parent, ecs_entity_t child, const char *sep, const char *prefix)
Get a path identifier for an entity.
ecs_new_from_path_w_sep
ecs_entity_t ecs_new_from_path_w_sep(ecs_world_t *world, ecs_entity_t parent, const char *path, const char *sep, const char *prefix)
Find or create entity from path.
ecs_lookup_symbol
ecs_entity_t ecs_lookup_symbol(const ecs_world_t *world, const char *symbol, bool lookup_as_path, bool recursive)
Lookup an entity by its symbol name.
ecs_set_alias
void ecs_set_alias(ecs_world_t *world, ecs_entity_t entity, const char *alias)
Set alias for entity.
ecs_lookup
ecs_entity_t ecs_lookup(const ecs_world_t *world, const char *path)
Lookup an entity by it's path.
ecs_get_scope
ecs_entity_t ecs_get_scope(const ecs_world_t *world)
Get the current scope.
ecs_get_path_w_sep_buf
void ecs_get_path_w_sep_buf(const ecs_world_t *world, ecs_entity_t parent, ecs_entity_t child, const char *sep, const char *prefix, ecs_strbuf_t *buf, bool escape)
Write path identifier to buffer.
ecs_set_lookup_path
ecs_entity_t * ecs_set_lookup_path(ecs_world_t *world, const ecs_entity_t *lookup_path)
Set search path for lookup operations.
ecs_set_name
ecs_entity_t ecs_set_name(ecs_world_t *world, ecs_entity_t entity, const char *name)
Set the name of an entity.
ecs_get_symbol
const char * ecs_get_symbol(const ecs_world_t *world, ecs_entity_t entity)
Get the symbol of an entity.
ecs_lookup_path_w_sep
ecs_entity_t ecs_lookup_path_w_sep(const ecs_world_t *world, ecs_entity_t parent, const char *path, const char *sep, const char *prefix, bool recursive)
Lookup an entity from a path.
ecs_set_symbol
ecs_entity_t ecs_set_symbol(ecs_world_t *world, ecs_entity_t entity, const char *symbol)
Set the symbol of an entity.
ecs_lookup_child
ecs_entity_t ecs_lookup_child(const ecs_world_t *world, ecs_entity_t parent, const char *name)
Lookup a child entity by name.
ecs_get_name
const char * ecs_get_name(const ecs_world_t *world, ecs_entity_t entity)
Get the name of an entity.
ecs_add_path_w_sep
ecs_entity_t ecs_add_path_w_sep(ecs_world_t *world, ecs_entity_t entity, ecs_entity_t parent, const char *path, const char *sep, const char *prefix)
Add specified path to entity.
ecs_get_lookup_path
ecs_entity_t * ecs_get_lookup_path(const ecs_world_t *world)
Get current lookup path.
ecs_set_scope
ecs_entity_t ecs_set_scope(ecs_world_t *world, ecs_entity_t scope)
Set the current scope.
ecs_set_name_prefix
const char * ecs_set_name_prefix(ecs_world_t *world, const char *prefix)
Set a name prefix for newly created entities.
ecs_iter_skip
void ecs_iter_skip(ecs_iter_t *it)
Skip a table while iterating.
ecs_iter_set_group
void ecs_iter_set_group(ecs_iter_t *it, uint64_t group_id)
Set group to iterate for query iterator.
ecs_query_get
const ecs_query_t * ecs_query_get(const ecs_world_t *world, ecs_entity_t query)
Get query object.
ecs_query_next
bool ecs_query_next(ecs_iter_t *it)
Progress query iterator.
ecs_query_get_group_info
const ecs_query_group_info_t * ecs_query_get_group_info(const ecs_query_t *query, uint64_t group_id)
Get information about query group.
ecs_query_has
bool ecs_query_has(ecs_query_t *query, ecs_entity_t entity, ecs_iter_t *it)
Match entity with query.
ecs_query_is_true
bool ecs_query_is_true(const ecs_query_t *query)
Does query return one or more results.
ecs_term_str
char * ecs_term_str(const ecs_world_t *world, const ecs_term_t *term)
Convert term to string expression.
ecs_query_find_var
int32_t ecs_query_find_var(const ecs_query_t *query, const char *name)
Find variable index.
ecs_query_fini
void ecs_query_fini(ecs_query_t *query)
Delete a query.
ecs_query_plan_w_profile
char * ecs_query_plan_w_profile(const ecs_query_t *query, const ecs_iter_t *it)
Convert query to string with profile.
ecs_query_args_parse
const char * ecs_query_args_parse(ecs_query_t *query, ecs_iter_t *it, const char *expr)
Populate variables from key-value string.
ecs_query_match_count
int32_t ecs_query_match_count(const ecs_query_t *query)
Returns how often a match event happened for a cached query.
ecs_query_plan
char * ecs_query_plan(const ecs_query_t *query)
Convert query to a string.
ecs_query_iter
ecs_iter_t ecs_query_iter(const ecs_world_t *world, const ecs_query_t *query)
Create a query iterator.
ecs_query_str
char * ecs_query_str(const ecs_query_t *query)
Convert query to string expression.
ecs_query_var_is_entity
bool ecs_query_var_is_entity(const ecs_query_t *query, int32_t var_id)
Test if variable is an entity.
ecs_query_init
ecs_query_t * ecs_query_init(ecs_world_t *world, const ecs_query_desc_t *desc)
Create a query.
ecs_query_changed
bool ecs_query_changed(ecs_query_t *query)
Returns whether the query data changed since the last iteration.
ecs_query_has_range
bool ecs_query_has_range(ecs_query_t *query, ecs_table_range_t *range, ecs_iter_t *it)
Match range with query.
ecs_query_var_name
const char * ecs_query_var_name(const ecs_query_t *query, int32_t var_id)
Get variable name.
ecs_term_match_this
bool ecs_term_match_this(const ecs_term_t *term)
Is term matched on $this variable.
ecs_query_has_table
bool ecs_query_has_table(ecs_query_t *query, ecs_table_t *table, ecs_iter_t *it)
Match table with query.
ecs_query_get_group_ctx
void * ecs_query_get_group_ctx(const ecs_query_t *query, uint64_t group_id)
Get context of query group.
ecs_query_count
ecs_query_count_t ecs_query_count(const ecs_query_t *query)
Returns number of entities and results the query matches with.
ecs_term_ref_is_set
bool ecs_term_ref_is_set(const ecs_term_ref_t *id)
Test whether term id is set.
ecs_term_is_initialized
bool ecs_term_is_initialized(const ecs_term_t *term)
Test whether a term 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:702
ecs_inout_kind_t
ecs_inout_kind_t
Specify read/write access for term.
Definition flecs.h:681
ecs_oper_kind_t
ecs_oper_kind_t
Specify operator for term.
Definition flecs.h:691
EcsQueryCacheAll
@ EcsQueryCacheAll
Require that all query terms can be cached.
Definition flecs.h:705
EcsQueryCacheDefault
@ EcsQueryCacheDefault
Behavior determined by query creation context.
Definition flecs.h:703
EcsQueryCacheNone
@ EcsQueryCacheNone
No caching.
Definition flecs.h:706
EcsQueryCacheAuto
@ EcsQueryCacheAuto
Cache query terms that are cacheable.
Definition flecs.h:704
EcsOut
@ EcsOut
Term is only written.
Definition flecs.h:687
EcsInOut
@ EcsInOut
Term is both read and written.
Definition flecs.h:685
EcsInOutFilter
@ EcsInOutFilter
Same as InOutNone + prevents term from triggering observers.
Definition flecs.h:684
EcsInOutDefault
@ EcsInOutDefault
InOut for regular terms, In for shared terms.
Definition flecs.h:682
EcsInOutNone
@ EcsInOutNone
Term is neither read nor written.
Definition flecs.h:683
EcsIn
@ EcsIn
Term is only read.
Definition flecs.h:686
EcsNot
@ EcsNot
The term must not match.
Definition flecs.h:694
EcsOptional
@ EcsOptional
The term may match.
Definition flecs.h:695
EcsOr
@ EcsOr
One of the terms in an or chain must match.
Definition flecs.h:693
EcsOrFrom
@ EcsOrFrom
Term must match at least one component from term id.
Definition flecs.h:697
EcsAnd
@ EcsAnd
The term must match.
Definition flecs.h:692
EcsNotFrom
@ EcsNotFrom
Term must match none of the components from term id.
Definition flecs.h:698
EcsAndFrom
@ EcsAndFrom
Term must match all components from term id.
Definition flecs.h:696
ecs_table_add_id
ecs_table_t * ecs_table_add_id(ecs_world_t *world, ecs_table_t *table, ecs_id_t id)
Get table that has all components of current table plus the specified id.
ecs_search
int32_t ecs_search(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t id, ecs_id_t *id_out)
Search for component id in table type.
ecs_table_get_type
const ecs_type_t * ecs_table_get_type(const ecs_table_t *table)
Get type for table.
ecs_search_offset
int32_t ecs_search_offset(const ecs_world_t *world, const ecs_table_t *table, int32_t offset, ecs_id_t id, ecs_id_t *id_out)
Search for component id in table type starting from an offset.
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_table_has_id
bool ecs_table_has_id(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t id)
Test if table has id.
ecs_table_remove_id
ecs_table_t * ecs_table_remove_id(ecs_world_t *world, ecs_table_t *table, ecs_id_t id)
Get table that has all components of current table minus the specified id.
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_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_table_get_id
void * ecs_table_get_id(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t id, int32_t offset)
Get column from table by component id.
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_get_column_index
int32_t ecs_table_get_column_index(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t id)
Get column index for id.
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_type_index
int32_t ecs_table_get_type_index(const ecs_world_t *world, const ecs_table_t *table, ecs_id_t id)
Get type index for id.
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_clear_entities
void ecs_table_clear_entities(ecs_world_t *world, ecs_table_t *table)
Remove all entities in a table.
ecs_search_relation
int32_t ecs_search_relation(const ecs_world_t *world, const ecs_table_t *table, int32_t offset, ecs_id_t id, ecs_entity_t rel, ecs_flags64_t flags, ecs_entity_t *subject_out, ecs_id_t *id_out, struct ecs_table_record_t **tr_out)
Search for component/relationship id in table type starting from an offset.
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:1532
EcsComponent::size
ecs_size_t size
Component size.
Definition flecs.h:1533
EcsComponent::alignment
ecs_size_t alignment
Component alignment.
Definition flecs.h:1534
EcsDefaultChildComponent
When added to an entity this informs serialization formats which component to use when a value is ass...
Definition flecs.h:1547
EcsDefaultChildComponent::component
ecs_id_t component
Default component id.
Definition flecs.h:1548
EcsIdentifier
A (string) identifier.
Definition flecs.h:1523
EcsIdentifier::length
ecs_size_t length
Length of identifier.
Definition flecs.h:1525
EcsIdentifier::value
char * value
Identifier string.
Definition flecs.h:1524
EcsIdentifier::index
ecs_hashmap_t * index
Current index.
Definition flecs.h:1528
EcsIdentifier::hash
uint64_t hash
Hash of current value.
Definition flecs.h:1526
EcsIdentifier::index_hash
uint64_t index_hash
Hash of existing record in current index.
Definition flecs.h:1527
EcsPoly
Component for storing a poly object.
Definition flecs.h:1538
EcsPoly::poly
ecs_poly_t * poly
Pointer to poly object.
Definition flecs.h:1539
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:1434
ecs_build_info_t::version_major
int16_t version_major
Major flecs version.
Definition flecs.h:1438
ecs_build_info_t::addons
const char ** addons
Addons included in build.
Definition flecs.h:1436
ecs_build_info_t::version
const char * version
Stringified version.
Definition flecs.h:1437
ecs_build_info_t::compiler
const char * compiler
Compiler used to compile flecs.
Definition flecs.h:1435
ecs_build_info_t::sanitize
bool sanitize
Is this a sanitize build.
Definition flecs.h:1442
ecs_build_info_t::perf_trace
bool perf_trace
Is this a perf tracing build.
Definition flecs.h:1443
ecs_build_info_t::version_minor
int16_t version_minor
Minor flecs version.
Definition flecs.h:1439
ecs_build_info_t::debug
bool debug
Is this a debug build.
Definition flecs.h:1441
ecs_build_info_t::version_patch
int16_t version_patch
Patch flecs version.
Definition flecs.h:1440
ecs_bulk_desc_t
Used with ecs_bulk_init().
Definition flecs.h:1057
ecs_bulk_desc_t::data
void ** data
Array with component data to insert.
Definition flecs.h:1069
ecs_bulk_desc_t::ids
ecs_id_t ids[(32)]
Ids to create the entities with.
Definition flecs.h:1067
ecs_bulk_desc_t::count
int32_t count
Number of entities to create/populate.
Definition flecs.h:1065
ecs_bulk_desc_t::_canary
int32_t _canary
Used for validity testing.
Definition flecs.h:1058
ecs_bulk_desc_t::entities
ecs_entity_t * entities
Entities to bulk insert.
Definition flecs.h:1060
ecs_bulk_desc_t::table
ecs_table_t * table
Table to insert the entities into.
Definition flecs.h:1076
ecs_component_desc_t
Used with ecs_component_init().
Definition flecs.h:1087
ecs_component_desc_t::_canary
int32_t _canary
Used for validity testing.
Definition flecs.h:1088
ecs_component_desc_t::type
ecs_type_info_t type
Parameters for type (size, hooks, ...)
Definition flecs.h:1094
ecs_component_desc_t::entity
ecs_entity_t entity
Existing entity to associate with observer (optional)
Definition flecs.h:1091
ecs_delete_empty_tables_desc_t
Used with ecs_delete_empty_tables().
Definition flecs.h:2641
ecs_delete_empty_tables_desc_t::delete_generation
uint16_t delete_generation
Delete table when generation > delete_generation.
Definition flecs.h:2646
ecs_delete_empty_tables_desc_t::time_budget_seconds
double time_budget_seconds
Amount of time operation is allowed to spend.
Definition flecs.h:2649
ecs_delete_empty_tables_desc_t::clear_generation
uint16_t clear_generation
Free table data when generation > clear_generation.
Definition flecs.h:2643
ecs_entities_t
Type returned by ecs_get_entities().
Definition flecs.h:2008
ecs_entities_t::alive_count
int32_t alive_count
Number of alive entity ids.
Definition flecs.h:2011
ecs_entities_t::count
int32_t count
Total number of entity ids.
Definition flecs.h:2010
ecs_entities_t::ids
const ecs_entity_t * ids
Array with all entity ids in the world.
Definition flecs.h:2009
ecs_entity_desc_t
Used with ecs_entity_init().
Definition flecs.h:1011
ecs_entity_desc_t::sep
const char * sep
Optional custom separator for hierarchical names.
Definition flecs.h:1023
ecs_entity_desc_t::root_sep
const char * root_sep
Optional, used for identifiers relative to root.
Definition flecs.h:1027
ecs_entity_desc_t::name
const char * name
Name of the entity.
Definition flecs.h:1018
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:1039
ecs_entity_desc_t::symbol
const char * symbol
Optional entity symbol.
Definition flecs.h:1029
ecs_entity_desc_t::_canary
int32_t _canary
Used for validity testing.
Definition flecs.h:1012
ecs_entity_desc_t::add
const ecs_id_t * add
0-terminated array of ids to add to the entity.
Definition flecs.h:1044
ecs_entity_desc_t::add_expr
const char * add_expr
String expression with components to add.
Definition flecs.h:1050
ecs_entity_desc_t::set
const ecs_value_t * set
0-terminated array of values to set on the entity.
Definition flecs.h:1047
ecs_entity_desc_t::id
ecs_entity_t id
Set to modify existing entity (optional)
Definition flecs.h:1014
ecs_entity_desc_t::parent
ecs_entity_t parent
Parent entity.
Definition flecs.h:1016
ecs_event_desc_t
Used with ecs_emit().
Definition flecs.h:1380
ecs_event_desc_t::entity
ecs_entity_t entity
Single-entity alternative to setting table / offset / count.
Definition flecs.h:1405
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:1416
ecs_event_desc_t::table
ecs_table_t * table
The table for which to notify.
Definition flecs.h:1390
ecs_event_desc_t::count
int32_t count
Limit number of notified entities to count.
Definition flecs.h:1402
ecs_event_desc_t::other_table
ecs_table_t * other_table
Optional 2nd table to notify.
Definition flecs.h:1394
ecs_event_desc_t::offset
int32_t offset
Limit notified entities to ones starting from offset (row) in table.
Definition flecs.h:1397
ecs_event_desc_t::ids
const ecs_type_t * ids
Component ids.
Definition flecs.h:1387
ecs_event_desc_t::observable
ecs_poly_t * observable
Observable (usually the world)
Definition flecs.h:1419
ecs_event_desc_t::event
ecs_entity_t event
The event id.
Definition flecs.h:1382
ecs_event_desc_t::flags
ecs_flags32_t flags
Event flags.
Definition flecs.h:1422
ecs_event_desc_t::param
void * param
Optional context.
Definition flecs.h:1411
ecs_header_t
Header for ecs_poly_t objects.
Definition flecs.h:519
ecs_header_t::type
int32_t type
Magic number indicating which type of flecs object.
Definition flecs.h:520
ecs_header_t::refcount
int32_t refcount
Refcount, to enable RAII handles.
Definition flecs.h:521
ecs_header_t::mixins
ecs_mixins_t * mixins
Table with offsets to (optional) mixins.
Definition flecs.h:522
ecs_iter_t
Iterator.
Definition flecs.h:1135
ecs_iter_t::real_world
ecs_world_t * real_world
Actual world.
Definition flecs.h:1138
ecs_iter_t::param
void * param
Param passed to ecs_run.
Definition flecs.h:1171
ecs_iter_t::event
ecs_entity_t event
The event (if applicable)
Definition flecs.h:1159
ecs_iter_t::frame_offset
int32_t frame_offset
Offset relative to start of iteration.
Definition flecs.h:1182
ecs_iter_t::ref_fields
ecs_flags32_t ref_fields
Bitset with fields that aren't component arrays.
Definition flecs.h:1153
ecs_iter_t::interrupted_by
ecs_entity_t interrupted_by
When set, system execution is interrupted.
Definition flecs.h:1186
ecs_iter_t::flags
ecs_flags32_t flags
Iterator flags.
Definition flecs.h:1185
ecs_iter_t::chain_it
ecs_iter_t * chain_it
Optional, allows for creating iterator chains.
Definition flecs.h:1193
ecs_iter_t::ctx
void * ctx
System context.
Definition flecs.h:1172
ecs_iter_t::run_ctx
void * run_ctx
Run language binding context.
Definition flecs.h:1175
ecs_iter_t::table
ecs_table_t * table
Current table.
Definition flecs.h:1147
ecs_iter_t::offset
int32_t offset
Offset relative to current table.
Definition flecs.h:1141
ecs_iter_t::event_id
ecs_id_t event_id
The (component) id for the event.
Definition flecs.h:1160
ecs_iter_t::fini
ecs_iter_fini_action_t fini
Function to cleanup iterator resources.
Definition flecs.h:1192
ecs_iter_t::priv_
ecs_iter_private_t priv_
Private data.
Definition flecs.h:1187
ecs_iter_t::world
ecs_world_t * world
The world.
Definition flecs.h:1137
ecs_iter_t::callback_ctx
void * callback_ctx
Callback language binding context.
Definition flecs.h:1174
ecs_iter_t::sources
ecs_entity_t * sources
Entity on which the id was matched (0 if same as entities)
Definition flecs.h:1150
ecs_iter_t::binding_ctx
void * binding_ctx
System binding context.
Definition flecs.h:1173
ecs_iter_t::row_fields
ecs_flags32_t row_fields
Fields that must be obtained with field_at.
Definition flecs.h:1154
ecs_iter_t::delta_system_time
float delta_system_time
Time elapsed since last system invocation.
Definition flecs.h:1179
ecs_iter_t::query
const ecs_query_t * query
Query being evaluated.
Definition flecs.h:1168
ecs_iter_t::term_index
int8_t term_index
Index of term that emitted an event.
Definition flecs.h:1165
ecs_iter_t::system
ecs_entity_t system
The system (if applicable)
Definition flecs.h:1158
ecs_iter_t::set_fields
ecs_flags32_t set_fields
Fields that are set.
Definition flecs.h:1152
ecs_iter_t::sizes
const ecs_size_t * sizes
Component sizes.
Definition flecs.h:1146
ecs_iter_t::delta_time
float delta_time
Time elapsed since last frame.
Definition flecs.h:1178
ecs_iter_t::up_fields
ecs_flags32_t up_fields
Bitset with fields matched through up traversal.
Definition flecs.h:1155
ecs_iter_t::callback
ecs_iter_action_t callback
Callback of system or observer.
Definition flecs.h:1191
ecs_iter_t::field_count
int8_t field_count
Number of fields in iterator.
Definition flecs.h:1164
ecs_iter_t::other_table
ecs_table_t * other_table
Prev or next table when adding/removing.
Definition flecs.h:1148
ecs_iter_t::event_cur
int32_t event_cur
Unique event id.
Definition flecs.h:1161
ecs_iter_t::trs
const ecs_table_record_t ** trs
Info on where to find field in table.
Definition flecs.h:1145
ecs_iter_t::count
int32_t count
Number of entities to iterate.
Definition flecs.h:1142
ecs_iter_t::ptrs
void ** ptrs
Component pointers.
Definition flecs.h:1144
ecs_iter_t::next
ecs_iter_next_action_t next
Function to progress iterator.
Definition flecs.h:1190
ecs_iter_t::entities
const ecs_entity_t * entities
Entity identifiers.
Definition flecs.h:1143
ecs_iter_t::ids
ecs_id_t * ids
(Component) ids
Definition flecs.h:1149
ecs_iter_t::constrained_vars
ecs_flags64_t constrained_vars
Bitset that marks constrained variables.
Definition flecs.h:1151
ecs_observer_desc_t
Used with ecs_observer_init().
Definition flecs.h:1318
ecs_observer_desc_t::run_ctx_free
ecs_ctx_free_t run_ctx_free
Callback to free run ctx.
Definition flecs.h:1362
ecs_observer_desc_t::ctx_free
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:1350
ecs_observer_desc_t::run_ctx
void * run_ctx
Context associated with run (for language bindings).
Definition flecs.h:1359
ecs_observer_desc_t::entity
ecs_entity_t entity
Existing entity to associate with observer (optional)
Definition flecs.h:1323
ecs_observer_desc_t::events
ecs_entity_t events[(8)]
Events to observe (OnAdd, OnRemove, OnSet)
Definition flecs.h:1329
ecs_observer_desc_t::last_event_id
int32_t * last_event_id
Optional shared last event id for multiple observers.
Definition flecs.h:1369
ecs_observer_desc_t::callback_ctx
void * callback_ctx
Context associated with callback (for language bindings).
Definition flecs.h:1353
ecs_observer_desc_t::ctx
void * ctx
User context to pass to callback.
Definition flecs.h:1347
ecs_observer_desc_t::query
ecs_query_desc_t query
Query for observer.
Definition flecs.h:1326
ecs_observer_desc_t::observable
ecs_poly_t * observable
Observable with which to register the observer.
Definition flecs.h:1365
ecs_observer_desc_t::callback_ctx_free
ecs_ctx_free_t callback_ctx_free
Callback to free callback ctx.
Definition flecs.h:1356
ecs_observer_desc_t::term_index_
int8_t term_index_
Used for internal purposes.
Definition flecs.h:1372
ecs_observer_desc_t::callback
ecs_iter_action_t callback
Callback to invoke on an event, invoked when the observer matches.
Definition flecs.h:1336
ecs_observer_desc_t::yield_existing
bool yield_existing
When observer is created, generate events from existing data.
Definition flecs.h:1333
ecs_observer_desc_t::run
ecs_run_action_t run
Callback invoked on an event.
Definition flecs.h:1344
ecs_observer_desc_t::_canary
int32_t _canary
Used for validity testing.
Definition flecs.h:1320
ecs_observer_t
An observer reacts to events matching a query.
Definition flecs.h:852
ecs_observer_t::event_count
int32_t event_count
Number of events.
Definition flecs.h:859
ecs_observer_t::callback
ecs_iter_action_t callback
See ecs_observer_desc_t::callback.
Definition flecs.h:861
ecs_observer_t::entity
ecs_entity_t entity
Entity associated with observer.
Definition flecs.h:875
ecs_observer_t::observable
ecs_observable_t * observable
Observable for observer.
Definition flecs.h:872
ecs_observer_t::run
ecs_run_action_t run
See ecs_observer_desc_t::run.
Definition flecs.h:862
ecs_observer_t::hdr
ecs_header_t hdr
Object header.
Definition flecs.h:853
ecs_observer_t::ctx_free
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:868
ecs_observer_t::run_ctx
void * run_ctx
Run language binding context.
Definition flecs.h:866
ecs_observer_t::world
ecs_world_t * world
The world.
Definition flecs.h:874
ecs_observer_t::run_ctx_free
ecs_ctx_free_t run_ctx_free
Callback to free run_ctx.
Definition flecs.h:870
ecs_observer_t::callback_ctx
void * callback_ctx
Callback language binding context.
Definition flecs.h:865
ecs_observer_t::ctx
void * ctx
Observer context.
Definition flecs.h:864
ecs_observer_t::events
ecs_entity_t events[(8)]
Observer events.
Definition flecs.h:858
ecs_observer_t::callback_ctx_free
ecs_ctx_free_t callback_ctx_free
Callback to free callback_ctx.
Definition flecs.h:869
ecs_observer_t::query
ecs_query_t * query
Observer query.
Definition flecs.h:855
ecs_query_count_t
Struct returned by ecs_query_count().
Definition flecs.h:5016
ecs_query_count_t::entities
int32_t entities
Number of entities returned by query.
Definition flecs.h:5018
ecs_query_count_t::results
int32_t results
Number of results returned by query.
Definition flecs.h:5017
ecs_query_count_t::tables
int32_t tables
Number of tables returned by query.
Definition flecs.h:5019
ecs_query_desc_t
Used with ecs_query_init().
Definition flecs.h:1244
ecs_query_desc_t::ctx_free
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:1305
ecs_query_desc_t::group_by
ecs_id_t group_by
Component id to be used for grouping.
Definition flecs.h:1275
ecs_query_desc_t::terms
ecs_term_t terms[32]
Query terms.
Definition flecs.h:1249
ecs_query_desc_t::_canary
int32_t _canary
Used for validity testing.
Definition flecs.h:1246
ecs_query_desc_t::ctx
void * ctx
User context to pass to callback.
Definition flecs.h:1299
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:1296
ecs_query_desc_t::group_by_ctx
void * group_by_ctx
Context to pass to group_by.
Definition flecs.h:1293
ecs_query_desc_t::binding_ctx
void * binding_ctx
Context to be used for language bindings.
Definition flecs.h:1302
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:1271
ecs_query_desc_t::order_by_callback
ecs_order_by_action_t order_by_callback
Callback used for ordering query results.
Definition flecs.h:1263
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:1286
ecs_query_desc_t::entity
ecs_entity_t entity
Entity associated with query (optional)
Definition flecs.h:1311
ecs_query_desc_t::binding_ctx_free
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:1308
ecs_query_desc_t::group_by_callback
ecs_group_by_action_t group_by_callback
Callback used for grouping results.
Definition flecs.h:1282
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:1290
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:1267
ecs_query_desc_t::flags
ecs_flags32_t flags
Flags for enabling query features.
Definition flecs.h:1258
ecs_query_desc_t::cache_kind
ecs_query_cache_kind_t cache_kind
Caching policy of query.
Definition flecs.h:1255
ecs_query_desc_t::expr
const char * expr
Query DSL expression (optional)
Definition flecs.h:1252
ecs_query_group_info_t
Type that contains information about a query group.
Definition flecs.h:1506
ecs_query_group_info_t::table_count
int32_t table_count
Number of tables in group.
Definition flecs.h:1509
ecs_query_group_info_t::ctx
void * ctx
Group context, returned by on_group_create.
Definition flecs.h:1510
ecs_query_group_info_t::match_count
int32_t match_count
How often tables have been matched/unmatched.
Definition flecs.h:1508
ecs_query_t
Queries are lists of constraints (terms) that match entities.
Definition flecs.h:811
ecs_query_t::row_fields
ecs_flags32_t row_fields
Fields that must be acquired with field_at.
Definition flecs.h:831
ecs_query_t::data_fields
ecs_flags32_t data_fields
Fields that have data.
Definition flecs.h:828
ecs_query_t::read_fields
ecs_flags32_t read_fields
Fields that read data.
Definition flecs.h:830
ecs_query_t::hdr
ecs_header_t hdr
Object header.
Definition flecs.h:812
ecs_query_t::var_count
int8_t var_count
Number of query variables.
Definition flecs.h:820
ecs_query_t::fixed_fields
ecs_flags32_t fixed_fields
Fields with a fixed source.
Definition flecs.h:825
ecs_query_t::var_fields
ecs_flags32_t var_fields
Fields with non-$this variable source.
Definition flecs.h:826
ecs_query_t::write_fields
ecs_flags32_t write_fields
Fields that write data.
Definition flecs.h:829
ecs_query_t::eval_count
int32_t eval_count
Number of times query is evaluated.
Definition flecs.h:846
ecs_query_t::world
ecs_world_t * world
World or stage query was created with.
Definition flecs.h:844
ecs_query_t::static_id_fields
ecs_flags32_t static_id_fields
Fields with a static (component) id.
Definition flecs.h:827
ecs_query_t::bloom_filter
uint64_t bloom_filter
Bitmask used to quickly discard tables.
Definition flecs.h:818
ecs_query_t::real_world
ecs_world_t * real_world
Actual world.
Definition flecs.h:843
ecs_query_t::set_fields
ecs_flags32_t set_fields
Fields that will be set.
Definition flecs.h:833
ecs_query_t::entity
ecs_entity_t entity
Entity associated with query (optional)
Definition flecs.h:842
ecs_query_t::ctx
void * ctx
User context to pass to callback.
Definition flecs.h:839
ecs_query_t::sizes
int32_t * sizes
Component sizes.
Definition flecs.h:815
ecs_query_t::ids
ecs_id_t * ids
Component ids.
Definition flecs.h:816
ecs_query_t::shared_readonly_fields
ecs_flags32_t shared_readonly_fields
Fields that don't write shared data.
Definition flecs.h:832
ecs_query_t::terms
ecs_term_t * terms
Query terms.
Definition flecs.h:814
ecs_query_t::cache_kind
ecs_query_cache_kind_t cache_kind
Caching policy of query.
Definition flecs.h:835
ecs_query_t::term_count
int8_t term_count
Number of query terms.
Definition flecs.h:821
ecs_query_t::vars
char ** vars
Array with variable names for iterator.
Definition flecs.h:837
ecs_query_t::field_count
int8_t field_count
Number of fields returned by query.
Definition flecs.h:822
ecs_query_t::flags
ecs_flags32_t flags
Query flags.
Definition flecs.h:819
ecs_query_t::binding_ctx
void * binding_ctx
Context to be used for language bindings.
Definition flecs.h:840
ecs_term_ref_t
Type that describes a reference to an entity or variable in a term.
Definition flecs.h:772
ecs_term_ref_t::name
const char * name
Name.
Definition flecs.h:779
ecs_term_ref_t::id
ecs_entity_t id
Entity id.
Definition flecs.h:773
ecs_term_t
Type that describes a term (single element in a query).
Definition flecs.h:787
ecs_term_t::src
ecs_term_ref_t src
Source of term.
Definition flecs.h:793
ecs_term_t::field_index
int8_t field_index
Index of field for term in iterator.
Definition flecs.h:804
ecs_term_t::id
ecs_id_t id
Component id to be matched by term.
Definition flecs.h:788
ecs_term_t::oper
int16_t oper
Operator of term.
Definition flecs.h:802
ecs_term_t::second
ecs_term_ref_t second
Second element of pair.
Definition flecs.h:795
ecs_term_t::flags_
ecs_flags16_t flags_
Flags that help eval, set by ecs_query_init()
Definition flecs.h:805
ecs_term_t::trav
ecs_entity_t trav
Relationship to traverse when looking for the component.
Definition flecs.h:797
ecs_term_t::inout
int16_t inout
Access to contents matched by term.
Definition flecs.h:801
ecs_term_t::first
ecs_term_ref_t first
Component or first element of pair.
Definition flecs.h:794
ecs_type_hooks_t
Definition flecs.h:924
ecs_type_hooks_t::copy_ctor
ecs_copy_t copy_ctor
Ctor + copy.
Definition flecs.h:931
ecs_type_hooks_t::lifecycle_ctx
void * lifecycle_ctx
Component lifecycle context (see meta add-on)
Definition flecs.h:977
ecs_type_hooks_t::ctx
void * ctx
User defined context.
Definition flecs.h:975
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:973
ecs_type_hooks_t::binding_ctx
void * binding_ctx
Language binding context.
Definition flecs.h:976
ecs_type_hooks_t::move_dtor
ecs_move_t move_dtor
Move + dtor.
Definition flecs.h:946
ecs_type_hooks_t::flags
ecs_flags32_t flags
Hook flags.
Definition flecs.h:958
ecs_type_hooks_t::cmp
ecs_cmp_t cmp
Compare hook.
Definition flecs.h:949
ecs_type_hooks_t::copy
ecs_copy_t copy
copy assignment
Definition flecs.h:927
ecs_type_hooks_t::lifecycle_ctx_free
ecs_ctx_free_t lifecycle_ctx_free
Callback to free lifecycle_ctx.
Definition flecs.h:981
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:968
ecs_type_hooks_t::move
ecs_move_t move
move assignment
Definition flecs.h:928
ecs_type_hooks_t::ctor
ecs_xtor_t ctor
ctor
Definition flecs.h:925
ecs_type_hooks_t::ctx_free
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:979
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:963
ecs_type_hooks_t::binding_ctx_free
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:980
ecs_type_hooks_t::move_ctor
ecs_move_t move_ctor
Ctor + move.
Definition flecs.h:934
ecs_type_hooks_t::equals
ecs_equals_t equals
Equals hook.
Definition flecs.h:952
ecs_type_hooks_t::ctor_move_dtor
ecs_move_t ctor_move_dtor
Ctor + move + dtor (or move_ctor + dtor).
Definition flecs.h:940
ecs_type_hooks_t::dtor
ecs_xtor_t dtor
dtor
Definition flecs.h:926
ecs_type_info_t
Type that contains component information (passed to ctors/dtors/...)
Definition flecs.h:988
ecs_type_info_t::alignment
ecs_size_t alignment
Alignment of type.
Definition flecs.h:990
ecs_type_info_t::size
ecs_size_t size
Size of type.
Definition flecs.h:989
ecs_type_info_t::name
const char * name
Type name.
Definition flecs.h:993
ecs_type_info_t::component
ecs_entity_t component
Handle to component (do not set)
Definition flecs.h:992
ecs_type_info_t::hooks
ecs_type_hooks_t hooks
Type hooks.
Definition flecs.h:991
ecs_type_t
A type is a list of (component) ids.
Definition flecs.h:397
ecs_type_t::array
ecs_id_t * array
Array with ids.
Definition flecs.h:398
ecs_type_t::count
int32_t count
Number of elements in array.
Definition flecs.h:399
ecs_value_t
Utility to hold a value of a dynamic type.
Definition flecs.h:1002
ecs_value_t::ptr
void * ptr
Pointer to value.
Definition flecs.h:1004
ecs_value_t::type
ecs_entity_t type
Type of value.
Definition flecs.h:1003
ecs_world_info_t
Type that contains information about the world.
Definition flecs.h:1447
ecs_world_info_t::delta_time
float delta_time
Time passed to or computed by ecs_progress()
Definition flecs.h:1453
ecs_world_info_t::min_id
ecs_entity_t min_id
First allowed entity id.
Definition flecs.h:1449
ecs_world_info_t::set_count
int64_t set_count
Set commands processed.
Definition flecs.h:1489
ecs_world_info_t::world_time_total
double world_time_total
Time elapsed in simulation.
Definition flecs.h:1461
ecs_world_info_t::tag_id_count
int32_t tag_id_count
Number of tag (no data) ids in the world.
Definition flecs.h:1477
ecs_world_info_t::component_id_count
int32_t component_id_count
Number of component (data) ids in the world.
Definition flecs.h:1478
ecs_world_info_t::pipeline_build_count_total
int64_t pipeline_build_count_total
Total number of pipeline builds.
Definition flecs.h:1473
ecs_world_info_t::eval_comp_monitors_total
int64_t eval_comp_monitors_total
Total number of monitor evaluations.
Definition flecs.h:1466
ecs_world_info_t::table_count
int32_t table_count
Number of tables.
Definition flecs.h:1481
ecs_world_info_t::delta_time_raw
float delta_time_raw
Raw delta time (no time scaling)
Definition flecs.h:1452
ecs_world_info_t::frame_time_total
float frame_time_total
Total time spent processing a frame.
Definition flecs.h:1456
ecs_world_info_t::table_create_total
int64_t table_create_total
Total number of times a table was created.
Definition flecs.h:1471
ecs_world_info_t::observers_ran_frame
int64_t observers_ran_frame
Total number of times observer was invoked.
Definition flecs.h:1475
ecs_world_info_t::system_time_total
float system_time_total
Total time spent in systems.
Definition flecs.h:1457
ecs_world_info_t::id_delete_total
int64_t id_delete_total
Total number of times an id was deleted.
Definition flecs.h:1470
ecs_world_info_t::systems_ran_frame
int64_t systems_ran_frame
Total number of systems ran in last frame.
Definition flecs.h:1474
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:1459
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:1492
ecs_world_info_t::clear_count
int64_t clear_count
Clear commands processed.
Definition flecs.h:1488
ecs_world_info_t::last_component_id
ecs_entity_t last_component_id
Last issued component entity id.
Definition flecs.h:1448
ecs_world_info_t::frame_count_total
int64_t frame_count_total
Total number of frames.
Definition flecs.h:1464
ecs_world_info_t::max_id
ecs_entity_t max_id
Last allowed entity id.
Definition flecs.h:1450
ecs_world_info_t::merge_count_total
int64_t merge_count_total
Total number of merges.
Definition flecs.h:1465
ecs_world_info_t::other_count
int64_t other_count
Other commands processed.
Definition flecs.h:1494
ecs_world_info_t::batched_command_count
int64_t batched_command_count
Commands batched.
Definition flecs.h:1496
ecs_world_info_t::table_delete_total
int64_t table_delete_total
Total number of times a table was deleted.
Definition flecs.h:1472
ecs_world_info_t::delete_count
int64_t delete_count
Selete commands processed.
Definition flecs.h:1487
ecs_world_info_t::rematch_count_total
int64_t rematch_count_total
Total number of rematches.
Definition flecs.h:1467
ecs_world_info_t::id_create_total
int64_t id_create_total
Total number of times a new id was created.
Definition flecs.h:1469
ecs_world_info_t::batched_entity_count
int64_t batched_entity_count
Entities for which commands were batched.
Definition flecs.h:1495
ecs_world_info_t::time_scale
float time_scale
Time scale applied to delta_time.
Definition flecs.h:1454
ecs_world_info_t::pair_id_count
int32_t pair_id_count
Number of pair ids in the world.
Definition flecs.h:1479
ecs_world_info_t::rematch_time_total
float rematch_time_total
Time spent on query rematching.
Definition flecs.h:1460
ecs_world_info_t::ensure_count
int64_t ensure_count
Ensure/emplace commands processed.
Definition flecs.h:1490
ecs_world_info_t::target_fps
float target_fps
Target fps.
Definition flecs.h:1455
ecs_world_info_t::world_time_total_raw
double world_time_total_raw
Time elapsed in simulation (no scaling)
Definition flecs.h:1462
ecs_world_info_t::emit_time_total
float emit_time_total
Total time spent notifying observers.
Definition flecs.h:1458
ecs_world_info_t::modified_count
int64_t modified_count
Modified commands processed.
Definition flecs.h:1491
ecs_world_info_t::name_prefix
const char * name_prefix
Value set by ecs_set_name_prefix().
Definition flecs.h:1499
ecs_world_info_t::event_count
int64_t event_count
Enqueued custom events.
Definition flecs.h:1493
ecs_world_info_t::add_count
int64_t add_count
Add commands processed.
Definition flecs.h:1485
ecs_world_info_t::remove_count
int64_t remove_count
Remove commands processed.
Definition flecs.h:1486