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 0
36#define FLECS_VERSION_PATCH 4
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
111/* Tip: if you see weird behavior that you think might be a bug, make sure to
112 * test with the FLECS_DEBUG or FLECS_SANITIZE flags enabled. There's a good
113 * chance that this gives you more information about the issue! */
114
128// #define FLECS_SOFT_ASSERT
129
135// #define FLECS_KEEP_ASSERT
136
145// #define FLECS_CPP_NO_AUTO_REGISTRATION
146
174// #define FLECS_CUSTOM_BUILD
175
176#ifndef FLECS_CUSTOM_BUILD
177#define FLECS_ALERTS
178#define FLECS_APP
179// #define FLECS_C /**< C API convenience macros, always enabled */
180#define FLECS_CPP
181#define FLECS_DOC
182// #define FLECS_JOURNAL /**< Journaling addon (disabled by default) */
183#define FLECS_JSON
184#define FLECS_HTTP
185#define FLECS_LOG
186#define FLECS_META
187#define FLECS_METRICS
188#define FLECS_MODULE
189#define FLECS_OS_API_IMPL
190// #define FLECS_PERF_TRACE /**< Enable performance tracing (disabled by default) */
191#define FLECS_PIPELINE
192#define FLECS_REST
193#define FLECS_SCRIPT
194// #define FLECS_SCRIPT_MATH /**< Math functions for flecs script (may require linking with libm) */
195#define FLECS_SYSTEM
196#define FLECS_STATS
197#define FLECS_TIMER
198#define FLECS_UNITS
199#endif // ifndef FLECS_CUSTOM_BUILD
200
204// #define FLECS_LOW_FOOTPRINT
205#ifdef FLECS_LOW_FOOTPRINT
206#define FLECS_HI_COMPONENT_ID (16)
207#define FLECS_HI_ID_RECORD_ID (16)
208#define FLECS_SPARSE_PAGE_BITS (4)
209#define FLECS_ENTITY_PAGE_BITS (6)
210#define FLECS_USE_OS_ALLOC
211#endif
212
223#ifndef FLECS_HI_COMPONENT_ID
224#define FLECS_HI_COMPONENT_ID (256)
225#endif
226
233#ifndef FLECS_HI_ID_RECORD_ID
234#define FLECS_HI_ID_RECORD_ID (1024)
235#endif
236
242#ifndef FLECS_SPARSE_PAGE_BITS
243#define FLECS_SPARSE_PAGE_BITS (6)
244#endif
245
248#ifndef FLECS_ENTITY_PAGE_BITS
249#define FLECS_ENTITY_PAGE_BITS (12)
250#endif
251
256// #define FLECS_USE_OS_ALLOC
257
260#ifndef FLECS_ID_DESC_MAX
261#define FLECS_ID_DESC_MAX (32)
262#endif
263
266#ifndef FLECS_EVENT_DESC_MAX
267#define FLECS_EVENT_DESC_MAX (8)
268#endif
269
272#define FLECS_VARIABLE_COUNT_MAX (64)
273
276#ifndef FLECS_TERM_COUNT_MAX
277#define FLECS_TERM_COUNT_MAX 32
278#endif
279
282#ifndef FLECS_TERM_ARG_COUNT_MAX
283#define FLECS_TERM_ARG_COUNT_MAX (16)
284#endif
285
288#ifndef FLECS_QUERY_VARIABLE_COUNT_MAX
289#define FLECS_QUERY_VARIABLE_COUNT_MAX (64)
290#endif
291
294#ifndef FLECS_QUERY_SCOPE_NESTING_MAX
295#define FLECS_QUERY_SCOPE_NESTING_MAX (8)
296#endif
297
302#ifndef FLECS_DAG_DEPTH_MAX
303#define FLECS_DAG_DEPTH_MAX (128)
304#endif
305
307
308#include "flecs/private/api_defines.h"
309#include "flecs/datastructures/vec.h" /* Vector datatype */
310#include "flecs/datastructures/sparse.h" /* Sparse set */
311#include "flecs/datastructures/block_allocator.h" /* Block allocator */
312#include "flecs/datastructures/stack_allocator.h" /* Stack allocator */
313#include "flecs/datastructures/map.h" /* Map */
314#include "flecs/datastructures/switch_list.h" /* Switch list */
315#include "flecs/datastructures/allocator.h" /* Allocator */
316#include "flecs/datastructures/strbuf.h" /* String builder */
317#include "flecs/os_api.h" /* Abstraction for operating system functions */
318
319#ifdef __cplusplus
320extern "C" {
321#endif
322
329
336
339 typedef uint64_t ecs_id_t;
340
346 typedef ecs_id_t ecs_entity_t;
347
363 typedef struct {
364 ecs_id_t *array;
365 int32_t count;
366} ecs_type_t;
367
390 typedef struct ecs_world_t ecs_world_t;
391
393 typedef struct ecs_stage_t ecs_stage_t;
394
396 typedef struct ecs_table_t ecs_table_t;
397
399 typedef struct ecs_term_t ecs_term_t;
400
402 typedef struct ecs_query_t ecs_query_t;
403
421 typedef struct ecs_observer_t ecs_observer_t;
422
426 typedef struct ecs_observable_t ecs_observable_t;
427
432 typedef struct ecs_iter_t ecs_iter_t;
433
442 typedef struct ecs_ref_t ecs_ref_t;
443
447 typedef struct ecs_type_hooks_t ecs_type_hooks_t;
448
452 typedef struct ecs_type_info_t ecs_type_info_t;
453
455 typedef struct ecs_record_t ecs_record_t;
456
458 typedef struct ecs_id_record_t ecs_id_record_t;
459
479 typedef void ecs_poly_t;
480
482 typedef struct ecs_mixins_t ecs_mixins_t;
483
485 typedef struct ecs_header_t {
486 int32_t magic;
487 int32_t type;
488 int32_t refcount;
489 ecs_mixins_t *mixins;
490} ecs_header_t;
491
493 struct ecs_record_t {
494 ecs_id_record_t *idr;
495 ecs_table_t *table;
496 uint32_t row;
497 int32_t dense;
498};
499
501 typedef struct ecs_table_cache_hdr_t {
502 struct ecs_table_cache_t *cache;
503 ecs_table_t *table;
504 struct ecs_table_cache_hdr_t *prev, *next;
505} ecs_table_cache_hdr_t;
506
511 typedef struct ecs_table_record_t {
512 ecs_table_cache_hdr_t hdr;
513 int16_t index;
514 int16_t count;
515 int16_t column;
516} ecs_table_record_t;
517
519
526
536 typedef void (*ecs_run_action_t)(
537 ecs_iter_t *it);
538
545 typedef void (*ecs_iter_action_t)(
546 ecs_iter_t *it);
547
555 typedef bool (*ecs_iter_next_action_t)(
556 ecs_iter_t *it);
557
563 typedef void (*ecs_iter_fini_action_t)(
564 ecs_iter_t *it);
565
567 typedef int (*ecs_order_by_action_t)(
568 ecs_entity_t e1,
569 const void *ptr1,
570 ecs_entity_t e2,
571 const void *ptr2);
572
574 typedef void (*ecs_sort_table_action_t)(
575 ecs_world_t* world,
576 ecs_table_t* table,
577 ecs_entity_t* entities,
578 void* ptr,
579 int32_t size,
580 int32_t lo,
581 int32_t hi,
582 ecs_order_by_action_t order_by);
583
585 typedef uint64_t (*ecs_group_by_action_t)(
586 ecs_world_t *world,
587 ecs_table_t *table,
588 ecs_id_t group_id,
589 void *ctx);
590
592 typedef void* (*ecs_group_create_action_t)(
593 ecs_world_t *world,
594 uint64_t group_id,
595 void *group_by_ctx); /* from ecs_query_desc_t */
596
598 typedef void (*ecs_group_delete_action_t)(
599 ecs_world_t *world,
600 uint64_t group_id,
601 void *group_ctx, /* return value from ecs_group_create_action_t */
602 void *group_by_ctx); /* from ecs_query_desc_t */
603
605 typedef void (*ecs_module_action_t)(
606 ecs_world_t *world);
607
609 typedef void (*ecs_fini_action_t)(
610 ecs_world_t *world,
611 void *ctx);
612
614 typedef void (*ecs_ctx_free_t)(
615 void *ctx);
616
618 typedef int (*ecs_compare_action_t)(
619 const void *ptr1,
620 const void *ptr2);
621
623 typedef uint64_t (*ecs_hash_value_action_t)(
624 const void *ptr);
625
627 typedef void (*ecs_xtor_t)(
628 void *ptr,
629 int32_t count,
630 const ecs_type_info_t *type_info);
631
633 typedef void (*ecs_copy_t)(
634 void *dst_ptr,
635 const void *src_ptr,
636 int32_t count,
637 const ecs_type_info_t *type_info);
638
640 typedef void (*ecs_move_t)(
641 void *dst_ptr,
642 void *src_ptr,
643 int32_t count,
644 const ecs_type_info_t *type_info);
645
647 typedef void (*flecs_poly_dtor_t)(
648 ecs_poly_t *poly);
649
651
658
660 typedef enum ecs_inout_kind_t {
661 EcsInOutDefault,
662 EcsInOutNone,
663 EcsInOutFilter,
664 EcsInOut,
665 EcsIn,
666 EcsOut,
667} ecs_inout_kind_t;
668
670 typedef enum ecs_oper_kind_t {
671 EcsAnd,
672 EcsOr,
673 EcsNot,
674 EcsOptional,
675 EcsAndFrom,
676 EcsOrFrom,
677 EcsNotFrom,
678} ecs_oper_kind_t;
679
681 typedef enum ecs_query_cache_kind_t {
682 EcsQueryCacheDefault,
683 EcsQueryCacheAuto,
684 EcsQueryCacheAll,
685 EcsQueryCacheNone,
686} ecs_query_cache_kind_t;
687
688/* Term id flags */
689
694#define EcsSelf (1llu << 63)
695
700#define EcsUp (1llu << 62)
701
706#define EcsTrav (1llu << 61)
707
712#define EcsCascade (1llu << 60)
713
718#define EcsDesc (1llu << 59)
719
724#define EcsIsVariable (1llu << 58)
725
730#define EcsIsEntity (1llu << 57)
731
736#define EcsIsName (1llu << 56)
737
742#define EcsTraverseFlags (EcsSelf|EcsUp|EcsTrav|EcsCascade|EcsDesc)
743
748#define EcsTermRefFlags (EcsTraverseFlags|EcsIsVariable|EcsIsEntity|EcsIsName)
749
751 typedef struct ecs_term_ref_t {
752 ecs_entity_t id;
757
758 const char *name;
763} ecs_term_ref_t;
764
766 struct ecs_term_t {
767 ecs_id_t id;
771
772 ecs_term_ref_t src;
773 ecs_term_ref_t first;
774 ecs_term_ref_t second;
775
776 ecs_entity_t trav;
779
780 int16_t inout;
781 int16_t oper;
782
783 int8_t field_index;
784 ecs_flags16_t flags_;
785};
786
790 struct ecs_query_t {
791 ecs_header_t hdr;
792
793 ecs_term_t terms[FLECS_TERM_COUNT_MAX];
794 int32_t sizes[FLECS_TERM_COUNT_MAX];
795 ecs_id_t ids[FLECS_TERM_COUNT_MAX];
796
797 ecs_flags32_t flags;
798 int8_t var_count;
799 int8_t term_count;
800 int8_t field_count;
801
802 /* Bitmasks for quick field information lookups */
803 ecs_termset_t fixed_fields;
804 ecs_termset_t var_fields;
805 ecs_termset_t static_id_fields;
806 ecs_termset_t data_fields;
807 ecs_termset_t write_fields;
808 ecs_termset_t read_fields;
809 ecs_termset_t row_fields;
810 ecs_termset_t shared_readonly_fields;
811 ecs_termset_t set_fields;
812
813 ecs_query_cache_kind_t cache_kind;
814
815 char **vars;
816
817 void *ctx;
818 void *binding_ctx;
819
820 ecs_entity_t entity;
821 ecs_world_t *real_world;
822 ecs_world_t *world;
823
824 int32_t eval_count;
825};
826
830 struct ecs_observer_t {
831 ecs_header_t hdr;
832
833 ecs_query_t *query;
834
836 ecs_entity_t events[FLECS_EVENT_DESC_MAX];
837 int32_t event_count;
838
839 ecs_iter_action_t callback;
840 ecs_run_action_t run;
841
842 void *ctx;
843 void *callback_ctx;
844 void *run_ctx;
845
846 ecs_ctx_free_t ctx_free;
847 ecs_ctx_free_t callback_ctx_free;
848 ecs_ctx_free_t run_ctx_free;
849
850 ecs_observable_t *observable;
851
852 ecs_world_t *world;
853 ecs_entity_t entity;
854};
855
857
862
863/* Flags that can be used to check which hooks a type has set */
864#define ECS_TYPE_HOOK_CTOR (1 << 0)
865#define ECS_TYPE_HOOK_DTOR (1 << 1)
866#define ECS_TYPE_HOOK_COPY (1 << 2)
867#define ECS_TYPE_HOOK_MOVE (1 << 3)
868#define ECS_TYPE_HOOK_COPY_CTOR (1 << 4)
869#define ECS_TYPE_HOOK_MOVE_CTOR (1 << 5)
870#define ECS_TYPE_HOOK_CTOR_MOVE_DTOR (1 << 6)
871#define ECS_TYPE_HOOK_MOVE_DTOR (1 << 7)
872
873/* Flags that can be used to set/check which hooks of a type are invalid */
874#define ECS_TYPE_HOOK_CTOR_ILLEGAL (1 << 8)
875#define ECS_TYPE_HOOK_DTOR_ILLEGAL (1 << 9)
876#define ECS_TYPE_HOOK_COPY_ILLEGAL (1 << 10)
877#define ECS_TYPE_HOOK_MOVE_ILLEGAL (1 << 11)
878#define ECS_TYPE_HOOK_COPY_CTOR_ILLEGAL (1 << 12)
879#define ECS_TYPE_HOOK_MOVE_CTOR_ILLEGAL (1 << 13)
880#define ECS_TYPE_HOOK_CTOR_MOVE_DTOR_ILLEGAL (1 << 14)
881#define ECS_TYPE_HOOK_MOVE_DTOR_ILLEGAL (1 << 15)
882
883/* All valid hook flags */
884#define ECS_TYPE_HOOKS (ECS_TYPE_HOOK_CTOR|ECS_TYPE_HOOK_DTOR|\
885 ECS_TYPE_HOOK_COPY|ECS_TYPE_HOOK_MOVE|ECS_TYPE_HOOK_COPY_CTOR|\
886 ECS_TYPE_HOOK_MOVE_CTOR|ECS_TYPE_HOOK_CTOR_MOVE_DTOR|\
887 ECS_TYPE_HOOK_MOVE_DTOR)
888
889/* All invalid hook flags */
890#define ECS_TYPE_HOOKS_ILLEGAL (ECS_TYPE_HOOK_CTOR_ILLEGAL|\
891 ECS_TYPE_HOOK_DTOR_ILLEGAL|ECS_TYPE_HOOK_COPY_ILLEGAL|\
892 ECS_TYPE_HOOK_MOVE_ILLEGAL|ECS_TYPE_HOOK_COPY_CTOR_ILLEGAL|\
893 ECS_TYPE_HOOK_MOVE_CTOR_ILLEGAL|ECS_TYPE_HOOK_CTOR_MOVE_DTOR_ILLEGAL|\
894 ECS_TYPE_HOOK_MOVE_DTOR_ILLEGAL)
895
896 struct ecs_type_hooks_t {
897 ecs_xtor_t ctor;
898 ecs_xtor_t dtor;
899 ecs_copy_t copy;
900 ecs_move_t move;
901
903 ecs_copy_t copy_ctor;
904
906 ecs_move_t move_ctor;
907
912 ecs_move_t ctor_move_dtor;
913
918 ecs_move_t move_dtor;
919
924 ecs_flags32_t flags;
925
928 ecs_iter_action_t on_add;
929
933 ecs_iter_action_t on_set;
934
938 ecs_iter_action_t on_remove;
939
940 void *ctx;
941 void *binding_ctx;
942 void *lifecycle_ctx;
943
944 ecs_ctx_free_t ctx_free;
945 ecs_ctx_free_t binding_ctx_free;
946 ecs_ctx_free_t lifecycle_ctx_free;
947};
948
953 struct ecs_type_info_t {
954 ecs_size_t size;
955 ecs_size_t alignment;
956 ecs_type_hooks_t hooks;
957 ecs_entity_t component;
958 const char *name;
959};
960
961#include "flecs/private/api_types.h" /* Supporting API types */
962#include "flecs/private/api_support.h" /* Supporting API functions */
963#include "flecs/datastructures/hashmap.h" /* Hashmap */
964
966 typedef struct ecs_value_t {
967 ecs_entity_t type;
968 void *ptr;
969} ecs_value_t;
970
975 typedef struct ecs_entity_desc_t {
976 int32_t _canary;
977
978 ecs_entity_t id;
979
980 ecs_entity_t parent;
981
982 const char *name;
986
987 const char *sep;
990
991 const char *root_sep;
992
993 const char *symbol;
1002
1003 bool use_low_id;
1006
1008 const ecs_id_t *add;
1009
1011 const ecs_value_t *set;
1012
1014 const char *add_expr;
1015} ecs_entity_desc_t;
1016
1021 typedef struct ecs_bulk_desc_t {
1022 int32_t _canary;
1023
1024 ecs_entity_t *entities;
1028
1029 int32_t count;
1030
1031 ecs_id_t ids[FLECS_ID_DESC_MAX];
1032
1033 void **data;
1039
1040 ecs_table_t *table;
1044
1045} ecs_bulk_desc_t;
1046
1051 typedef struct ecs_component_desc_t {
1052 int32_t _canary;
1053
1055 ecs_entity_t entity;
1056
1058 ecs_type_info_t type;
1059} ecs_component_desc_t;
1060
1099 struct ecs_iter_t {
1100 /* World */
1101 ecs_world_t *world;
1102 ecs_world_t *real_world;
1103
1104 /* Matched data */
1105 const ecs_entity_t *entities;
1106 const ecs_size_t *sizes;
1107 ecs_table_t *table;
1108 ecs_table_t *other_table;
1109 ecs_id_t *ids;
1110 ecs_var_t *variables;
1111 const ecs_table_record_t **trs;
1112 ecs_entity_t *sources;
1113 ecs_flags64_t constrained_vars;
1114 uint64_t group_id;
1115 ecs_termset_t set_fields;
1116 ecs_termset_t ref_fields;
1117 ecs_termset_t row_fields;
1118 ecs_termset_t up_fields;
1119
1120 /* Input information */
1121 ecs_entity_t system;
1122 ecs_entity_t event;
1123 ecs_id_t event_id;
1124 int32_t event_cur;
1125
1126 /* Query information */
1127 int8_t field_count;
1128 int8_t term_index;
1131 int8_t variable_count;
1132 const ecs_query_t *query;
1133 char **variable_names;
1134
1135 /* Context */
1136 void *param;
1137 void *ctx;
1138 void *binding_ctx;
1139 void *callback_ctx;
1140 void *run_ctx;
1141
1142 /* Time */
1143 ecs_ftime_t delta_time;
1144 ecs_ftime_t delta_system_time;
1145
1146 /* Iterator counters */
1147 int32_t frame_offset;
1148 int32_t offset;
1149 int32_t count;
1150
1151 /* Misc */
1152 ecs_flags32_t flags;
1153 ecs_entity_t interrupted_by;
1154 ecs_iter_private_t priv_;
1155
1156 /* Chained iterators */
1157 ecs_iter_next_action_t next;
1158 ecs_iter_action_t callback;
1159 ecs_iter_fini_action_t fini;
1160 ecs_iter_t *chain_it;
1161};
1162
1163
1168#define EcsQueryMatchPrefab (1u << 1u)
1169
1174#define EcsQueryMatchDisabled (1u << 2u)
1175
1180#define EcsQueryMatchEmptyTables (1u << 3u)
1181
1186#define EcsQueryAllowUnresolvedByName (1u << 6u)
1187
1192#define EcsQueryTableOnly (1u << 7u)
1193
1194
1199 typedef struct ecs_query_desc_t {
1201 int32_t _canary;
1202
1204 ecs_term_t terms[FLECS_TERM_COUNT_MAX];
1205
1207 const char *expr;
1208
1210 ecs_query_cache_kind_t cache_kind;
1211
1213 ecs_flags32_t flags;
1214
1218 ecs_order_by_action_t order_by_callback;
1219
1222 ecs_sort_table_action_t order_by_table_callback;
1223
1226 ecs_entity_t order_by;
1227
1230 ecs_id_t group_by;
1231
1237 ecs_group_by_action_t group_by_callback;
1238
1241 ecs_group_create_action_t on_group_create;
1242
1245 ecs_group_delete_action_t on_group_delete;
1246
1248 void *group_by_ctx;
1249
1251 ecs_ctx_free_t group_by_ctx_free;
1252
1254 void *ctx;
1255
1257 void *binding_ctx;
1258
1260 ecs_ctx_free_t ctx_free;
1261
1263 ecs_ctx_free_t binding_ctx_free;
1264
1266 ecs_entity_t entity;
1267} ecs_query_desc_t;
1268
1273 typedef struct ecs_observer_desc_t {
1275 int32_t _canary;
1276
1278 ecs_entity_t entity;
1279
1281 ecs_query_desc_t query;
1282
1284 ecs_entity_t events[FLECS_EVENT_DESC_MAX];
1285
1288 bool yield_existing;
1289
1291 ecs_iter_action_t callback;
1292
1299 ecs_run_action_t run;
1300
1302 void *ctx;
1303
1305 ecs_ctx_free_t ctx_free;
1306
1308 void *callback_ctx;
1309
1311 ecs_ctx_free_t callback_ctx_free;
1312
1314 void *run_ctx;
1315
1317 ecs_ctx_free_t run_ctx_free;
1318
1320 ecs_poly_t *observable;
1321
1324 int32_t *last_event_id;
1325
1327 int8_t term_index_;
1328 ecs_flags32_t flags_;
1329} ecs_observer_desc_t;
1330
1335 typedef struct ecs_event_desc_t {
1337 ecs_entity_t event;
1338
1342 const ecs_type_t *ids;
1343
1345 ecs_table_t *table;
1346
1349 ecs_table_t *other_table;
1350
1352 int32_t offset;
1353
1357 int32_t count;
1358
1360 ecs_entity_t entity;
1361
1366 void *param;
1367
1371 const void *const_param;
1372
1374 ecs_poly_t *observable;
1375
1377 ecs_flags32_t flags;
1378} ecs_event_desc_t;
1379
1380
1387
1389 typedef struct ecs_build_info_t {
1390 const char *compiler;
1391 const char **addons;
1392 const char *version;
1393 int16_t version_major;
1394 int16_t version_minor;
1395 int16_t version_patch;
1396 bool debug;
1397 bool sanitize;
1398 bool perf_trace;
1399} ecs_build_info_t;
1400
1402 typedef struct ecs_world_info_t {
1403 ecs_entity_t last_component_id;
1404 ecs_entity_t min_id;
1405 ecs_entity_t max_id;
1406
1407 ecs_ftime_t delta_time_raw;
1408 ecs_ftime_t delta_time;
1409 ecs_ftime_t time_scale;
1410 ecs_ftime_t target_fps;
1411 ecs_ftime_t frame_time_total;
1412 ecs_ftime_t system_time_total;
1413 ecs_ftime_t emit_time_total;
1414 ecs_ftime_t merge_time_total;
1415 ecs_ftime_t rematch_time_total;
1416 double world_time_total;
1417 double world_time_total_raw;
1418
1419 int64_t frame_count_total;
1420 int64_t merge_count_total;
1421 int64_t eval_comp_monitors_total;
1422 int64_t rematch_count_total;
1423
1424 int64_t id_create_total;
1425 int64_t id_delete_total;
1426 int64_t table_create_total;
1427 int64_t table_delete_total;
1428 int64_t pipeline_build_count_total;
1429 int64_t systems_ran_frame;
1430 int64_t observers_ran_frame;
1431
1432 int32_t tag_id_count;
1433 int32_t component_id_count;
1434 int32_t pair_id_count;
1435
1436 int32_t table_count;
1437
1438 /* -- Command counts -- */
1439 struct {
1440 int64_t add_count;
1441 int64_t remove_count;
1442 int64_t delete_count;
1443 int64_t clear_count;
1444 int64_t set_count;
1445 int64_t ensure_count;
1446 int64_t modified_count;
1447 int64_t discard_count;
1448 int64_t event_count;
1449 int64_t other_count;
1450 int64_t batched_entity_count;
1451 int64_t batched_command_count;
1452 } cmd;
1453
1454 const char *name_prefix;
1458} ecs_world_info_t;
1459
1461 typedef struct ecs_query_group_info_t {
1462 int32_t match_count;
1463 int32_t table_count;
1464 void *ctx;
1465} ecs_query_group_info_t;
1466
1468
1475
1477 typedef struct EcsIdentifier {
1478 char *value;
1479 ecs_size_t length;
1480 uint64_t hash;
1481 uint64_t index_hash;
1482 ecs_hashmap_t *index;
1483} EcsIdentifier;
1484
1486 typedef struct EcsComponent {
1487 ecs_size_t size;
1488 ecs_size_t alignment;
1489} EcsComponent;
1490
1492 typedef struct EcsPoly {
1493 ecs_poly_t *poly;
1494} EcsPoly;
1495
1501 typedef struct EcsDefaultChildComponent {
1502 ecs_id_t component;
1503} EcsDefaultChildComponent;
1504
1507
1508/* Only include deprecated definitions if deprecated addon is required */
1509#ifdef FLECS_DEPRECATED
1510#include "flecs/addons/deprecated.h"
1511#endif
1512
1519
1526
1528FLECS_API extern const ecs_id_t ECS_PAIR;
1529
1531FLECS_API extern const ecs_id_t ECS_AUTO_OVERRIDE;
1532
1534FLECS_API extern const ecs_id_t ECS_TOGGLE;
1535
1537
1542
1543/* Builtin component ids */
1544
1546FLECS_API extern const ecs_entity_t ecs_id(EcsComponent);
1547
1549FLECS_API extern const ecs_entity_t ecs_id(EcsIdentifier);
1550
1552FLECS_API extern const ecs_entity_t ecs_id(EcsPoly);
1553
1555FLECS_API extern const ecs_entity_t ecs_id(EcsDefaultChildComponent);
1556
1558FLECS_API extern const ecs_entity_t EcsQuery;
1559
1561FLECS_API extern const ecs_entity_t EcsObserver;
1562
1564FLECS_API extern const ecs_entity_t EcsSystem;
1565
1567FLECS_API extern const ecs_entity_t ecs_id(EcsTickSource);
1568
1570FLECS_API extern const ecs_entity_t ecs_id(EcsPipelineQuery);
1571
1573FLECS_API extern const ecs_entity_t ecs_id(EcsTimer);
1574
1576FLECS_API extern const ecs_entity_t ecs_id(EcsRateFilter);
1577
1579FLECS_API extern const ecs_entity_t EcsFlecs;
1580
1582FLECS_API extern const ecs_entity_t EcsFlecsCore;
1583
1585FLECS_API extern const ecs_entity_t EcsWorld;
1586
1588FLECS_API extern const ecs_entity_t EcsWildcard;
1589
1591FLECS_API extern const ecs_entity_t EcsAny;
1592
1594FLECS_API extern const ecs_entity_t EcsThis;
1595
1597FLECS_API extern const ecs_entity_t EcsVariable;
1598
1600#define EcsSingleton EcsVariable
1601
1609FLECS_API extern const ecs_entity_t EcsTransitive;
1610
1618FLECS_API extern const ecs_entity_t EcsReflexive;
1619
1630FLECS_API extern const ecs_entity_t EcsFinal;
1631
1633FLECS_API extern const ecs_entity_t EcsOnInstantiate;
1634
1638FLECS_API extern const ecs_entity_t EcsOverride;
1639
1643FLECS_API extern const ecs_entity_t EcsInherit;
1644
1649FLECS_API extern const ecs_entity_t EcsDontInherit;
1650
1658FLECS_API extern const ecs_entity_t EcsSymmetric;
1659
1669FLECS_API extern const ecs_entity_t EcsExclusive;
1670
1672FLECS_API extern const ecs_entity_t EcsAcyclic;
1673
1676FLECS_API extern const ecs_entity_t EcsTraversable;
1677
1687FLECS_API extern const ecs_entity_t EcsWith;
1688
1698FLECS_API extern const ecs_entity_t EcsOneOf;
1699
1701FLECS_API extern const ecs_entity_t EcsCanToggle;
1702
1706FLECS_API extern const ecs_entity_t EcsTrait;
1707
1717FLECS_API extern const ecs_entity_t EcsRelationship;
1718
1728FLECS_API extern const ecs_entity_t EcsTarget;
1729
1732FLECS_API extern const ecs_entity_t EcsPairIsTag;
1733
1735FLECS_API extern const ecs_entity_t EcsName;
1736
1738FLECS_API extern const ecs_entity_t EcsSymbol;
1739
1741FLECS_API extern const ecs_entity_t EcsAlias;
1742
1744FLECS_API extern const ecs_entity_t EcsChildOf;
1745
1747FLECS_API extern const ecs_entity_t EcsIsA;
1748
1750FLECS_API extern const ecs_entity_t EcsDependsOn;
1751
1753FLECS_API extern const ecs_entity_t EcsSlotOf;
1754
1756FLECS_API extern const ecs_entity_t EcsModule;
1757
1759FLECS_API extern const ecs_entity_t EcsPrivate;
1760
1763FLECS_API extern const ecs_entity_t EcsPrefab;
1764
1767FLECS_API extern const ecs_entity_t EcsDisabled;
1768
1772FLECS_API extern const ecs_entity_t EcsNotQueryable;
1773
1775FLECS_API extern const ecs_entity_t EcsOnAdd;
1776
1778FLECS_API extern const ecs_entity_t EcsOnRemove;
1779
1781FLECS_API extern const ecs_entity_t EcsOnSet;
1782
1784FLECS_API extern const ecs_entity_t EcsMonitor;
1785
1787FLECS_API extern const ecs_entity_t EcsOnTableCreate;
1788
1790FLECS_API extern const ecs_entity_t EcsOnTableDelete;
1791
1793FLECS_API extern const ecs_entity_t EcsOnDelete;
1794
1797FLECS_API extern const ecs_entity_t EcsOnDeleteTarget;
1798
1801FLECS_API extern const ecs_entity_t EcsRemove;
1802
1805FLECS_API extern const ecs_entity_t EcsDelete;
1806
1809FLECS_API extern const ecs_entity_t EcsPanic;
1810
1812FLECS_API extern const ecs_entity_t EcsSparse;
1813
1815FLECS_API extern const ecs_entity_t EcsUnion;
1816
1818FLECS_API extern const ecs_entity_t EcsPredEq;
1819
1821FLECS_API extern const ecs_entity_t EcsPredMatch;
1822
1824FLECS_API extern const ecs_entity_t EcsPredLookup;
1825
1827FLECS_API extern const ecs_entity_t EcsScopeOpen;
1828
1830FLECS_API extern const ecs_entity_t EcsScopeClose;
1831
1836FLECS_API extern const ecs_entity_t EcsEmpty;
1837
1838FLECS_API extern const ecs_entity_t ecs_id(EcsPipeline);
1839FLECS_API extern const ecs_entity_t EcsOnStart;
1840FLECS_API extern const ecs_entity_t EcsPreFrame;
1841FLECS_API extern const ecs_entity_t EcsOnLoad;
1842FLECS_API extern const ecs_entity_t EcsPostLoad;
1843FLECS_API extern const ecs_entity_t EcsPreUpdate;
1844FLECS_API extern const ecs_entity_t EcsOnUpdate;
1845FLECS_API extern const ecs_entity_t EcsOnValidate;
1846FLECS_API extern const ecs_entity_t EcsPostUpdate;
1847FLECS_API extern const ecs_entity_t EcsPreStore;
1848FLECS_API extern const ecs_entity_t EcsOnStore;
1849FLECS_API extern const ecs_entity_t EcsPostFrame;
1850FLECS_API extern const ecs_entity_t EcsPhase;
1851
1854#define EcsLastInternalComponentId (ecs_id(EcsPoly))
1855
1858#define EcsFirstUserComponentId (8)
1859
1862#define EcsFirstUserEntityId (FLECS_HI_COMPONENT_ID + 128)
1863
1864/* When visualized the reserved id ranges look like this:
1865 * - [1..8]: Builtin components
1866 * - [9..FLECS_HI_COMPONENT_ID]: Low ids reserved for application components
1867 * - [FLECS_HI_COMPONENT_ID + 1..EcsFirstUserEntityId]: Builtin entities
1868 */
1869
1872
1879
1884
1891FLECS_API
1892 ecs_world_t* ecs_init(void);
1893
1900FLECS_API
1901 ecs_world_t* ecs_mini(void);
1902
1910FLECS_API
1911 ecs_world_t* ecs_init_w_args(
1912 int argc,
1913 char *argv[]);
1914
1921FLECS_API
1922 int ecs_fini(
1923 ecs_world_t *world);
1924
1932FLECS_API
1933 bool ecs_is_fini(
1934 const ecs_world_t *world);
1935
1943FLECS_API
1944 void ecs_atfini(
1945 ecs_world_t *world,
1946 ecs_fini_action_t action,
1947 void *ctx);
1948
1950 typedef struct ecs_entities_t {
1951 const ecs_entity_t *ids;
1952 int32_t count;
1953 int32_t alive_count;
1954} ecs_entities_t;
1955
1982FLECS_API
1983 ecs_entities_t ecs_get_entities(
1984 const ecs_world_t *world);
1985
1993FLECS_API
1994ecs_flags32_t ecs_world_get_flags(
1995 const ecs_world_t *world);
1996
1998
2003
2022FLECS_API
2023 ecs_ftime_t ecs_frame_begin(
2024 ecs_world_t *world,
2025 ecs_ftime_t delta_time);
2026
2033FLECS_API
2034 void ecs_frame_end(
2035 ecs_world_t *world);
2036
2044FLECS_API
2045 void ecs_run_post_frame(
2046 ecs_world_t *world,
2047 ecs_fini_action_t action,
2048 void *ctx);
2049
2056FLECS_API
2057 void ecs_quit(
2058 ecs_world_t *world);
2059
2066FLECS_API
2067 bool ecs_should_quit(
2068 const ecs_world_t *world);
2069
2081FLECS_API void ecs_measure_frame_time(
2082 ecs_world_t *world,
2083 bool enable);
2084
2095FLECS_API void ecs_measure_system_time(
2096 ecs_world_t *world,
2097 bool enable);
2098
2114FLECS_API
2115 void ecs_set_target_fps(
2116 ecs_world_t *world,
2117 ecs_ftime_t fps);
2118
2132FLECS_API
2133 void ecs_set_default_query_flags(
2134 ecs_world_t *world,
2135 ecs_flags32_t flags);
2136
2138
2143
2213FLECS_API
2214 bool ecs_readonly_begin(
2215 ecs_world_t *world,
2216 bool multi_threaded);
2217
2225FLECS_API
2226 void ecs_readonly_end(
2227 ecs_world_t *world);
2228
2239FLECS_API
2240 void ecs_merge(
2241 ecs_world_t *world);
2242
2258FLECS_API
2259 bool ecs_defer_begin(
2260 ecs_world_t *world);
2261
2272FLECS_API
2273 bool ecs_is_deferred(
2274 const ecs_world_t *world);
2275
2289FLECS_API
2290 bool ecs_defer_end(
2291 ecs_world_t *world);
2292
2307FLECS_API
2308 void ecs_defer_suspend(
2309 ecs_world_t *world);
2310
2321FLECS_API
2322 void ecs_defer_resume(
2323 ecs_world_t *world);
2324
2338FLECS_API
2339 void ecs_set_stage_count(
2340 ecs_world_t *world,
2341 int32_t stages);
2342
2349FLECS_API
2350int32_t ecs_get_stage_count(
2351 const ecs_world_t *world);
2352
2368FLECS_API
2369 ecs_world_t* ecs_get_stage(
2370 const ecs_world_t *world,
2371 int32_t stage_id);
2372
2380FLECS_API
2381 bool ecs_stage_is_readonly(
2382 const ecs_world_t *world);
2383
2391FLECS_API
2392 ecs_world_t* ecs_stage_new(
2393 ecs_world_t *world);
2394
2399FLECS_API
2400 void ecs_stage_free(
2401 ecs_world_t *stage);
2402
2410FLECS_API
2411int32_t ecs_stage_get_id(
2412 const ecs_world_t *world);
2413
2415
2420
2429FLECS_API
2430 void ecs_set_ctx(
2431 ecs_world_t *world,
2432 void *ctx,
2433 ecs_ctx_free_t ctx_free);
2434
2443FLECS_API
2444 void ecs_set_binding_ctx(
2445 ecs_world_t *world,
2446 void *ctx,
2447 ecs_ctx_free_t ctx_free);
2448
2456FLECS_API
2457 void* ecs_get_ctx(
2458 const ecs_world_t *world);
2459
2467FLECS_API
2468 void* ecs_get_binding_ctx(
2469 const ecs_world_t *world);
2470
2476FLECS_API
2477 const ecs_build_info_t* ecs_get_build_info(void);
2478
2484FLECS_API
2485 const ecs_world_info_t* ecs_get_world_info(
2486 const ecs_world_t *world);
2487
2496FLECS_API
2497 void ecs_dim(
2498 ecs_world_t *world,
2499 int32_t entity_count);
2500
2516FLECS_API
2517 void ecs_set_entity_range(
2518 ecs_world_t *world,
2519 ecs_entity_t id_start,
2520 ecs_entity_t id_end);
2521
2532FLECS_API
2533 bool ecs_enable_range_check(
2534 ecs_world_t *world,
2535 bool enable);
2536
2542FLECS_API
2543 ecs_entity_t ecs_get_max_id(
2544 const ecs_world_t *world);
2545
2559FLECS_API
2560 void ecs_run_aperiodic(
2561 ecs_world_t *world,
2562 ecs_flags32_t flags);
2563
2565 typedef struct ecs_delete_empty_tables_desc_t {
2567 ecs_id_t id;
2568
2570 uint16_t clear_generation;
2571
2573 uint16_t delete_generation;
2574
2576 int32_t min_id_count;
2577
2579 double time_budget_seconds;
2580} ecs_delete_empty_tables_desc_t;
2581
2611FLECS_API
2612int32_t ecs_delete_empty_tables(
2613 ecs_world_t *world,
2614 const ecs_delete_empty_tables_desc_t *desc);
2615
2621FLECS_API
2622 const ecs_world_t* ecs_get_world(
2623 const ecs_poly_t *poly);
2624
2630FLECS_API
2631 ecs_entity_t ecs_get_entity(
2632 const ecs_poly_t *poly);
2633
2647FLECS_API
2648 bool flecs_poly_is_(
2649 const ecs_poly_t *object,
2650 int32_t type);
2651
2655#define flecs_poly_is(object, type)\
2656 flecs_poly_is_(object, type##_magic)
2657
2666FLECS_API
2667 ecs_id_t ecs_make_pair(
2668 ecs_entity_t first,
2669 ecs_entity_t second);
2670
2672
2674
2681
2688
2697FLECS_API
2698 ecs_entity_t ecs_new(
2699 ecs_world_t *world);
2700
2718FLECS_API
2719 ecs_entity_t ecs_new_low_id(
2720 ecs_world_t *world);
2721
2730FLECS_API
2731 ecs_entity_t ecs_new_w_id(
2732 ecs_world_t *world,
2733 ecs_id_t id);
2734
2742FLECS_API
2743 ecs_entity_t ecs_new_w_table(
2744 ecs_world_t *world,
2745 ecs_table_t *table);
2746
2765FLECS_API
2766 ecs_entity_t ecs_entity_init(
2767 ecs_world_t *world,
2768 const ecs_entity_desc_t *desc);
2769
2796FLECS_API
2797 const ecs_entity_t* ecs_bulk_init(
2798 ecs_world_t *world,
2799 const ecs_bulk_desc_t *desc);
2800
2810FLECS_API
2811 const ecs_entity_t* ecs_bulk_new_w_id(
2812 ecs_world_t *world,
2813 ecs_id_t id,
2814 int32_t count);
2815
2831FLECS_API
2832 ecs_entity_t ecs_clone(
2833 ecs_world_t *world,
2834 ecs_entity_t dst,
2835 ecs_entity_t src,
2836 bool copy_value);
2837
2846FLECS_API
2847 void ecs_delete(
2848 ecs_world_t *world,
2849 ecs_entity_t entity);
2850
2858FLECS_API
2859 void ecs_delete_with(
2860 ecs_world_t *world,
2861 ecs_id_t id);
2862
2864
2871
2880FLECS_API
2881 void ecs_add_id(
2882 ecs_world_t *world,
2883 ecs_entity_t entity,
2884 ecs_id_t id);
2885
2894FLECS_API
2895 void ecs_remove_id(
2896 ecs_world_t *world,
2897 ecs_entity_t entity,
2898 ecs_id_t id);
2899
2951FLECS_API
2952 void ecs_auto_override_id(
2953 ecs_world_t *world,
2954 ecs_entity_t entity,
2955 ecs_id_t id);
2956
2963FLECS_API
2964 void ecs_clear(
2965 ecs_world_t *world,
2966 ecs_entity_t entity);
2967
2975FLECS_API
2976 void ecs_remove_all(
2977 ecs_world_t *world,
2978 ecs_id_t id);
2979
2987FLECS_API
2988 ecs_entity_t ecs_set_with(
2989 ecs_world_t *world,
2990 ecs_id_t id);
2991
2998FLECS_API
2999 ecs_id_t ecs_get_with(
3000 const ecs_world_t *world);
3001
3003
3010
3020FLECS_API
3021 void ecs_enable(
3022 ecs_world_t *world,
3023 ecs_entity_t entity,
3024 bool enabled);
3025
3039FLECS_API
3040 void ecs_enable_id(
3041 ecs_world_t *world,
3042 ecs_entity_t entity,
3043 ecs_id_t id,
3044 bool enable);
3045
3056FLECS_API
3057 bool ecs_is_enabled_id(
3058 const ecs_world_t *world,
3059 ecs_entity_t entity,
3060 ecs_id_t id);
3061
3063
3070
3085FLECS_API
3086 const void* ecs_get_id(
3087 const ecs_world_t *world,
3088 ecs_entity_t entity,
3089 ecs_id_t id);
3090
3102FLECS_API
3103 void* ecs_get_mut_id(
3104 const ecs_world_t *world,
3105 ecs_entity_t entity,
3106 ecs_id_t id);
3107
3125FLECS_API
3126 void* ecs_ensure_id(
3127 ecs_world_t *world,
3128 ecs_entity_t entity,
3129 ecs_id_t id);
3130
3142FLECS_API
3143 void* ecs_ensure_modified_id(
3144 ecs_world_t *world,
3145 ecs_entity_t entity,
3146 ecs_id_t id);
3147
3158FLECS_API
3159 ecs_ref_t ecs_ref_init_id(
3160 const ecs_world_t *world,
3161 ecs_entity_t entity,
3162 ecs_id_t id);
3163
3172FLECS_API
3173 void* ecs_ref_get_id(
3174 const ecs_world_t *world,
3175 ecs_ref_t *ref,
3176 ecs_id_t id);
3177
3185FLECS_API
3186 void ecs_ref_update(
3187 const ecs_world_t *world,
3188 ecs_ref_t *ref);
3189
3197FLECS_API
3198 ecs_record_t* ecs_record_find(
3199 const ecs_world_t *world,
3200 ecs_entity_t entity);
3201
3220FLECS_API
3221 ecs_record_t* ecs_write_begin(
3222 ecs_world_t *world,
3223 ecs_entity_t entity);
3224
3231FLECS_API
3232 void ecs_write_end(
3233 ecs_record_t *record);
3234
3254FLECS_API
3255 const ecs_record_t* ecs_read_begin(
3256 ecs_world_t *world,
3257 ecs_entity_t entity);
3258
3264FLECS_API
3265 void ecs_read_end(
3266 const ecs_record_t *record);
3267
3274FLECS_API
3275 ecs_entity_t ecs_record_get_entity(
3276 const ecs_record_t *record);
3277
3293FLECS_API
3294 const void* ecs_record_get_id(
3295 const ecs_world_t *world,
3296 const ecs_record_t *record,
3297 ecs_id_t id);
3298
3307FLECS_API
3308 void* ecs_record_ensure_id(
3309 ecs_world_t *world,
3310 ecs_record_t *record,
3311 ecs_id_t id);
3312
3320FLECS_API
3321 bool ecs_record_has_id(
3322 ecs_world_t *world,
3323 const ecs_record_t *record,
3324 ecs_id_t id);
3325
3342FLECS_API
3343 void* ecs_record_get_by_column(
3344 const ecs_record_t *record,
3345 int32_t column,
3346 size_t size);
3347
3367FLECS_API
3368 void* ecs_emplace_id(
3369 ecs_world_t *world,
3370 ecs_entity_t entity,
3371 ecs_id_t id,
3372 bool *is_new);
3373
3383FLECS_API
3384 void ecs_modified_id(
3385 ecs_world_t *world,
3386 ecs_entity_t entity,
3387 ecs_id_t id);
3388
3404FLECS_API
3405 void ecs_set_id(
3406 ecs_world_t *world,
3407 ecs_entity_t entity,
3408 ecs_id_t id,
3409 size_t size,
3410 const void *ptr);
3411
3413
3420
3439FLECS_API
3440 bool ecs_is_valid(
3441 const ecs_world_t *world,
3442 ecs_entity_t e);
3443
3469FLECS_API
3470 bool ecs_is_alive(
3471 const ecs_world_t *world,
3472 ecs_entity_t e);
3473
3479FLECS_API
3480 ecs_id_t ecs_strip_generation(
3481 ecs_entity_t e);
3482
3499FLECS_API
3500 ecs_entity_t ecs_get_alive(
3501 const ecs_world_t *world,
3502 ecs_entity_t e);
3503
3526FLECS_API
3527 void ecs_make_alive(
3528 ecs_world_t *world,
3529 ecs_entity_t entity);
3530
3549FLECS_API
3550 void ecs_make_alive_id(
3551 ecs_world_t *world,
3552 ecs_id_t id);
3553
3561FLECS_API
3562 bool ecs_exists(
3563 const ecs_world_t *world,
3564 ecs_entity_t entity);
3565
3580FLECS_API
3581 void ecs_set_version(
3582 ecs_world_t *world,
3583 ecs_entity_t entity);
3584
3586
3593
3600FLECS_API
3601 const ecs_type_t* ecs_get_type(
3602 const ecs_world_t *world,
3603 ecs_entity_t entity);
3604
3611FLECS_API
3612 ecs_table_t* ecs_get_table(
3613 const ecs_world_t *world,
3614 ecs_entity_t entity);
3615
3623FLECS_API
3624 char* ecs_type_str(
3625 const ecs_world_t *world,
3626 const ecs_type_t* type);
3627
3639FLECS_API
3640 char* ecs_table_str(
3641 const ecs_world_t *world,
3642 const ecs_table_t *table);
3643
3658FLECS_API
3659 char* ecs_entity_str(
3660 const ecs_world_t *world,
3661 ecs_entity_t entity);
3662
3673FLECS_API
3674 bool ecs_has_id(
3675 const ecs_world_t *world,
3676 ecs_entity_t entity,
3677 ecs_id_t id);
3678
3689FLECS_API
3690 bool ecs_owns_id(
3691 const ecs_world_t *world,
3692 ecs_entity_t entity,
3693 ecs_id_t id);
3694
3709FLECS_API
3710 ecs_entity_t ecs_get_target(
3711 const ecs_world_t *world,
3712 ecs_entity_t entity,
3713 ecs_entity_t rel,
3714 int32_t index);
3715
3729FLECS_API
3730 ecs_entity_t ecs_get_parent(
3731 const ecs_world_t *world,
3732 ecs_entity_t entity);
3733
3754FLECS_API
3755 ecs_entity_t ecs_get_target_for_id(
3756 const ecs_world_t *world,
3757 ecs_entity_t entity,
3758 ecs_entity_t rel,
3759 ecs_id_t id);
3760
3771FLECS_API
3772int32_t ecs_get_depth(
3773 const ecs_world_t *world,
3774 ecs_entity_t entity,
3775 ecs_entity_t rel);
3776
3784FLECS_API
3785int32_t ecs_count_id(
3786 const ecs_world_t *world,
3787 ecs_id_t entity);
3788
3790
3791
3798
3808FLECS_API
3809 const char* ecs_get_name(
3810 const ecs_world_t *world,
3811 ecs_entity_t entity);
3812
3822FLECS_API
3823 const char* ecs_get_symbol(
3824 const ecs_world_t *world,
3825 ecs_entity_t entity);
3826
3840FLECS_API
3841 ecs_entity_t ecs_set_name(
3842 ecs_world_t *world,
3843 ecs_entity_t entity,
3844 const char *name);
3845
3859FLECS_API
3860 ecs_entity_t ecs_set_symbol(
3861 ecs_world_t *world,
3862 ecs_entity_t entity,
3863 const char *symbol);
3864
3876FLECS_API
3877 void ecs_set_alias(
3878 ecs_world_t *world,
3879 ecs_entity_t entity,
3880 const char *alias);
3881
3897FLECS_API
3898 ecs_entity_t ecs_lookup(
3899 const ecs_world_t *world,
3900 const char *path);
3901
3916FLECS_API
3917 ecs_entity_t ecs_lookup_child(
3918 const ecs_world_t *world,
3919 ecs_entity_t parent,
3920 const char *name);
3921
3944FLECS_API
3945 ecs_entity_t ecs_lookup_path_w_sep(
3946 const ecs_world_t *world,
3947 ecs_entity_t parent,
3948 const char *path,
3949 const char *sep,
3950 const char *prefix,
3951 bool recursive);
3952
3970FLECS_API
3971 ecs_entity_t ecs_lookup_symbol(
3972 const ecs_world_t *world,
3973 const char *symbol,
3974 bool lookup_as_path,
3975 bool recursive);
3976
3998FLECS_API
3999 char* ecs_get_path_w_sep(
4000 const ecs_world_t *world,
4001 ecs_entity_t parent,
4002 ecs_entity_t child,
4003 const char *sep,
4004 const char *prefix);
4005
4018 void ecs_get_path_w_sep_buf(
4019 const ecs_world_t *world,
4020 ecs_entity_t parent,
4021 ecs_entity_t child,
4022 const char *sep,
4023 const char *prefix,
4024 ecs_strbuf_t *buf,
4025 bool escape);
4026
4042FLECS_API
4043 ecs_entity_t ecs_new_from_path_w_sep(
4044 ecs_world_t *world,
4045 ecs_entity_t parent,
4046 const char *path,
4047 const char *sep,
4048 const char *prefix);
4049
4064FLECS_API
4065 ecs_entity_t ecs_add_path_w_sep(
4066 ecs_world_t *world,
4067 ecs_entity_t entity,
4068 ecs_entity_t parent,
4069 const char *path,
4070 const char *sep,
4071 const char *prefix);
4072
4086FLECS_API
4087 ecs_entity_t ecs_set_scope(
4088 ecs_world_t *world,
4089 ecs_entity_t scope);
4090
4098FLECS_API
4099 ecs_entity_t ecs_get_scope(
4100 const ecs_world_t *world);
4101
4111FLECS_API
4112 const char* ecs_set_name_prefix(
4113 ecs_world_t *world,
4114 const char *prefix);
4115
4142FLECS_API
4143 ecs_entity_t* ecs_set_lookup_path(
4144 ecs_world_t *world,
4145 const ecs_entity_t *lookup_path);
4146
4153FLECS_API
4154 ecs_entity_t* ecs_get_lookup_path(
4155 const ecs_world_t *world);
4156
4158
4160
4167
4181FLECS_API
4182 ecs_entity_t ecs_component_init(
4183 ecs_world_t *world,
4184 const ecs_component_desc_t *desc);
4185
4195FLECS_API
4196 const ecs_type_info_t* ecs_get_type_info(
4197 const ecs_world_t *world,
4198 ecs_id_t id);
4199
4211FLECS_API
4212 void ecs_set_hooks_id(
4213 ecs_world_t *world,
4214 ecs_entity_t id,
4215 const ecs_type_hooks_t *hooks);
4216
4223FLECS_API
4224 const ecs_type_hooks_t* ecs_get_hooks_id(
4225 const ecs_world_t *world,
4226 ecs_entity_t id);
4227
4229
4236
4251FLECS_API
4252 bool ecs_id_is_tag(
4253 const ecs_world_t *world,
4254 ecs_id_t id);
4255
4264FLECS_API
4265 bool ecs_id_in_use(
4266 const ecs_world_t *world,
4267 ecs_id_t id);
4268
4288FLECS_API
4289 ecs_entity_t ecs_get_typeid(
4290 const ecs_world_t *world,
4291 ecs_id_t id);
4292
4301FLECS_API
4302 bool ecs_id_match(
4303 ecs_id_t id,
4304 ecs_id_t pattern);
4305
4311FLECS_API
4312 bool ecs_id_is_pair(
4313 ecs_id_t id);
4314
4320FLECS_API
4321 bool ecs_id_is_wildcard(
4322 ecs_id_t id);
4323
4337FLECS_API
4338 bool ecs_id_is_valid(
4339 const ecs_world_t *world,
4340 ecs_id_t id);
4341
4350FLECS_API
4351ecs_flags32_t ecs_id_get_flags(
4352 const ecs_world_t *world,
4353 ecs_id_t id);
4354
4361FLECS_API
4362 const char* ecs_id_flag_str(
4363 ecs_id_t id_flags);
4364
4372FLECS_API
4373 char* ecs_id_str(
4374 const ecs_world_t *world,
4375 ecs_id_t id);
4376
4384FLECS_API
4385 void ecs_id_str_buf(
4386 const ecs_world_t *world,
4387 ecs_id_t id,
4388 ecs_strbuf_t *buf);
4389
4397FLECS_API
4398 ecs_id_t ecs_id_from_str(
4399 const ecs_world_t *world,
4400 const char *expr);
4401
4403
4409
4415FLECS_API
4416 bool ecs_term_ref_is_set(
4417 const ecs_term_ref_t *id);
4418
4430FLECS_API
4431 bool ecs_term_is_initialized(
4432 const ecs_term_t *term);
4433
4448FLECS_API
4449 bool ecs_term_match_this(
4450 const ecs_term_t *term);
4451
4464FLECS_API
4465 bool ecs_term_match_0(
4466 const ecs_term_t *term);
4467
4476FLECS_API
4477 char* ecs_term_str(
4478 const ecs_world_t *world,
4479 const ecs_term_t *term);
4480
4488FLECS_API
4489 char* ecs_query_str(
4490 const ecs_query_t *query);
4491
4493
4499
4532FLECS_API
4533 ecs_iter_t ecs_each_id(
4534 const ecs_world_t *world,
4535 ecs_id_t id);
4536
4542FLECS_API
4543 bool ecs_each_next(
4544 ecs_iter_t *it);
4545
4558FLECS_API
4559 ecs_iter_t ecs_children(
4560 const ecs_world_t *world,
4561 ecs_entity_t parent);
4562
4568FLECS_API
4569 bool ecs_children_next(
4570 ecs_iter_t *it);
4571
4573
4580
4587FLECS_API
4588 ecs_query_t* ecs_query_init(
4589 ecs_world_t *world,
4590 const ecs_query_desc_t *desc);
4591
4596FLECS_API
4597 void ecs_query_fini(
4598 ecs_query_t *query);
4599
4608FLECS_API
4609int32_t ecs_query_find_var(
4610 const ecs_query_t *query,
4611 const char *name);
4612
4620FLECS_API
4621 const char* ecs_query_var_name(
4622 const ecs_query_t *query,
4623 int32_t var_id);
4624
4635FLECS_API
4636 bool ecs_query_var_is_entity(
4637 const ecs_query_t *query,
4638 int32_t var_id);
4639
4708FLECS_API
4709 ecs_iter_t ecs_query_iter(
4710 const ecs_world_t *world,
4711 const ecs_query_t *query);
4712
4720FLECS_API
4721 bool ecs_query_next(
4722 ecs_iter_t *it);
4723
4742FLECS_API
4743 bool ecs_query_has(
4744 ecs_query_t *query,
4745 ecs_entity_t entity,
4746 ecs_iter_t *it);
4747
4766FLECS_API
4767 bool ecs_query_has_table(
4768 ecs_query_t *query,
4769 ecs_table_t *table,
4770 ecs_iter_t *it);
4771
4798FLECS_API
4799 bool ecs_query_has_range(
4800 ecs_query_t *query,
4801 ecs_table_range_t *range,
4802 ecs_iter_t *it);
4803
4811FLECS_API
4812int32_t ecs_query_match_count(
4813 const ecs_query_t *query);
4814
4824FLECS_API
4825 char* ecs_query_plan(
4826 const ecs_query_t *query);
4827
4842FLECS_API
4843 char* ecs_query_plan_w_profile(
4844 const ecs_query_t *query,
4845 const ecs_iter_t *it);
4846
4864FLECS_API
4865 const char* ecs_query_args_parse(
4866 ecs_query_t *query,
4867 ecs_iter_t *it,
4868 const char *expr);
4869
4897FLECS_API
4898 bool ecs_query_changed(
4899 ecs_query_t *query);
4900
4909FLECS_API
4910 const ecs_query_t* ecs_query_get(
4911 const ecs_world_t *world,
4912 ecs_entity_t query);
4913
4924FLECS_API
4925 void ecs_iter_skip(
4926 ecs_iter_t *it);
4927
4950FLECS_API
4951 void ecs_iter_set_group(
4952 ecs_iter_t *it,
4953 uint64_t group_id);
4954
4963FLECS_API
4964 void* ecs_query_get_group_ctx(
4965 const ecs_query_t *query,
4966 uint64_t group_id);
4967
4976FLECS_API
4977 const ecs_query_group_info_t* ecs_query_get_group_info(
4978 const ecs_query_t *query,
4979 uint64_t group_id);
4980
4982 typedef struct ecs_query_count_t {
4983 int32_t results;
4984 int32_t entities;
4985 int32_t tables;
4986 int32_t empty_tables;
4987} ecs_query_count_t;
4988
4995FLECS_API
4996 ecs_query_count_t ecs_query_count(
4997 const ecs_query_t *query);
4998
5004FLECS_API
5005 bool ecs_query_is_true(
5006 const ecs_query_t *query);
5007
5016FLECS_API
5017 const ecs_query_t* ecs_query_get_cache_query(
5018 const ecs_query_t *query);
5019
5021
5028
5048FLECS_API
5049 void ecs_emit(
5050 ecs_world_t *world,
5051 ecs_event_desc_t *desc);
5052
5063FLECS_API
5064 void ecs_enqueue(
5065 ecs_world_t *world,
5066 ecs_event_desc_t *desc);
5067
5078FLECS_API
5079 ecs_entity_t ecs_observer_init(
5080 ecs_world_t *world,
5081 const ecs_observer_desc_t *desc);
5082
5091FLECS_API
5092 const ecs_observer_t* ecs_observer_get(
5093 const ecs_world_t *world,
5094 ecs_entity_t observer);
5095
5097
5104
5118FLECS_API
5119 bool ecs_iter_next(
5120 ecs_iter_t *it);
5121
5131FLECS_API
5132 void ecs_iter_fini(
5133 ecs_iter_t *it);
5134
5146FLECS_API
5147int32_t ecs_iter_count(
5148 ecs_iter_t *it);
5149
5162FLECS_API
5163 bool ecs_iter_is_true(
5164 ecs_iter_t *it);
5165
5173FLECS_API
5174 ecs_entity_t ecs_iter_first(
5175 ecs_iter_t *it);
5176
5215FLECS_API
5216 void ecs_iter_set_var(
5217 ecs_iter_t *it,
5218 int32_t var_id,
5219 ecs_entity_t entity);
5220
5231FLECS_API
5232 void ecs_iter_set_var_as_table(
5233 ecs_iter_t *it,
5234 int32_t var_id,
5235 const ecs_table_t *table);
5236
5247FLECS_API
5248 void ecs_iter_set_var_as_range(
5249 ecs_iter_t *it,
5250 int32_t var_id,
5251 const ecs_table_range_t *range);
5252
5265FLECS_API
5266 ecs_entity_t ecs_iter_get_var(
5267 ecs_iter_t *it,
5268 int32_t var_id);
5269
5283FLECS_API
5284 ecs_table_t* ecs_iter_get_var_as_table(
5285 ecs_iter_t *it,
5286 int32_t var_id);
5287
5301FLECS_API
5302ecs_table_range_t ecs_iter_get_var_as_range(
5303 ecs_iter_t *it,
5304 int32_t var_id);
5305
5317FLECS_API
5318 bool ecs_iter_var_is_constrained(
5319 ecs_iter_t *it,
5320 int32_t var_id);
5321
5333FLECS_API
5334 bool ecs_iter_changed(
5335 ecs_iter_t *it);
5336
5348FLECS_API
5349 char* ecs_iter_str(
5350 const ecs_iter_t *it);
5351
5367FLECS_API
5368 ecs_iter_t ecs_page_iter(
5369 const ecs_iter_t *it,
5370 int32_t offset,
5371 int32_t limit);
5372
5379FLECS_API
5380 bool ecs_page_next(
5381 ecs_iter_t *it);
5382
5403FLECS_API
5404 ecs_iter_t ecs_worker_iter(
5405 const ecs_iter_t *it,
5406 int32_t index,
5407 int32_t count);
5408
5415FLECS_API
5416 bool ecs_worker_next(
5417 ecs_iter_t *it);
5418
5460FLECS_API
5461 void* ecs_field_w_size(
5462 const ecs_iter_t *it,
5463 size_t size,
5464 int8_t index);
5465
5487FLECS_API
5488 void* ecs_field_at_w_size(
5489 const ecs_iter_t *it,
5490 size_t size,
5491 int8_t index,
5492 int32_t row);
5493
5502FLECS_API
5503 bool ecs_field_is_readonly(
5504 const ecs_iter_t *it,
5505 int8_t index);
5506
5517FLECS_API
5518 bool ecs_field_is_writeonly(
5519 const ecs_iter_t *it,
5520 int8_t index);
5521
5528FLECS_API
5529 bool ecs_field_is_set(
5530 const ecs_iter_t *it,
5531 int8_t index);
5532
5539FLECS_API
5540 ecs_id_t ecs_field_id(
5541 const ecs_iter_t *it,
5542 int8_t index);
5543
5552FLECS_API
5553int32_t ecs_field_column(
5554 const ecs_iter_t *it,
5555 int8_t index);
5556
5564FLECS_API
5565 ecs_entity_t ecs_field_src(
5566 const ecs_iter_t *it,
5567 int8_t index);
5568
5576FLECS_API
5577 size_t ecs_field_size(
5578 const ecs_iter_t *it,
5579 int8_t index);
5580
5594FLECS_API
5595 bool ecs_field_is_self(
5596 const ecs_iter_t *it,
5597 int8_t index);
5598
5600
5607
5614FLECS_API
5615 const ecs_type_t* ecs_table_get_type(
5616 const ecs_table_t *table);
5617
5628FLECS_API
5629int32_t ecs_table_get_type_index(
5630 const ecs_world_t *world,
5631 const ecs_table_t *table,
5632 ecs_id_t id);
5633
5643FLECS_API
5644int32_t ecs_table_get_column_index(
5645 const ecs_world_t *world,
5646 const ecs_table_t *table,
5647 ecs_id_t id);
5648
5656FLECS_API
5657int32_t ecs_table_column_count(
5658 const ecs_table_t *table);
5659
5673FLECS_API
5674int32_t ecs_table_type_to_column_index(
5675 const ecs_table_t *table,
5676 int32_t index);
5677
5686FLECS_API
5687int32_t ecs_table_column_to_type_index(
5688 const ecs_table_t *table,
5689 int32_t index);
5690
5699FLECS_API
5700 void* ecs_table_get_column(
5701 const ecs_table_t *table,
5702 int32_t index,
5703 int32_t offset);
5704
5714FLECS_API
5715 void* ecs_table_get_id(
5716 const ecs_world_t *world,
5717 const ecs_table_t *table,
5718 ecs_id_t id,
5719 int32_t offset);
5720
5728FLECS_API
5729 size_t ecs_table_get_column_size(
5730 const ecs_table_t *table,
5731 int32_t index);
5732
5739FLECS_API
5740int32_t ecs_table_count(
5741 const ecs_table_t *table);
5742
5750FLECS_API
5751int32_t ecs_table_size(
5752 const ecs_table_t *table);
5753
5760FLECS_API
5761 const ecs_entity_t* ecs_table_entities(
5762 const ecs_table_t *table);
5763
5774FLECS_API
5775 bool ecs_table_has_id(
5776 const ecs_world_t *world,
5777 const ecs_table_t *table,
5778 ecs_id_t id);
5779
5790FLECS_API
5791int32_t ecs_table_get_depth(
5792 const ecs_world_t *world,
5793 const ecs_table_t *table,
5794 ecs_entity_t rel);
5795
5805FLECS_API
5806 ecs_table_t* ecs_table_add_id(
5807 ecs_world_t *world,
5808 ecs_table_t *table,
5809 ecs_id_t id);
5810
5821FLECS_API
5822 ecs_table_t* ecs_table_find(
5823 ecs_world_t *world,
5824 const ecs_id_t *ids,
5825 int32_t id_count);
5826
5836FLECS_API
5837 ecs_table_t* ecs_table_remove_id(
5838 ecs_world_t *world,
5839 ecs_table_t *table,
5840 ecs_id_t id);
5841
5857FLECS_API
5858 void ecs_table_lock(
5859 ecs_world_t *world,
5860 ecs_table_t *table);
5861
5868FLECS_API
5869 void ecs_table_unlock(
5870 ecs_world_t *world,
5871 ecs_table_t *table);
5872
5882FLECS_API
5883 bool ecs_table_has_flags(
5884 ecs_table_t *table,
5885 ecs_flags32_t flags);
5886
5894FLECS_API
5895 void ecs_table_swap_rows(
5896 ecs_world_t* world,
5897 ecs_table_t* table,
5898 int32_t row_1,
5899 int32_t row_2);
5900
5923FLECS_API
5924 bool ecs_commit(
5925 ecs_world_t *world,
5926 ecs_entity_t entity,
5927 ecs_record_t *record,
5928 ecs_table_t *table,
5929 const ecs_type_t *added,
5930 const ecs_type_t *removed);
5931
5932
5951FLECS_API
5952int32_t ecs_search(
5953 const ecs_world_t *world,
5954 const ecs_table_t *table,
5955 ecs_id_t id,
5956 ecs_id_t *id_out);
5957
5993FLECS_API
5994int32_t ecs_search_offset(
5995 const ecs_world_t *world,
5996 const ecs_table_t *table,
5997 int32_t offset,
5998 ecs_id_t id,
5999 ecs_id_t *id_out);
6000
6042FLECS_API
6043int32_t ecs_search_relation(
6044 const ecs_world_t *world,
6045 const ecs_table_t *table,
6046 int32_t offset,
6047 ecs_id_t id,
6048 ecs_entity_t rel,
6049 ecs_flags64_t flags, /* EcsSelf and/or EcsUp */
6050 ecs_entity_t *subject_out,
6051 ecs_id_t *id_out,
6052 struct ecs_table_record_t **tr_out);
6053
6061FLECS_API
6062 void ecs_table_clear_entities(
6063 ecs_world_t* world,
6064 ecs_table_t* table);
6065
6067
6074
6082FLECS_API
6083 int ecs_value_init(
6084 const ecs_world_t *world,
6085 ecs_entity_t type,
6086 void *ptr);
6087
6095FLECS_API
6096 int ecs_value_init_w_type_info(
6097 const ecs_world_t *world,
6098 const ecs_type_info_t *ti,
6099 void *ptr);
6100
6107FLECS_API
6108 void* ecs_value_new(
6109 ecs_world_t *world,
6110 ecs_entity_t type);
6111
6118 void* ecs_value_new_w_type_info(
6119 ecs_world_t *world,
6120 const ecs_type_info_t *ti);
6121
6129 int ecs_value_fini_w_type_info(
6130 const ecs_world_t *world,
6131 const ecs_type_info_t *ti,
6132 void *ptr);
6133
6141FLECS_API
6142 int ecs_value_fini(
6143 const ecs_world_t *world,
6144 ecs_entity_t type,
6145 void* ptr);
6146
6154FLECS_API
6155 int ecs_value_free(
6156 ecs_world_t *world,
6157 ecs_entity_t type,
6158 void* ptr);
6159
6168FLECS_API
6169 int ecs_value_copy_w_type_info(
6170 const ecs_world_t *world,
6171 const ecs_type_info_t *ti,
6172 void* dst,
6173 const void *src);
6174
6183FLECS_API
6184 int ecs_value_copy(
6185 const ecs_world_t *world,
6186 ecs_entity_t type,
6187 void* dst,
6188 const void *src);
6189
6198 int ecs_value_move_w_type_info(
6199 const ecs_world_t *world,
6200 const ecs_type_info_t *ti,
6201 void* dst,
6202 void *src);
6203
6212 int ecs_value_move(
6213 const ecs_world_t *world,
6214 ecs_entity_t type,
6215 void* dst,
6216 void *src);
6217
6226 int ecs_value_move_ctor_w_type_info(
6227 const ecs_world_t *world,
6228 const ecs_type_info_t *ti,
6229 void* dst,
6230 void *src);
6231
6240 int ecs_value_move_ctor(
6241 const ecs_world_t *world,
6242 ecs_entity_t type,
6243 void* dst,
6244 void *src);
6245
6247
6249
6258
6259#include "flecs/addons/flecs_c.h"
6260
6261#ifdef __cplusplus
6262}
6263#endif
6264
6265#include "flecs/private/addons.h"
6266
6267#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.
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.
EcsUnion
const ecs_entity_t EcsUnion
Mark relationship as union.
EcsPostFrame
const ecs_entity_t EcsPostFrame
PostFrame pipeline phase.
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 ("$").
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_stage_t
struct ecs_stage_t ecs_stage_t
A stage enables modification while iterating and from multiple threads.
Definition flecs.h:393
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:442
ecs_entity_t
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:346
ecs_id_record_t
struct ecs_id_record_t ecs_id_record_t
Information about a (component) id, such as type info and tables with the id.
Definition flecs.h:458
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:390
ecs_mixins_t
struct ecs_mixins_t ecs_mixins_t
Type that stores poly mixins.
Definition flecs.h:482
ecs_id_t
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
Definition flecs.h:339
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:426
ecs_table_t
struct ecs_table_t ecs_table_t
A table stores entities and components for a specific type.
Definition flecs.h:396
ecs_poly_t
void ecs_poly_t
A poly object.
Definition flecs.h:479
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_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_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:605
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:585
ecs_hash_value_action_t
uint64_t(* ecs_hash_value_action_t)(const void *ptr)
Callback used for hashing values.
Definition flecs.h:623
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:598
ecs_iter_fini_action_t
void(* ecs_iter_fini_action_t)(ecs_iter_t *it)
Function prototype for freeing an iterator.
Definition flecs.h:563
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:592
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:574
ecs_iter_next_action_t
bool(* ecs_iter_next_action_t)(ecs_iter_t *it)
Function prototype for iterating an iterator.
Definition flecs.h:555
ecs_iter_action_t
void(* ecs_iter_action_t)(ecs_iter_t *it)
Function prototype for iterables.
Definition flecs.h:545
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:633
ecs_compare_action_t
int(* ecs_compare_action_t)(const void *ptr1, const void *ptr2)
Callback used for sorting values.
Definition flecs.h:618
ecs_fini_action_t
void(* ecs_fini_action_t)(ecs_world_t *world, void *ctx)
Action callback on world exit.
Definition flecs.h:609
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:640
flecs_poly_dtor_t
void(* flecs_poly_dtor_t)(ecs_poly_t *poly)
Destructor function for poly objects.
Definition flecs.h:647
ecs_run_action_t
void(* ecs_run_action_t)(ecs_iter_t *it)
Function prototype for runnables (systems, observers).
Definition flecs.h:536
ecs_ctx_free_t
void(* ecs_ctx_free_t)(void *ctx)
Function to cleanup context data.
Definition flecs.h:614
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:567
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:627
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_record_get_entity
ecs_entity_t ecs_record_get_entity(const ecs_record_t *record)
Get entity corresponding with record.
ecs_ref_update
void ecs_ref_update(const ecs_world_t *world, ecs_ref_t *ref)
Update ref.
ecs_record_get_id
const void * ecs_record_get_id(const ecs_world_t *world, const ecs_record_t *record, ecs_id_t id)
Get component from entity record.
ecs_record_get_by_column
void * ecs_record_get_by_column(const ecs_record_t *record, int32_t column, size_t size)
Get component pointer from column/record.
ecs_read_end
void ecs_read_end(const ecs_record_t *record)
End read access to entity.
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_write_end
void ecs_write_end(ecs_record_t *record)
End exclusive write access to entity.
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_record_has_id
bool ecs_record_has_id(ecs_world_t *world, const ecs_record_t *record, ecs_id_t id)
Test if entity for record has a (component) id.
ecs_record_ensure_id
void * ecs_record_ensure_id(ecs_world_t *world, ecs_record_t *record, ecs_id_t id)
Same as ecs_record_get_id(), but returns a mutable pointer.
ecs_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_write_begin
ecs_record_t * ecs_write_begin(ecs_world_t *world, ecs_entity_t entity)
Begin exclusive write access to entity.
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_record_find
ecs_record_t * ecs_record_find(const ecs_world_t *world, ecs_entity_t entity)
Find record for entity.
ecs_read_begin
const ecs_record_t * ecs_read_begin(ecs_world_t *world, ecs_entity_t entity)
Begin read access to entity.
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_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_field_is_readonly
bool ecs_field_is_readonly(const ecs_iter_t *it, int8_t index)
Test whether the field is readonly.
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_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_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:267
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:261
FLECS_TERM_COUNT_MAX
#define FLECS_TERM_COUNT_MAX
Maximum number of terms in queries.
Definition flecs.h:277
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:681
ecs_inout_kind_t
ecs_inout_kind_t
Specify read/write access for term.
Definition flecs.h:660
ecs_oper_kind_t
ecs_oper_kind_t
Specify operator for term.
Definition flecs.h:670
EcsQueryCacheAll
@ EcsQueryCacheAll
Require that all query terms can be cached.
Definition flecs.h:684
EcsQueryCacheDefault
@ EcsQueryCacheDefault
Behavior determined by query creation context.
Definition flecs.h:682
EcsQueryCacheNone
@ EcsQueryCacheNone
No caching.
Definition flecs.h:685
EcsQueryCacheAuto
@ EcsQueryCacheAuto
Cache query terms that are cacheable.
Definition flecs.h:683
EcsOut
@ EcsOut
Term is only written.
Definition flecs.h:666
EcsInOut
@ EcsInOut
Term is both read and written.
Definition flecs.h:664
EcsInOutFilter
@ EcsInOutFilter
Same as InOutNone + prevents term from triggering observers.
Definition flecs.h:663
EcsInOutDefault
@ EcsInOutDefault
InOut for regular terms, In for shared terms.
Definition flecs.h:661
EcsInOutNone
@ EcsInOutNone
Term is neither read nor written.
Definition flecs.h:662
EcsIn
@ EcsIn
Term is only read.
Definition flecs.h:665
EcsNot
@ EcsNot
The term must not match.
Definition flecs.h:673
EcsOptional
@ EcsOptional
The term may match.
Definition flecs.h:674
EcsOr
@ EcsOr
One of the terms in an or chain must match.
Definition flecs.h:672
EcsOrFrom
@ EcsOrFrom
Term must match at least one component from term id.
Definition flecs.h:676
EcsAnd
@ EcsAnd
The term must match.
Definition flecs.h:671
EcsNotFrom
@ EcsNotFrom
Term must match none of the components from term id.
Definition flecs.h:677
EcsAndFrom
@ EcsAndFrom
Term must match all components from term id.
Definition flecs.h:675
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_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_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_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:1486
EcsComponent::size
ecs_size_t size
Component size.
Definition flecs.h:1487
EcsComponent::alignment
ecs_size_t alignment
Component alignment.
Definition flecs.h:1488
EcsDefaultChildComponent
When added to an entity this informs serialization formats which component to use when a value is ass...
Definition flecs.h:1501
EcsDefaultChildComponent::component
ecs_id_t component
Default component id.
Definition flecs.h:1502
EcsIdentifier
A (string) identifier.
Definition flecs.h:1477
EcsIdentifier::length
ecs_size_t length
Length of identifier.
Definition flecs.h:1479
EcsIdentifier::value
char * value
Identifier string.
Definition flecs.h:1478
EcsIdentifier::index
ecs_hashmap_t * index
Current index.
Definition flecs.h:1482
EcsIdentifier::hash
uint64_t hash
Hash of current value.
Definition flecs.h:1480
EcsIdentifier::index_hash
uint64_t index_hash
Hash of existing record in current index.
Definition flecs.h:1481
EcsPoly
Component for storing a poly object.
Definition flecs.h:1492
EcsPoly::poly
ecs_poly_t * poly
Pointer to poly object.
Definition flecs.h:1493
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:1389
ecs_build_info_t::version_major
int16_t version_major
Major flecs version.
Definition flecs.h:1393
ecs_build_info_t::addons
const char ** addons
Addons included in build.
Definition flecs.h:1391
ecs_build_info_t::version
const char * version
Stringified version.
Definition flecs.h:1392
ecs_build_info_t::compiler
const char * compiler
Compiler used to compile flecs.
Definition flecs.h:1390
ecs_build_info_t::sanitize
bool sanitize
Is this a sanitize build.
Definition flecs.h:1397
ecs_build_info_t::perf_trace
bool perf_trace
Is this a perf tracing build.
Definition flecs.h:1398
ecs_build_info_t::version_minor
int16_t version_minor
Minor flecs version.
Definition flecs.h:1394
ecs_build_info_t::debug
bool debug
Is this a debug build.
Definition flecs.h:1396
ecs_build_info_t::version_patch
int16_t version_patch
Patch flecs version.
Definition flecs.h:1395
ecs_bulk_desc_t
Used with ecs_bulk_init().
Definition flecs.h:1021
ecs_bulk_desc_t::data
void ** data
Array with component data to insert.
Definition flecs.h:1033
ecs_bulk_desc_t::ids
ecs_id_t ids[(32)]
Ids to create the entities with.
Definition flecs.h:1031
ecs_bulk_desc_t::count
int32_t count
Number of entities to create/populate.
Definition flecs.h:1029
ecs_bulk_desc_t::_canary
int32_t _canary
Used for validity testing.
Definition flecs.h:1022
ecs_bulk_desc_t::entities
ecs_entity_t * entities
Entities to bulk insert.
Definition flecs.h:1024
ecs_bulk_desc_t::table
ecs_table_t * table
Table to insert the entities into.
Definition flecs.h:1040
ecs_component_desc_t
Used with ecs_component_init().
Definition flecs.h:1051
ecs_component_desc_t::_canary
int32_t _canary
Used for validity testing.
Definition flecs.h:1052
ecs_component_desc_t::type
ecs_type_info_t type
Parameters for type (size, hooks, ...)
Definition flecs.h:1058
ecs_component_desc_t::entity
ecs_entity_t entity
Existing entity to associate with observer (optional)
Definition flecs.h:1055
ecs_delete_empty_tables_desc_t
Used with ecs_delete_empty_tables().
Definition flecs.h:2565
ecs_delete_empty_tables_desc_t::delete_generation
uint16_t delete_generation
Delete table when generation > delete_generation.
Definition flecs.h:2573
ecs_delete_empty_tables_desc_t::time_budget_seconds
double time_budget_seconds
Amount of time operation is allowed to spend.
Definition flecs.h:2579
ecs_delete_empty_tables_desc_t::clear_generation
uint16_t clear_generation
Free table data when generation > clear_generation.
Definition flecs.h:2570
ecs_delete_empty_tables_desc_t::id
ecs_id_t id
Optional component filter for the tables to evaluate.
Definition flecs.h:2567
ecs_delete_empty_tables_desc_t::min_id_count
int32_t min_id_count
Minimum number of component ids the table should have.
Definition flecs.h:2576
ecs_entities_t
Type returned by ecs_get_entities().
Definition flecs.h:1950
ecs_entities_t::alive_count
int32_t alive_count
Number of alive entity ids.
Definition flecs.h:1953
ecs_entities_t::count
int32_t count
Total number of entity ids.
Definition flecs.h:1952
ecs_entities_t::ids
const ecs_entity_t * ids
Array with all entity ids in the world.
Definition flecs.h:1951
ecs_entity_desc_t
Used with ecs_entity_init().
Definition flecs.h:975
ecs_entity_desc_t::sep
const char * sep
Optional custom separator for hierarchical names.
Definition flecs.h:987
ecs_entity_desc_t::root_sep
const char * root_sep
Optional, used for identifiers relative to root.
Definition flecs.h:991
ecs_entity_desc_t::name
const char * name
Name of the entity.
Definition flecs.h:982
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:1003
ecs_entity_desc_t::symbol
const char * symbol
Optional entity symbol.
Definition flecs.h:993
ecs_entity_desc_t::_canary
int32_t _canary
Used for validity testing.
Definition flecs.h:976
ecs_entity_desc_t::add
const ecs_id_t * add
0-terminated array of ids to add to the entity.
Definition flecs.h:1008
ecs_entity_desc_t::add_expr
const char * add_expr
String expression with components to add.
Definition flecs.h:1014
ecs_entity_desc_t::set
const ecs_value_t * set
0-terminated array of values to set on the entity.
Definition flecs.h:1011
ecs_entity_desc_t::id
ecs_entity_t id
Set to modify existing entity (optional)
Definition flecs.h:978
ecs_entity_desc_t::parent
ecs_entity_t parent
Parent entity.
Definition flecs.h:980
ecs_event_desc_t
Used with ecs_emit().
Definition flecs.h:1335
ecs_event_desc_t::entity
ecs_entity_t entity
Single-entity alternative to setting table / offset / count.
Definition flecs.h:1360
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:1371
ecs_event_desc_t::table
ecs_table_t * table
The table for which to notify.
Definition flecs.h:1345
ecs_event_desc_t::count
int32_t count
Limit number of notified entities to count.
Definition flecs.h:1357
ecs_event_desc_t::other_table
ecs_table_t * other_table
Optional 2nd table to notify.
Definition flecs.h:1349
ecs_event_desc_t::offset
int32_t offset
Limit notified entities to ones starting from offset (row) in table.
Definition flecs.h:1352
ecs_event_desc_t::ids
const ecs_type_t * ids
Component ids.
Definition flecs.h:1342
ecs_event_desc_t::observable
ecs_poly_t * observable
Observable (usually the world)
Definition flecs.h:1374
ecs_event_desc_t::event
ecs_entity_t event
The event id.
Definition flecs.h:1337
ecs_event_desc_t::flags
ecs_flags32_t flags
Event flags.
Definition flecs.h:1377
ecs_event_desc_t::param
void * param
Optional context.
Definition flecs.h:1366
ecs_header_t
Header for ecs_poly_t objects.
Definition flecs.h:485
ecs_header_t::magic
int32_t magic
Magic number verifying it's a flecs object.
Definition flecs.h:486
ecs_header_t::type
int32_t type
Magic number indicating which type of flecs object.
Definition flecs.h:487
ecs_header_t::refcount
int32_t refcount
Refcount, to enable RAII handles.
Definition flecs.h:488
ecs_header_t::mixins
ecs_mixins_t * mixins
Table with offsets to (optional) mixins.
Definition flecs.h:489
ecs_iter_t
Iterator.
Definition flecs.h:1099
ecs_iter_t::real_world
ecs_world_t * real_world
Actual world.
Definition flecs.h:1102
ecs_iter_t::param
void * param
Param passed to ecs_run.
Definition flecs.h:1136
ecs_iter_t::event
ecs_entity_t event
The event (if applicable)
Definition flecs.h:1122
ecs_iter_t::frame_offset
int32_t frame_offset
Offset relative to start of iteration.
Definition flecs.h:1147
ecs_iter_t::variable_names
char ** variable_names
Names of variables (if any)
Definition flecs.h:1133
ecs_iter_t::ref_fields
ecs_flags32_t ref_fields
Bitset with fields that aren't component arrays.
Definition flecs.h:1116
ecs_iter_t::variable_count
int8_t variable_count
Number of variables for query.
Definition flecs.h:1131
ecs_iter_t::interrupted_by
ecs_entity_t interrupted_by
When set, system execution is interrupted.
Definition flecs.h:1153
ecs_iter_t::flags
ecs_flags32_t flags
Iterator flags.
Definition flecs.h:1152
ecs_iter_t::chain_it
ecs_iter_t * chain_it
Optional, allows for creating iterator chains.
Definition flecs.h:1160
ecs_iter_t::ctx
void * ctx
System context.
Definition flecs.h:1137
ecs_iter_t::run_ctx
void * run_ctx
Run language binding context.
Definition flecs.h:1140
ecs_iter_t::table
ecs_table_t * table
Current table.
Definition flecs.h:1107
ecs_iter_t::offset
int32_t offset
Offset relative to current table.
Definition flecs.h:1148
ecs_iter_t::event_id
ecs_id_t event_id
The (component) id for the event.
Definition flecs.h:1123
ecs_iter_t::fini
ecs_iter_fini_action_t fini
Function to cleanup iterator resources.
Definition flecs.h:1159
ecs_iter_t::variables
ecs_var_t * variables
Values of variables (if any)
Definition flecs.h:1110
ecs_iter_t::priv_
ecs_iter_private_t priv_
Private data.
Definition flecs.h:1154
ecs_iter_t::world
ecs_world_t * world
The world.
Definition flecs.h:1101
ecs_iter_t::callback_ctx
void * callback_ctx
Callback language binding context.
Definition flecs.h:1139
ecs_iter_t::sources
ecs_entity_t * sources
Entity on which the id was matched (0 if same as entities)
Definition flecs.h:1112
ecs_iter_t::binding_ctx
void * binding_ctx
System binding context.
Definition flecs.h:1138
ecs_iter_t::row_fields
ecs_flags32_t row_fields
Fields that must be obtained with field_at.
Definition flecs.h:1117
ecs_iter_t::delta_system_time
float delta_system_time
Time elapsed since last system invocation.
Definition flecs.h:1144
ecs_iter_t::query
const ecs_query_t * query
Query being evaluated.
Definition flecs.h:1132
ecs_iter_t::term_index
int8_t term_index
Index of term that emitted an event.
Definition flecs.h:1128
ecs_iter_t::system
ecs_entity_t system
The system (if applicable)
Definition flecs.h:1121
ecs_iter_t::set_fields
ecs_flags32_t set_fields
Fields that are set.
Definition flecs.h:1115
ecs_iter_t::sizes
const ecs_size_t * sizes
Component sizes.
Definition flecs.h:1106
ecs_iter_t::delta_time
float delta_time
Time elapsed since last frame.
Definition flecs.h:1143
ecs_iter_t::up_fields
ecs_flags32_t up_fields
Bitset with fields matched through up traversal.
Definition flecs.h:1118
ecs_iter_t::callback
ecs_iter_action_t callback
Callback of system or observer.
Definition flecs.h:1158
ecs_iter_t::field_count
int8_t field_count
Number of fields in iterator.
Definition flecs.h:1127
ecs_iter_t::other_table
ecs_table_t * other_table
Prev or next table when adding/removing.
Definition flecs.h:1108
ecs_iter_t::event_cur
int32_t event_cur
Unique event id.
Definition flecs.h:1124
ecs_iter_t::trs
const ecs_table_record_t ** trs
Info on where to find field in table.
Definition flecs.h:1111
ecs_iter_t::count
int32_t count
Number of entities to iterate.
Definition flecs.h:1149
ecs_iter_t::group_id
uint64_t group_id
Group id for table, if group_by is used.
Definition flecs.h:1114
ecs_iter_t::next
ecs_iter_next_action_t next
Function to progress iterator.
Definition flecs.h:1157
ecs_iter_t::entities
const ecs_entity_t * entities
Entity identifiers.
Definition flecs.h:1105
ecs_iter_t::ids
ecs_id_t * ids
(Component) ids
Definition flecs.h:1109
ecs_iter_t::constrained_vars
ecs_flags64_t constrained_vars
Bitset that marks constrained variables.
Definition flecs.h:1113
ecs_observer_desc_t
Used with ecs_observer_init().
Definition flecs.h:1273
ecs_observer_desc_t::run_ctx_free
ecs_ctx_free_t run_ctx_free
Callback to free run ctx.
Definition flecs.h:1317
ecs_observer_desc_t::ctx_free
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:1305
ecs_observer_desc_t::run_ctx
void * run_ctx
Context associated with run (for language bindings).
Definition flecs.h:1314
ecs_observer_desc_t::entity
ecs_entity_t entity
Existing entity to associate with observer (optional)
Definition flecs.h:1278
ecs_observer_desc_t::events
ecs_entity_t events[(8)]
Events to observe (OnAdd, OnRemove, OnSet)
Definition flecs.h:1284
ecs_observer_desc_t::last_event_id
int32_t * last_event_id
Optional shared last event id for multiple observers.
Definition flecs.h:1324
ecs_observer_desc_t::callback_ctx
void * callback_ctx
Context associated with callback (for language bindings).
Definition flecs.h:1308
ecs_observer_desc_t::ctx
void * ctx
User context to pass to callback.
Definition flecs.h:1302
ecs_observer_desc_t::query
ecs_query_desc_t query
Query for observer.
Definition flecs.h:1281
ecs_observer_desc_t::observable
ecs_poly_t * observable
Observable with which to register the observer.
Definition flecs.h:1320
ecs_observer_desc_t::callback_ctx_free
ecs_ctx_free_t callback_ctx_free
Callback to free callback ctx.
Definition flecs.h:1311
ecs_observer_desc_t::term_index_
int8_t term_index_
Used for internal purposes.
Definition flecs.h:1327
ecs_observer_desc_t::callback
ecs_iter_action_t callback
Callback to invoke on an event, invoked when the observer matches.
Definition flecs.h:1291
ecs_observer_desc_t::yield_existing
bool yield_existing
When observer is created, generate events from existing data.
Definition flecs.h:1288
ecs_observer_desc_t::run
ecs_run_action_t run
Callback invoked on an event.
Definition flecs.h:1299
ecs_observer_desc_t::_canary
int32_t _canary
Used for validity testing.
Definition flecs.h:1275
ecs_observer_t
An observer reacts to events matching a query.
Definition flecs.h:830
ecs_observer_t::event_count
int32_t event_count
Number of events.
Definition flecs.h:837
ecs_observer_t::callback
ecs_iter_action_t callback
See ecs_observer_desc_t::callback.
Definition flecs.h:839
ecs_observer_t::entity
ecs_entity_t entity
Entity associated with observer.
Definition flecs.h:853
ecs_observer_t::observable
ecs_observable_t * observable
Observable for observer.
Definition flecs.h:850
ecs_observer_t::run
ecs_run_action_t run
See ecs_observer_desc_t::run.
Definition flecs.h:840
ecs_observer_t::hdr
ecs_header_t hdr
Object header.
Definition flecs.h:831
ecs_observer_t::ctx_free
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:846
ecs_observer_t::run_ctx
void * run_ctx
Run language binding context.
Definition flecs.h:844
ecs_observer_t::world
ecs_world_t * world
The world.
Definition flecs.h:852
ecs_observer_t::run_ctx_free
ecs_ctx_free_t run_ctx_free
Callback to free run_ctx.
Definition flecs.h:848
ecs_observer_t::callback_ctx
void * callback_ctx
Callback language binding context.
Definition flecs.h:843
ecs_observer_t::ctx
void * ctx
Observer context.
Definition flecs.h:842
ecs_observer_t::events
ecs_entity_t events[(8)]
Observer events.
Definition flecs.h:836
ecs_observer_t::callback_ctx_free
ecs_ctx_free_t callback_ctx_free
Callback to free callback_ctx.
Definition flecs.h:847
ecs_observer_t::query
ecs_query_t * query
Observer query.
Definition flecs.h:833
ecs_query_count_t
Struct returned by ecs_query_count().
Definition flecs.h:4982
ecs_query_count_t::empty_tables
int32_t empty_tables
Number of empty tables returned by query.
Definition flecs.h:4986
ecs_query_count_t::entities
int32_t entities
Number of entities returned by query.
Definition flecs.h:4984
ecs_query_count_t::results
int32_t results
Number of results returned by query.
Definition flecs.h:4983
ecs_query_count_t::tables
int32_t tables
Number of tables returned by query.
Definition flecs.h:4985
ecs_query_desc_t
Used with ecs_query_init().
Definition flecs.h:1199
ecs_query_desc_t::ctx_free
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:1260
ecs_query_desc_t::group_by
ecs_id_t group_by
Component id to be used for grouping.
Definition flecs.h:1230
ecs_query_desc_t::terms
ecs_term_t terms[32]
Query terms.
Definition flecs.h:1204
ecs_query_desc_t::_canary
int32_t _canary
Used for validity testing.
Definition flecs.h:1201
ecs_query_desc_t::ctx
void * ctx
User context to pass to callback.
Definition flecs.h:1254
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:1251
ecs_query_desc_t::group_by_ctx
void * group_by_ctx
Context to pass to group_by.
Definition flecs.h:1248
ecs_query_desc_t::binding_ctx
void * binding_ctx
Context to be used for language bindings.
Definition flecs.h:1257
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:1226
ecs_query_desc_t::order_by_callback
ecs_order_by_action_t order_by_callback
Callback used for ordering query results.
Definition flecs.h:1218
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:1241
ecs_query_desc_t::entity
ecs_entity_t entity
Entity associated with query (optional)
Definition flecs.h:1266
ecs_query_desc_t::binding_ctx_free
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:1263
ecs_query_desc_t::group_by_callback
ecs_group_by_action_t group_by_callback
Callback used for grouping results.
Definition flecs.h:1237
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:1245
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:1222
ecs_query_desc_t::flags
ecs_flags32_t flags
Flags for enabling query features.
Definition flecs.h:1213
ecs_query_desc_t::cache_kind
ecs_query_cache_kind_t cache_kind
Caching policy of query.
Definition flecs.h:1210
ecs_query_desc_t::expr
const char * expr
Query DSL expression (optional)
Definition flecs.h:1207
ecs_query_group_info_t
Type that contains information about a query group.
Definition flecs.h:1461
ecs_query_group_info_t::table_count
int32_t table_count
Number of tables in group.
Definition flecs.h:1463
ecs_query_group_info_t::ctx
void * ctx
Group context, returned by on_group_create.
Definition flecs.h:1464
ecs_query_group_info_t::match_count
int32_t match_count
How often tables have been matched/unmatched.
Definition flecs.h:1462
ecs_query_t
Queries are lists of constraints (terms) that match entities.
Definition flecs.h:790
ecs_query_t::row_fields
ecs_flags32_t row_fields
Fields that must be acquired with field_at.
Definition flecs.h:809
ecs_query_t::data_fields
ecs_flags32_t data_fields
Fields that have data.
Definition flecs.h:806
ecs_query_t::read_fields
ecs_flags32_t read_fields
Fields that read data.
Definition flecs.h:808
ecs_query_t::hdr
ecs_header_t hdr
Object header.
Definition flecs.h:791
ecs_query_t::terms
ecs_term_t terms[32]
Query terms.
Definition flecs.h:793
ecs_query_t::var_count
int8_t var_count
Number of query variables.
Definition flecs.h:798
ecs_query_t::fixed_fields
ecs_flags32_t fixed_fields
Fields with a fixed source.
Definition flecs.h:803
ecs_query_t::var_fields
ecs_flags32_t var_fields
Fields with non-$this variable source.
Definition flecs.h:804
ecs_query_t::write_fields
ecs_flags32_t write_fields
Fields that write data.
Definition flecs.h:807
ecs_query_t::sizes
int32_t sizes[32]
Component sizes.
Definition flecs.h:794
ecs_query_t::eval_count
int32_t eval_count
Number of times query is evaluated.
Definition flecs.h:824
ecs_query_t::world
ecs_world_t * world
World or stage query was created with.
Definition flecs.h:822
ecs_query_t::static_id_fields
ecs_flags32_t static_id_fields
Fields with a static (component) id.
Definition flecs.h:805
ecs_query_t::real_world
ecs_world_t * real_world
Actual world.
Definition flecs.h:821
ecs_query_t::set_fields
ecs_flags32_t set_fields
Fields that will be set.
Definition flecs.h:811
ecs_query_t::entity
ecs_entity_t entity
Entity associated with query (optional)
Definition flecs.h:820
ecs_query_t::ctx
void * ctx
User context to pass to callback.
Definition flecs.h:817
ecs_query_t::shared_readonly_fields
ecs_flags32_t shared_readonly_fields
Fields that don't write shared data.
Definition flecs.h:810
ecs_query_t::ids
ecs_id_t ids[32]
Component ids.
Definition flecs.h:795
ecs_query_t::cache_kind
ecs_query_cache_kind_t cache_kind
Caching policy of query.
Definition flecs.h:813
ecs_query_t::term_count
int8_t term_count
Number of query terms.
Definition flecs.h:799
ecs_query_t::vars
char ** vars
Array with variable names for iterator.
Definition flecs.h:815
ecs_query_t::field_count
int8_t field_count
Number of fields returned by query.
Definition flecs.h:800
ecs_query_t::flags
ecs_flags32_t flags
Query flags.
Definition flecs.h:797
ecs_query_t::binding_ctx
void * binding_ctx
Context to be used for language bindings.
Definition flecs.h:818
ecs_record_t
Record for entity index.
Definition flecs.h:493
ecs_record_t::table
ecs_table_t * table
Identifies a type (and table) in world.
Definition flecs.h:495
ecs_record_t::row
uint32_t row
Table row of the entity.
Definition flecs.h:496
ecs_record_t::idr
ecs_id_record_t * idr
Id record to (*, entity) for target entities.
Definition flecs.h:494
ecs_record_t::dense
int32_t dense
Index in dense array of entity index.
Definition flecs.h:497
ecs_table_cache_hdr_t
Header for table cache elements.
Definition flecs.h:501
ecs_table_cache_hdr_t::next
struct ecs_table_cache_hdr_t * next
Next/previous elements for id in table cache.
Definition flecs.h:504
ecs_table_cache_hdr_t::cache
struct ecs_table_cache_t * cache
Table cache of element.
Definition flecs.h:502
ecs_table_cache_hdr_t::table
ecs_table_t * table
Table associated with element.
Definition flecs.h:503
ecs_table_record_t
Metadata describing where a component id is stored in a table.
Definition flecs.h:511
ecs_table_record_t::hdr
ecs_table_cache_hdr_t hdr
Table cache header.
Definition flecs.h:512
ecs_table_record_t::index
int16_t index
First type index where id occurs in table.
Definition flecs.h:513
ecs_table_record_t::column
int16_t column
First column index where id occurs.
Definition flecs.h:515
ecs_table_record_t::count
int16_t count
Number of times id occurs in table.
Definition flecs.h:514
ecs_term_ref_t
Type that describes a reference to an entity or variable in a term.
Definition flecs.h:751
ecs_term_ref_t::name
const char * name
Name.
Definition flecs.h:758
ecs_term_ref_t::id
ecs_entity_t id
Entity id.
Definition flecs.h:752
ecs_term_t
Type that describes a term (single element in a query).
Definition flecs.h:766
ecs_term_t::src
ecs_term_ref_t src
Source of term.
Definition flecs.h:772
ecs_term_t::field_index
int8_t field_index
Index of field for term in iterator.
Definition flecs.h:783
ecs_term_t::id
ecs_id_t id
Component id to be matched by term.
Definition flecs.h:767
ecs_term_t::oper
int16_t oper
Operator of term.
Definition flecs.h:781
ecs_term_t::second
ecs_term_ref_t second
Second element of pair.
Definition flecs.h:774
ecs_term_t::flags_
ecs_flags16_t flags_
Flags that help eval, set by ecs_query_init()
Definition flecs.h:784
ecs_term_t::trav
ecs_entity_t trav
Relationship to traverse when looking for the component.
Definition flecs.h:776
ecs_term_t::inout
int16_t inout
Access to contents matched by term.
Definition flecs.h:780
ecs_term_t::first
ecs_term_ref_t first
Component or first element of pair.
Definition flecs.h:773
ecs_type_hooks_t
Definition flecs.h:896
ecs_type_hooks_t::copy_ctor
ecs_copy_t copy_ctor
Ctor + copy.
Definition flecs.h:903
ecs_type_hooks_t::lifecycle_ctx
void * lifecycle_ctx
Component lifecycle context (see meta add-on)
Definition flecs.h:942
ecs_type_hooks_t::ctx
void * ctx
User defined context.
Definition flecs.h:940
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:938
ecs_type_hooks_t::binding_ctx
void * binding_ctx
Language binding context.
Definition flecs.h:941
ecs_type_hooks_t::move_dtor
ecs_move_t move_dtor
Move + dtor.
Definition flecs.h:918
ecs_type_hooks_t::flags
ecs_flags32_t flags
Hook flags.
Definition flecs.h:924
ecs_type_hooks_t::copy
ecs_copy_t copy
copy assignment
Definition flecs.h:899
ecs_type_hooks_t::lifecycle_ctx_free
ecs_ctx_free_t lifecycle_ctx_free
Callback to free lifecycle_ctx.
Definition flecs.h:946
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:933
ecs_type_hooks_t::move
ecs_move_t move
move assignment
Definition flecs.h:900
ecs_type_hooks_t::ctor
ecs_xtor_t ctor
ctor
Definition flecs.h:897
ecs_type_hooks_t::ctx_free
ecs_ctx_free_t ctx_free
Callback to free ctx.
Definition flecs.h:944
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:928
ecs_type_hooks_t::binding_ctx_free
ecs_ctx_free_t binding_ctx_free
Callback to free binding_ctx.
Definition flecs.h:945
ecs_type_hooks_t::move_ctor
ecs_move_t move_ctor
Ctor + move.
Definition flecs.h:906
ecs_type_hooks_t::ctor_move_dtor
ecs_move_t ctor_move_dtor
Ctor + move + dtor (or move_ctor + dtor).
Definition flecs.h:912
ecs_type_hooks_t::dtor
ecs_xtor_t dtor
dtor
Definition flecs.h:898
ecs_type_info_t
Type that contains component information (passed to ctors/dtors/...)
Definition flecs.h:953
ecs_type_info_t::alignment
ecs_size_t alignment
Alignment of type.
Definition flecs.h:955
ecs_type_info_t::size
ecs_size_t size
Size of type.
Definition flecs.h:954
ecs_type_info_t::name
const char * name
Type name.
Definition flecs.h:958
ecs_type_info_t::component
ecs_entity_t component
Handle to component (do not set)
Definition flecs.h:957
ecs_type_info_t::hooks
ecs_type_hooks_t hooks
Type hooks.
Definition flecs.h:956
ecs_type_t
A type is a list of (component) ids.
Definition flecs.h:363
ecs_type_t::array
ecs_id_t * array
Array with ids.
Definition flecs.h:364
ecs_type_t::count
int32_t count
Number of elements in array.
Definition flecs.h:365
ecs_value_t
Utility to hold a value of a dynamic type.
Definition flecs.h:966
ecs_value_t::ptr
void * ptr
Pointer to value.
Definition flecs.h:968
ecs_value_t::type
ecs_entity_t type
Type of value.
Definition flecs.h:967
ecs_world_info_t
Type that contains information about the world.
Definition flecs.h:1402
ecs_world_info_t::delta_time
float delta_time
Time passed to or computed by ecs_progress()
Definition flecs.h:1408
ecs_world_info_t::min_id
ecs_entity_t min_id
First allowed entity id.
Definition flecs.h:1404
ecs_world_info_t::set_count
int64_t set_count
Set commands processed.
Definition flecs.h:1444
ecs_world_info_t::world_time_total
double world_time_total
Time elapsed in simulation.
Definition flecs.h:1416
ecs_world_info_t::tag_id_count
int32_t tag_id_count
Number of tag (no data) ids in the world.
Definition flecs.h:1432
ecs_world_info_t::component_id_count
int32_t component_id_count
Number of component (data) ids in the world.
Definition flecs.h:1433
ecs_world_info_t::pipeline_build_count_total
int64_t pipeline_build_count_total
Total number of pipeline builds.
Definition flecs.h:1428
ecs_world_info_t::eval_comp_monitors_total
int64_t eval_comp_monitors_total
Total number of monitor evaluations.
Definition flecs.h:1421
ecs_world_info_t::table_count
int32_t table_count
Number of tables.
Definition flecs.h:1436
ecs_world_info_t::delta_time_raw
float delta_time_raw
Raw delta time (no time scaling)
Definition flecs.h:1407
ecs_world_info_t::frame_time_total
float frame_time_total
Total time spent processing a frame.
Definition flecs.h:1411
ecs_world_info_t::table_create_total
int64_t table_create_total
Total number of times a table was created.
Definition flecs.h:1426
ecs_world_info_t::observers_ran_frame
int64_t observers_ran_frame
Total number of times observer was invoked.
Definition flecs.h:1430
ecs_world_info_t::system_time_total
float system_time_total
Total time spent in systems.
Definition flecs.h:1412
ecs_world_info_t::id_delete_total
int64_t id_delete_total
Total number of times an id was deleted.
Definition flecs.h:1425
ecs_world_info_t::systems_ran_frame
int64_t systems_ran_frame
Total number of systems ran in last frame.
Definition flecs.h:1429
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:1414
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:1447
ecs_world_info_t::clear_count
int64_t clear_count
Clear commands processed.
Definition flecs.h:1443
ecs_world_info_t::last_component_id
ecs_entity_t last_component_id
Last issued component entity id.
Definition flecs.h:1403
ecs_world_info_t::frame_count_total
int64_t frame_count_total
Total number of frames.
Definition flecs.h:1419
ecs_world_info_t::max_id
ecs_entity_t max_id
Last allowed entity id.
Definition flecs.h:1405
ecs_world_info_t::merge_count_total
int64_t merge_count_total
Total number of merges.
Definition flecs.h:1420
ecs_world_info_t::other_count
int64_t other_count
Other commands processed.
Definition flecs.h:1449
ecs_world_info_t::batched_command_count
int64_t batched_command_count
Commands batched.
Definition flecs.h:1451
ecs_world_info_t::table_delete_total
int64_t table_delete_total
Total number of times a table was deleted.
Definition flecs.h:1427
ecs_world_info_t::delete_count
int64_t delete_count
Selete commands processed.
Definition flecs.h:1442
ecs_world_info_t::rematch_count_total
int64_t rematch_count_total
Total number of rematches.
Definition flecs.h:1422
ecs_world_info_t::id_create_total
int64_t id_create_total
Total number of times a new id was created.
Definition flecs.h:1424
ecs_world_info_t::batched_entity_count
int64_t batched_entity_count
Entities for which commands were batched.
Definition flecs.h:1450
ecs_world_info_t::time_scale
float time_scale
Time scale applied to delta_time.
Definition flecs.h:1409
ecs_world_info_t::pair_id_count
int32_t pair_id_count
Number of pair ids in the world.
Definition flecs.h:1434
ecs_world_info_t::rematch_time_total
float rematch_time_total
Time spent on query rematching.
Definition flecs.h:1415
ecs_world_info_t::ensure_count
int64_t ensure_count
Ensure/emplace commands processed.
Definition flecs.h:1445
ecs_world_info_t::target_fps
float target_fps
Target fps.
Definition flecs.h:1410
ecs_world_info_t::world_time_total_raw
double world_time_total_raw
Time elapsed in simulation (no scaling)
Definition flecs.h:1417
ecs_world_info_t::emit_time_total
float emit_time_total
Total time spent notifying observers.
Definition flecs.h:1413
ecs_world_info_t::modified_count
int64_t modified_count
Modified commands processed.
Definition flecs.h:1446
ecs_world_info_t::name_prefix
const char * name_prefix
Value set by ecs_set_name_prefix().
Definition flecs.h:1454
ecs_world_info_t::event_count
int64_t event_count
Enqueued custom events.
Definition flecs.h:1448
ecs_world_info_t::add_count
int64_t add_count
Add commands processed.
Definition flecs.h:1440
ecs_world_info_t::remove_count
int64_t remove_count
Remove commands processed.
Definition flecs.h:1441