Flecs v4.0
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
flecs_c.h
Go to the documentation of this file.
1
6#ifndef FLECS_C_
7#define FLECS_C_
8
24/* Use for declaring entity, tag, prefab / any other entity identifier */
25#define ECS_DECLARE(id)\
26 ecs_entity_t id, ecs_id(id)
27
29#define ECS_ENTITY_DECLARE ECS_DECLARE
30
39#define ECS_ENTITY_DEFINE(world, id_, ...) \
40 { \
41 ecs_entity_desc_t desc = {0}; \
42 desc.id = id_; \
43 desc.name = #id_; \
44 desc.add_expr = #__VA_ARGS__; \
45 id_ = ecs_entity_init(world, &desc); \
46 ecs_id(id_) = id_; \
47 ecs_assert(id_ != 0, ECS_INVALID_PARAMETER, "failed to create entity %s", #id_); \
48 } \
49 (void)id_; \
50 (void)ecs_id(id_)
51
60#define ECS_ENTITY(world, id, ...) \
61 ecs_entity_t ecs_id(id); \
62 ecs_entity_t id = 0; \
63 ECS_ENTITY_DEFINE(world, id, __VA_ARGS__)
64
66#define ECS_TAG_DECLARE ECS_DECLARE
67
76#define ECS_TAG_DEFINE(world, id) ECS_ENTITY_DEFINE(world, id, 0)
77
86#define ECS_TAG(world, id) ECS_ENTITY(world, id, 0)
87
89#define ECS_PREFAB_DECLARE ECS_DECLARE
90
99#define ECS_PREFAB_DEFINE(world, id, ...) ECS_ENTITY_DEFINE(world, id, Prefab, __VA_ARGS__)
100
109#define ECS_PREFAB(world, id, ...) ECS_ENTITY(world, id, Prefab, __VA_ARGS__)
110
112#define ECS_COMPONENT_DECLARE(id) ecs_entity_t ecs_id(id)
113
122#define ECS_COMPONENT_DEFINE(world, id_) \
123 {\
124 ecs_component_desc_t desc = {0}; \
125 ecs_entity_desc_t edesc = {0}; \
126 edesc.id = ecs_id(id_); \
127 edesc.use_low_id = true; \
128 edesc.name = #id_; \
129 edesc.symbol = #id_; \
130 desc.entity = ecs_entity_init(world, &edesc); \
131 desc.type.size = ECS_SIZEOF(id_); \
132 desc.type.alignment = ECS_ALIGNOF(id_); \
133 ecs_id(id_) = ecs_component_init(world, &desc);\
134 }\
135 ecs_assert(ecs_id(id_) != 0, ECS_INVALID_PARAMETER, "failed to create component %s", #id_)
136
145#define ECS_COMPONENT(world, id)\
146 ecs_entity_t ecs_id(id) = 0;\
147 ECS_COMPONENT_DEFINE(world, id);\
148 (void)ecs_id(id)
149
150/* Forward declare an observer. */
151#define ECS_OBSERVER_DECLARE(id) ecs_entity_t ecs_id(id)
152
161#define ECS_OBSERVER_DEFINE(world, id_, kind, ...)\
162 {\
163 ecs_observer_desc_t desc = {0};\
164 ecs_entity_desc_t edesc = {0}; \
165 edesc.id = ecs_id(id_); \
166 edesc.name = #id_; \
167 desc.entity = ecs_entity_init(world, &edesc); \
168 desc.callback = id_;\
169 desc.query.expr = #__VA_ARGS__;\
170 desc.events[0] = kind;\
171 ecs_id(id_) = ecs_observer_init(world, &desc);\
172 ecs_assert(ecs_id(id_) != 0, ECS_INVALID_PARAMETER, "failed to create observer %s", #id_);\
173 }
174
183#define ECS_OBSERVER(world, id, kind, ...)\
184 ecs_entity_t ecs_id(id) = 0; \
185 ECS_OBSERVER_DEFINE(world, id, kind, __VA_ARGS__);\
186 ecs_entity_t id = ecs_id(id);\
187 (void)ecs_id(id);\
188 (void)id
189
190/* Forward declare a query. */
191#define ECS_QUERY_DECLARE(name) ecs_query_t* name
192
201#define ECS_QUERY_DEFINE(world, name_, ...)\
202 {\
203 ecs_query_desc_t desc = {0};\
204 ecs_entity_desc_t edesc = {0}; \
205 edesc.name = #name_; \
206 desc.entity = ecs_entity_init(world, &edesc); \
207 desc.expr = #__VA_ARGS__;\
208 name_ = ecs_query_init(world, &desc);\
209 ecs_assert(name_ != NULL, ECS_INVALID_PARAMETER, "failed to create query %s", #name_);\
210 }
211
220#define ECS_QUERY(world, name, ...)\
221 ecs_query_t* name = NULL; \
222 ECS_QUERY_DEFINE(world, name, __VA_ARGS__);\
223 (void)name
224
235#define ecs_entity(world, ...)\
236 ecs_entity_init(world, &(ecs_entity_desc_t) __VA_ARGS__ )
237
249#define ecs_component(world, ...)\
250 ecs_component_init(world, &(ecs_component_desc_t) __VA_ARGS__ )
251
260#define ecs_component_t(world, T)\
261 ecs_component_init(world, &(ecs_component_desc_t) { \
262 .entity = ecs_entity(world, { \
263 .name = #T, \
264 .symbol = #T, \
265 .use_low_id = true \
266 }), \
267 .type.size = ECS_SIZEOF(T), \
268 .type.alignment = ECS_ALIGNOF(T) \
269 })
270
278#define ecs_query(world, ...)\
279 ecs_query_init(world, &(ecs_query_desc_t) __VA_ARGS__ )
280
293#define ecs_observer(world, ...)\
294 ecs_observer_init(world, &(ecs_observer_desc_t) __VA_ARGS__ )
295
315#define ecs_new_w(world, T) ecs_new_w_id(world, ecs_id(T))
316
317#define ecs_new_w_pair(world, first, second)\
318 ecs_new_w_id(world, ecs_pair(first, second))
319
320#define ecs_bulk_new(world, component, count)\
321 ecs_bulk_new_w_id(world, ecs_id(component), count)
322
330#define ecs_add(world, entity, T)\
331 ecs_add_id(world, entity, ecs_id(T))
332
333#define ecs_add_pair(world, subject, first, second)\
334 ecs_add_id(world, subject, ecs_pair(first, second))
335
336
337#define ecs_remove(world, entity, T)\
338 ecs_remove_id(world, entity, ecs_id(T))
339
340#define ecs_remove_pair(world, subject, first, second)\
341 ecs_remove_id(world, subject, ecs_pair(first, second))
342
343
344#define ecs_auto_override(world, entity, T)\
345 ecs_auto_override_id(world, entity, ecs_id(T))
346
347#define ecs_auto_override_pair(world, subject, first, second)\
348 ecs_auto_override_id(world, subject, ecs_pair(first, second))
349
357/* insert */
358#define ecs_insert(world, ...)\
359 ecs_entity(world, { .set = ecs_values(__VA_ARGS__)})
360
361/* set */
362
363#define ecs_set_ptr(world, entity, component, ptr)\
364 ecs_set_id(world, entity, ecs_id(component), sizeof(component), ptr)
365
366#define ecs_set(world, entity, component, ...)\
367 ecs_set_id(world, entity, ecs_id(component), sizeof(component), &(component)__VA_ARGS__)
368
369#define ecs_set_pair(world, subject, First, second, ...)\
370 ecs_set_id(world, subject,\
371 ecs_pair(ecs_id(First), second),\
372 sizeof(First), &(First)__VA_ARGS__)
373
374#define ecs_set_pair_second(world, subject, first, Second, ...)\
375 ecs_set_id(world, subject,\
376 ecs_pair(first, ecs_id(Second)),\
377 sizeof(Second), &(Second)__VA_ARGS__)
378
379#define ecs_set_override(world, entity, T, ...)\
380 ecs_add_id(world, entity, ECS_AUTO_OVERRIDE | ecs_id(T));\
381 ecs_set(world, entity, T, __VA_ARGS__)
382
383/* emplace */
384
385#define ecs_emplace(world, entity, T, is_new)\
386 (ECS_CAST(T*, ecs_emplace_id(world, entity, ecs_id(T), is_new)))
387
388#define ecs_emplace_pair(world, entity, First, second, is_new)\
389 (ECS_CAST(First*, ecs_emplace_id(world, entity, ecs_pair_t(First, second), is_new)))
390
391/* get */
392
393#define ecs_get(world, entity, T)\
394 (ECS_CAST(const T*, ecs_get_id(world, entity, ecs_id(T))))
395
396#define ecs_get_pair(world, subject, First, second)\
397 (ECS_CAST(const First*, ecs_get_id(world, subject,\
398 ecs_pair(ecs_id(First), second))))
399
400#define ecs_get_pair_second(world, subject, first, Second)\
401 (ECS_CAST(const Second*, ecs_get_id(world, subject,\
402 ecs_pair(first, ecs_id(Second)))))
403
404/* get_mut */
405
406#define ecs_get_mut(world, entity, T)\
407 (ECS_CAST(T*, ecs_get_mut_id(world, entity, ecs_id(T))))
408
409#define ecs_get_mut_pair(world, subject, First, second)\
410 (ECS_CAST(First*, ecs_get_mut_id(world, subject,\
411 ecs_pair(ecs_id(First), second))))
412
413#define ecs_get_mut_pair_second(world, subject, first, Second)\
414 (ECS_CAST(Second*, ecs_get_mut_id(world, subject,\
415 ecs_pair(first, ecs_id(Second)))))
416
417#define ecs_get_mut(world, entity, T)\
418 (ECS_CAST(T*, ecs_get_mut_id(world, entity, ecs_id(T))))
419
420/* ensure */
421
422#define ecs_ensure(world, entity, T)\
423 (ECS_CAST(T*, ecs_ensure_id(world, entity, ecs_id(T))))
424
425#define ecs_ensure_pair(world, subject, First, second)\
426 (ECS_CAST(First*, ecs_ensure_id(world, subject,\
427 ecs_pair(ecs_id(First), second))))
428
429#define ecs_ensure_pair_second(world, subject, first, Second)\
430 (ECS_CAST(Second*, ecs_ensure_id(world, subject,\
431 ecs_pair(first, ecs_id(Second)))))
432
433#define ecs_ensure(world, entity, T)\
434 (ECS_CAST(T*, ecs_ensure_id(world, entity, ecs_id(T))))
435
436#define ecs_ensure_pair(world, subject, First, second)\
437 (ECS_CAST(First*, ecs_ensure_id(world, subject,\
438 ecs_pair(ecs_id(First), second))))
439
440#define ecs_ensure_pair_second(world, subject, first, Second)\
441 (ECS_CAST(Second*, ecs_ensure_id(world, subject,\
442 ecs_pair(first, ecs_id(Second)))))
443
444/* modified */
445
446#define ecs_modified(world, entity, component)\
447 ecs_modified_id(world, entity, ecs_id(component))
448
449#define ecs_modified_pair(world, subject, first, second)\
450 ecs_modified_id(world, subject, ecs_pair(first, second))
451
452/* record */
453
454#define ecs_record_get(world, record, T)\
455 (ECS_CAST(const T*, ecs_record_get_id(world, record, ecs_id(T))))
456
457#define ecs_record_has(world, record, T)\
458 (ecs_record_has_id(world, record, ecs_id(T)))
459
460#define ecs_record_get_pair(world, record, First, second)\
461 (ECS_CAST(const First*, ecs_record_get_id(world, record, \
462 ecs_pair(ecs_id(First), second))))
463
464#define ecs_record_get_pair_second(world, record, first, Second)\
465 (ECS_CAST(const Second*, ecs_record_get_id(world, record,\
466 ecs_pair(first, ecs_id(Second)))))
467
468#define ecs_record_ensure(world, record, T)\
469 (ECS_CAST(T*, ecs_record_ensure_id(world, record, ecs_id(T))))
470
471#define ecs_record_ensure_pair(world, record, First, second)\
472 (ECS_CAST(First*, ecs_record_ensure_id(world, record, \
473 ecs_pair(ecs_id(First), second))))
474
475#define ecs_record_ensure_pair_second(world, record, first, Second)\
476 (ECS_CAST(Second*, ecs_record_ensure_id(world, record,\
477 ecs_pair(first, ecs_id(Second)))))
478
479#define ecs_ref_init(world, entity, T)\
480 ecs_ref_init_id(world, entity, ecs_id(T))
481
482#define ecs_ref_get(world, ref, T)\
483 (ECS_CAST(T*, ecs_ref_get_id(world, ref, ecs_id(T))))
484
492#define ecs_singleton_add(world, comp)\
493 ecs_add(world, ecs_id(comp), comp)
494
495#define ecs_singleton_remove(world, comp)\
496 ecs_remove(world, ecs_id(comp), comp)
497
498#define ecs_singleton_get(world, comp)\
499 ecs_get(world, ecs_id(comp), comp)
500
501#define ecs_singleton_set_ptr(world, comp, ptr)\
502 ecs_set_ptr(world, ecs_id(comp), comp, ptr)
503
504#define ecs_singleton_set(world, comp, ...)\
505 ecs_set(world, ecs_id(comp), comp, __VA_ARGS__)
506
507#define ecs_singleton_ensure(world, comp)\
508 ecs_ensure(world, ecs_id(comp), comp)
509
510#define ecs_singleton_modified(world, comp)\
511 ecs_modified(world, ecs_id(comp), comp)
512
520#define ecs_has(world, entity, T)\
521 ecs_has_id(world, entity, ecs_id(T))
522
523#define ecs_has_pair(world, entity, first, second)\
524 ecs_has_id(world, entity, ecs_pair(first, second))
525
526#define ecs_owns_pair(world, entity, first, second)\
527 ecs_owns_id(world, entity, ecs_pair(first, second))
528
529#define ecs_owns(world, entity, T)\
530 ecs_owns_id(world, entity, ecs_id(T))
531
532#define ecs_shares_id(world, entity, id)\
533 (ecs_search_relation(world, ecs_get_table(world, entity), 0, ecs_id(id), \
534 EcsIsA, 1, 0, 0, 0, 0) != -1)
535
536#define ecs_shares_pair(world, entity, first, second)\
537 (ecs_shares_id(world, entity, ecs_pair(first, second)))
538
539#define ecs_shares(world, entity, T)\
540 (ecs_shares_id(world, entity, ecs_id(T)))
541
542#define ecs_get_target_for(world, entity, rel, T)\
543 ecs_get_target_for_id(world, entity, rel, ecs_id(T))
544
552#define ecs_enable_component(world, entity, T, enable)\
553 ecs_enable_id(world, entity, ecs_id(T), enable)
554
555#define ecs_is_enabled(world, entity, T)\
556 ecs_is_enabled_id(world, entity, ecs_id(T))
557
558#define ecs_enable_pair(world, entity, First, second, enable)\
559 ecs_enable_id(world, entity, ecs_pair(ecs_id(First), second), enable)
560
561#define ecs_is_enabled_pair(world, entity, First, second)\
562 ecs_is_enabled_id(world, entity, ecs_pair(ecs_id(First), second))
563
571#define ecs_lookup_from(world, parent, path)\
572 ecs_lookup_path_w_sep(world, parent, path, ".", NULL, true)
573
574#define ecs_get_path_from(world, parent, child)\
575 ecs_get_path_w_sep(world, parent, child, ".", NULL)
576
577#define ecs_get_path(world, child)\
578 ecs_get_path_w_sep(world, 0, child, ".", NULL)
579
580#define ecs_get_path_buf(world, child, buf)\
581 ecs_get_path_w_sep_buf(world, 0, child, ".", NULL, buf, false)
582
583#define ecs_new_from_path(world, parent, path)\
584 ecs_new_from_path_w_sep(world, parent, path, ".", NULL)
585
586#define ecs_add_path(world, entity, parent, path)\
587 ecs_add_path_w_sep(world, entity, parent, path, ".", NULL)
588
589#define ecs_add_fullpath(world, entity, path)\
590 ecs_add_path_w_sep(world, entity, 0, path, ".", NULL)
591
601#define ecs_set_hooks(world, T, ...)\
602 ecs_set_hooks_id(world, ecs_id(T), &(ecs_type_hooks_t)__VA_ARGS__)
603
604#define ecs_get_hooks(world, T)\
605 ecs_get_hooks_id(world, ecs_id(T));
606
614#define ECS_CTOR(type, var, ...)\
615 ECS_XTOR_IMPL(type, ctor, var, __VA_ARGS__)
616
624#define ECS_DTOR(type, var, ...)\
625 ECS_XTOR_IMPL(type, dtor, var, __VA_ARGS__)
626
634#define ECS_COPY(type, dst_var, src_var, ...)\
635 ECS_COPY_IMPL(type, dst_var, src_var, __VA_ARGS__)
636
644#define ECS_MOVE(type, dst_var, src_var, ...)\
645 ECS_MOVE_IMPL(type, dst_var, src_var, __VA_ARGS__)
646
654#define ECS_ON_ADD(type, ptr, ...)\
655 ECS_HOOK_IMPL(type, ecs_on_add(type), ptr, __VA_ARGS__)
656#define ECS_ON_REMOVE(type, ptr, ...)\
657 ECS_HOOK_IMPL(type, ecs_on_remove(type), ptr, __VA_ARGS__)
658#define ECS_ON_SET(type, ptr, ...)\
659 ECS_HOOK_IMPL(type, ecs_on_set(type), ptr, __VA_ARGS__)
660
661/* Map from typename to function name of component lifecycle action */
662#define ecs_ctor(type) type##_ctor
663#define ecs_dtor(type) type##_dtor
664#define ecs_copy(type) type##_copy
665#define ecs_move(type) type##_move
666#define ecs_on_set(type) type##_on_set
667#define ecs_on_add(type) type##_on_add
668#define ecs_on_remove(type) type##_on_remove
669
677#define ecs_count(world, type)\
678 ecs_count_id(world, ecs_id(type))
679
687#define ecs_field(it, T, index)\
688 (ECS_CAST(T*, ecs_field_w_size(it, sizeof(T), index)))
689
690#define ecs_field_self(it, T, index)\
691 (ECS_CAST(T*, ecs_field_self_w_size(it, sizeof(T), index)))
692
693#define ecs_field_at(it, T, index, row)\
694 (ECS_CAST(T*, ecs_field_at_w_size(it, sizeof(T), index, row)))
695
703#define ecs_table_get(world, table, T, offset)\
704 (ECS_CAST(T*, ecs_table_get_id(world, table, ecs_id(T), offset)))
705
706#define ecs_table_get_pair(world, table, First, second, offset)\
707 (ECS_CAST(First*, ecs_table_get_id(world, table, ecs_pair(ecs_id(First), second), offset)))
708
709#define ecs_table_get_pair_second(world, table, first, Second, offset)\
710 (ECS_CAST(Second*, ecs_table_get_id(world, table, ecs_pair(first, ecs_id(Second)), offset)))
711
720#define ecs_ids(...) (ecs_id_t[]){ __VA_ARGS__, 0 }
721
723#define ecs_values(...) (ecs_value_t[]){ __VA_ARGS__, {0, 0}}
724
726#define ecs_value_ptr(T, ptr) ((ecs_value_t){ecs_id(T), ptr})
727
729#define ecs_value_pair(R, t, ...) ((ecs_value_t){ecs_pair_t(R, t), &(R)__VA_ARGS__})
730
732#define ecs_value_pair_2nd(r, T, ...) ((ecs_value_t){ecs_pair(r, ecs_id(T)), &(T)__VA_ARGS__})
733
735#define ecs_value_new_t(world, T) ecs_value_new(world, ecs_id(T))
736
738#define ecs_value(T, ...) ((ecs_value_t){ecs_id(T), &(T)__VA_ARGS__})
739
750#define ecs_sort_table(id) ecs_id(id##_sort_table)
751
752#define ecs_compare(id) ecs_id(id##_compare_fn)
753
754/* Declare efficient table sorting operation that uses provided compare function.
755 * For best results use LTO or make the function body visible in the same compilation unit.
756 * Variadic arguments are prepended before generated functions, use it to declare static
757 * or exported functions.
758 * Parameters of the comparison function:
759 * ecs_entity_t e1, const void* ptr1,
760 * ecs_entity_t e2, const void* ptr2
761 * Parameters of the sort functions:
762 * ecs_world_t *world
763 * ecs_table_t *table
764 * ecs_entity_t *entities
765 * void *ptr
766 * int32_t elem_size
767 * int32_t lo
768 * int32_t hi
769 * ecs_order_by_action_t order_by - Pointer to the original comparison function. You are not supposed to use it.
770 * Example:
771 *
772 * @code
773 * int CompareMyType(ecs_entity_t e1, const void* ptr1, ecs_entity_t e2, const void* ptr2) { const MyType* p1 = ptr1; const MyType* p2 = ptr2; return p1->value - p2->value; }
774 * ECS_SORT_TABLE_WITH_COMPARE(MyType, MyCustomCompare, CompareMyType)
775 * @endcode
776 */
777#define ECS_SORT_TABLE_WITH_COMPARE(id, op_name, compare_fn, ...) \
778 static int32_t ECS_CONCAT(op_name, _partition)( \
779 ecs_world_t *world, \
780 ecs_table_t *table, \
781 ecs_entity_t *entities, \
782 void *ptr, \
783 int32_t elem_size, \
784 int32_t lo, \
785 int32_t hi, \
786 ecs_order_by_action_t order_by) \
787 { \
788 (void)(order_by); \
789 int32_t p = (hi + lo) / 2; \
790 void *pivot = ECS_ELEM(ptr, elem_size, p); \
791 ecs_entity_t pivot_e = entities[p]; \
792 int32_t i = lo - 1, j = hi + 1; \
793 void *el; \
794 repeat: \
795 { \
796 do { \
797 i ++; \
798 el = ECS_ELEM(ptr, elem_size, i); \
799 } while ( compare_fn(entities[i], el, pivot_e, pivot) < 0); \
800 do { \
801 j --; \
802 el = ECS_ELEM(ptr, elem_size, j); \
803 } while ( compare_fn(entities[j], el, pivot_e, pivot) > 0); \
804 if (i >= j) { \
805 return j; \
806 } \
807 ecs_table_swap_rows(world, table, i, j); \
808 if (p == i) { \
809 pivot = ECS_ELEM(ptr, elem_size, j); \
810 pivot_e = entities[j]; \
811 } else if (p == j) { \
812 pivot = ECS_ELEM(ptr, elem_size, i); \
813 pivot_e = entities[i]; \
814 } \
815 goto repeat; \
816 } \
817 } \
818 __VA_ARGS__ void op_name( \
819 ecs_world_t *world, \
820 ecs_table_t *table, \
821 ecs_entity_t *entities, \
822 void *ptr, \
823 int32_t size, \
824 int32_t lo, \
825 int32_t hi, \
826 ecs_order_by_action_t order_by) \
827 { \
828 if ((hi - lo) < 1) { \
829 return; \
830 } \
831 int32_t p = ECS_CONCAT(op_name, _partition)(world, table, entities, ptr, size, lo, hi, order_by); \
832 op_name(world, table, entities, ptr, size, lo, p, order_by); \
833 op_name(world, table, entities, ptr, size, p + 1, hi, order_by); \
834 }
835
836/* Declare efficient table sorting operation that uses default component comparison operator.
837 * For best results use LTO or make the comparison operator visible in the same compilation unit.
838 * Variadic arguments are prepended before generated functions, use it to declare static
839 * or exported functions.
840 * Example:
841 *
842 * @code
843 * ECS_COMPARE(MyType, { const MyType* p1 = ptr1; const MyType* p2 = ptr2; return p1->value - p2->value; });
844 * ECS_SORT_TABLE(MyType)
845 * @endcode
846 */
847#define ECS_SORT_TABLE(id, ...) \
848 ECS_SORT_TABLE_WITH_COMPARE(id, ecs_sort_table(id), ecs_compare(id), __VA_ARGS__)
849
850/* Declare component comparison operations.
851 * Parameters:
852 * ecs_entity_t e1, const void* ptr1,
853 * ecs_entity_t e2, const void* ptr2
854 * Example:
855 *
856 * @code
857 * ECS_COMPARE(MyType, { const MyType* p1 = ptr1; const MyType* p2 = ptr2; return p1->value - p2->value; });
858 * @endcode
859 */
860#define ECS_COMPARE(id, ...) \
861 int ecs_compare(id)(ecs_entity_t e1, const void* ptr1, ecs_entity_t e2, const void* ptr2) { \
862 __VA_ARGS__ \
863 }
864
874#define ecs_isa(e) ecs_pair(EcsIsA, e)
875#define ecs_childof(e) ecs_pair(EcsChildOf, e)
876#define ecs_dependson(e) ecs_pair(EcsDependsOn, e)
877#define ecs_with(e) ecs_pair(EcsWith, e)
878
879#define ecs_each(world, id) ecs_each_id(world, ecs_id(id))
880#define ecs_each_pair(world, r, t) ecs_each_id(world, ecs_pair(r, t))
881#define ecs_each_pair_t(world, R, t) ecs_each_id(world, ecs_pair(ecs_id(R), t))
882
887#endif // FLECS_C_