Flecs v4.0
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
builder.hpp
Go to the documentation of this file.
1
6#pragma once
7
8namespace flecs
9{
10
14template <typename Self>
16
17 using entity_view::entity_view;
18
24 template <typename T>
25 const Self& add() const {
26 flecs_static_assert(is_flecs_constructible<T>::value,
27 "cannot default construct type: add T::T() or use emplace<T>()");
28 ecs_add_id(this->world_, this->id_, _::type<T>::id(this->world_));
29 return to_base();
30 }
31
41 template <typename E, if_t< is_enum<E>::value > = 0>
42 const Self& add(E value) const {
43 flecs::entity_t first = _::type<E>::id(this->world_);
44 const auto& et = enum_type<E>(this->world_);
45 flecs::entity_t second = et.entity(value);
46
47 ecs_assert(second, ECS_INVALID_PARAMETER, "Component was not found in reflection data.");
48 return this->add(first, second);
49 }
50
56 const Self& add(id_t component) const {
57 ecs_add_id(this->world_, this->id_, component);
58 return to_base();
59 }
60
67 const Self& add(entity_t first, entity_t second) const {
68 ecs_add_pair(this->world_, this->id_, first, second);
69 return to_base();
70 }
71
78 template<typename First, typename Second>
79 const Self& add() const {
80 return this->add<First>(_::type<Second>::id(this->world_));
81 }
82
89 template<typename First, typename Second, if_not_t< is_enum<Second>::value > = 0>
90 const Self& add(Second second) const {
91 flecs_static_assert(is_flecs_constructible<First>::value,
92 "cannot default construct type: add T::T() or use emplace<T>()");
93 return this->add(_::type<First>::id(this->world_), second);
94 }
95
103 template<typename First, typename Second, if_t< is_enum<Second>::value > = 0>
104 const Self& add(Second constant) const {
105 flecs_static_assert(is_flecs_constructible<First>::value,
106 "cannot default construct type: add T::T() or use emplace<T>()");
107 const auto& et = enum_type<Second>(this->world_);
108 return this->add<First>(et.entity(constant));
109 }
110
117 template<typename Second>
118 const Self& add_second(flecs::entity_t first) const {
119 return this->add(first, _::type<Second>::id(this->world_));
120 }
121
128 const Self& add_if(bool cond, flecs::id_t component) const {
129 if (cond) {
130 return this->add(component);
131 } else {
132 return this->remove(component);
133 }
134 }
135
142 template <typename T>
143 const Self& add_if(bool cond) const {
144 if (cond) {
145 return this->add<T>();
146 } else {
147 return this->remove<T>();
148 }
149 }
150
158 const Self& add_if(bool cond, flecs::entity_t first, flecs::entity_t second) const {
159 if (cond) {
160 return this->add(first, second);
161 } else {
162 /* If second is 0 or if relationship is exclusive, use wildcard for
163 * second which will remove all instances of the relationship.
164 * Replacing 0 with Wildcard will make it possible to use the second
165 * as the condition. */
166 if (!second || ecs_has_id(this->world_, first, flecs::Exclusive)) {
167 second = flecs::Wildcard;
168 }
169 return this->remove(first, second);
170 }
171 }
172
180 template <typename First>
181 const Self& add_if(bool cond, flecs::entity_t second) const {
182 return this->add_if(cond, _::type<First>::id(this->world_), second);
183 }
184
192 template <typename First, typename Second>
193 const Self& add_if(bool cond) const {
194 return this->add_if<First>(cond, _::type<Second>::id(this->world_));
195 }
196
203 template <typename E, if_t< is_enum<E>::value > = 0>
204 const Self& add_if(bool cond, E constant) const {
205 const auto& et = enum_type<E>(this->world_);
206 return this->add_if<E>(cond, et.entity(constant));
207 }
208
213 const Self& is_a(entity_t second) const {
214 return this->add(flecs::IsA, second);
215 }
216
221 template <typename T>
222 const Self& is_a() const {
223 return this->add(flecs::IsA, _::type<T>::id(this->world_));
224 }
225
230 const Self& child_of(entity_t second) const {
231 return this->add(flecs::ChildOf, second);
232 }
233
238 const Self& depends_on(entity_t second) const {
239 return this->add(flecs::DependsOn, second);
240 }
241
246 template <typename E, if_t<is_enum<E>::value> = 0>
247 const Self& depends_on(E second) const {
248 const auto& et = enum_type<E>(this->world_);
249 flecs::entity_t target = et.entity(second);
250 return depends_on(target);
251 }
252
257 const Self& slot_of(entity_t second) const {
258 return this->add(flecs::SlotOf, second);
259 }
260
263 const Self& slot() const {
264 ecs_check(ecs_get_target(world_, id_, flecs::ChildOf, 0),
265 ECS_INVALID_PARAMETER, "add ChildOf pair before using slot()");
266 return this->slot_of(this->target(flecs::ChildOf));
267 error:
268 return to_base();
269 }
270
275 template <typename T>
276 const Self& child_of() const {
277 return this->child_of(_::type<T>::id(this->world_));
278 }
279
284 template <typename T>
285 const Self& depends_on() const {
286 return this->depends_on(_::type<T>::id(this->world_));
287 }
288
293 template <typename T>
294 const Self& slot_of() const {
295 return this->slot_of(_::type<T>::id(this->world_));
296 }
297
302 template <typename T, if_not_t< is_enum<T>::value > = 0>
303 const Self& remove() const {
304 ecs_remove_id(this->world_, this->id_, _::type<T>::id(this->world_));
305 return to_base();
306 }
307
313 template <typename E, if_t< is_enum<E>::value > = 0>
314 const Self& remove() const {
315 flecs::entity_t first = _::type<E>::id(this->world_);
316 return this->remove(first, flecs::Wildcard);
317 }
318
323 const Self& remove(entity_t entity) const {
324 ecs_remove_id(this->world_, this->id_, entity);
325 return to_base();
326 }
327
334 const Self& remove(entity_t first, entity_t second) const {
335 ecs_remove_pair(this->world_, this->id_, first, second);
336 return to_base();
337 }
338
345 template<typename First, typename Second>
346 const Self& remove() const {
347 return this->remove<First>(_::type<Second>::id(this->world_));
348 }
349
356 template<typename First, typename Second, if_not_t< is_enum<Second>::value > = 0>
357 const Self& remove(Second second) const {
358 return this->remove(_::type<First>::id(this->world_), second);
359 }
360
367 template<typename Second>
368 const Self& remove_second(flecs::entity_t first) const {
369 return this->remove(first, _::type<Second>::id(this->world_));
370 }
371
378 template<typename First, typename Second, if_t< is_enum<Second>::value > = 0>
379 const Self& remove(Second constant) const {
380 const auto& et = enum_type<Second>(this->world_);
381 flecs::entity_t second = et.entity(constant);
382 return this->remove<First>(second);
383 }
384
392 const Self& auto_override(flecs::id_t id) const {
393 return this->add(ECS_AUTO_OVERRIDE | id);
394 }
395
402 const Self& auto_override(flecs::entity_t first, flecs::entity_t second) const {
403 return this->auto_override(ecs_pair(first, second));
404 }
405
411 template <typename T>
412 const Self& auto_override() const {
413 return this->auto_override(_::type<T>::id(this->world_));
414 }
415
422 template <typename First>
423 const Self& auto_override(flecs::entity_t second) const {
424 return this->auto_override(_::type<First>::id(this->world_), second);
425 }
426
433 template <typename First, typename Second>
434 const Self& auto_override() const {
435 return this->auto_override<First>(_::type<Second>::id(this->world_));
436 }
437
444 template <typename T>
445 const Self& set_auto_override(const T& val) const {
446 this->auto_override<T>();
447 return this->set<T>(val);
448 }
449
456 template <typename T>
457 const Self& set_auto_override(T&& val) const {
458 this->auto_override<T>();
459 return this->set<T>(FLECS_FWD(val));
460 }
461
469 template <typename First>
470 const Self& set_auto_override(flecs::entity_t second, const First& val) const {
471 this->auto_override<First>(second);
472 return this->set<First>(second, val);
473 }
474
482 template <typename First>
483 const Self& set_auto_override(flecs::entity_t second, First&& val) const {
484 this->auto_override<First>(second);
485 return this->set<First>(second, FLECS_FWD(val));
486 }
487
495 template <typename First, typename Second, typename P = pair<First, Second>,
496 typename A = actual_type_t<P>, if_not_t< flecs::is_pair<First>::value> = 0>
497 const Self& set_auto_override(const A& val) const {
498 this->auto_override<First, Second>();
499 return this->set<First, Second>(val);
500 }
501
509 template <typename First, typename Second, typename P = pair<First, Second>,
510 typename A = actual_type_t<P>, if_not_t< flecs::is_pair<First>::value> = 0>
511 const Self& set_auto_override(A&& val) const {
512 this->auto_override<First, Second>();
513 return this->set<First, Second>(FLECS_FWD(val));
514 }
515
522 template <typename T, typename ... Args>
523 const Self& emplace_auto_override(Args&&... args) const {
524 this->auto_override<T>();
525
526 flecs::emplace<T>(this->world_, this->id_,
527 _::type<T>::id(this->world_), FLECS_FWD(args)...);
528
529 return to_base();
530 }
531
539 template <typename First, typename Second, typename P = pair<First, Second>,
540 typename A = actual_type_t<P>, if_not_t< flecs::is_pair<First>::value> = 0,
541 typename ... Args>
542 const Self& emplace_auto_override(Args&&... args) const {
543 this->auto_override<First, Second>();
544
545 flecs::emplace<A>(this->world_, this->id_,
546 ecs_pair(_::type<First>::id(this->world_),
547 _::type<Second>::id(this->world_)),
548 FLECS_FWD(args)...);
549
550 return to_base();
551 }
552
557 const Self& enable() const {
558 ecs_enable(this->world_, this->id_, true);
559 return to_base();
560 }
561
566 const Self& disable() const {
567 ecs_enable(this->world_, this->id_, false);
568 return to_base();
569 }
570
580 const Self& enable(flecs::id_t id, bool toggle = true) const {
581 ecs_enable_id(this->world_, this->id_, id, toggle);
582 return to_base();
583 }
584
590 template<typename T>
591 const Self& enable() const {
592 return this->enable(_::type<T>::id(this->world_));
593 }
594
601 const Self& enable(flecs::id_t first, flecs::id_t second) const {
602 return this->enable(ecs_pair(first, second));
603 }
604
611 template<typename First>
612 const Self& enable(flecs::id_t second) const {
613 return this->enable(_::type<First>::id(), second);
614 }
615
622 template<typename First, typename Second>
623 const Self& enable() const {
624 return this->enable<First>(_::type<Second>::id());
625 }
626
636 const Self& disable(flecs::id_t id) const {
637 return this->enable(id, false);
638 }
639
645 template<typename T>
646 const Self& disable() const {
647 return this->disable(_::type<T>::id());
648 }
649
656 const Self& disable(flecs::id_t first, flecs::id_t second) const {
657 return this->disable(ecs_pair(first, second));
658 }
659
666 template<typename First>
667 const Self& disable(flecs::id_t second) const {
668 return this->disable(_::type<First>::id(), second);
669 }
670
677 template<typename First, typename Second>
678 const Self& disable() const {
679 return this->disable<First>(_::type<Second>::id());
680 }
681
682 const Self& set_ptr(entity_t comp, size_t size, const void *ptr) const {
683 ecs_set_id(this->world_, this->id_, comp, size, ptr);
684 return to_base();
685 }
686
687 const Self& set_ptr(entity_t comp, const void *ptr) const {
688 const flecs::Component *cptr = ecs_get(
689 this->world_, comp, EcsComponent);
690
691 /* Can't set if it's not a component */
692 ecs_assert(cptr != NULL, ECS_INVALID_PARAMETER, NULL);
693
694 return set_ptr(comp, cptr->size, ptr);
695 }
696
697 template<typename T, if_t<is_actual<T>::value> = 0 >
698 const Self& set(T&& value) const {
699 flecs::set<T>(this->world_, this->id_, FLECS_FWD(value));
700 return to_base();
701 }
702
703 template<typename T, if_t<is_actual<T>::value > = 0>
704 const Self& set(const T& value) const {
705 flecs::set<T>(this->world_, this->id_, value);
706 return to_base();
707 }
708
709 template<typename T, typename A = actual_type_t<T>, if_not_t<
710 is_actual<T>::value > = 0>
711 const Self& set(A&& value) const {
712 flecs::set<T>(this->world_, this->id_, FLECS_FWD(value));
713 return to_base();
714 }
715
716 template<typename T, typename A = actual_type_t<T>, if_not_t<
717 is_actual<T>::value > = 0>
718 const Self& set(const A& value) const {
719 flecs::set<T>(this->world_, this->id_, value);
720 return to_base();
721 }
722
731 template <typename First, typename Second, typename P = pair<First, Second>,
732 typename A = actual_type_t<P>, if_not_t< flecs::is_pair<First>::value> = 0>
733 const Self& set(A&& value) const {
734 flecs::set<P>(this->world_, this->id_, FLECS_FWD(value));
735 return to_base();
736 }
737
746 template <typename First, typename Second, typename P = pair<First, Second>,
747 typename A = actual_type_t<P>, if_not_t< flecs::is_pair<First>::value> = 0>
748 const Self& set(const A& value) const {
749 flecs::set<P>(this->world_, this->id_, value);
750 return to_base();
751 }
752
761 template <typename First, typename Second, if_not_t< is_enum<Second>::value > = 0>
762 const Self& set(Second second, const First& value) const {
763 auto first = _::type<First>::id(this->world_);
764 flecs::set(this->world_, this->id_, value,
765 ecs_pair(first, second));
766 return to_base();
767 }
768
777 template <typename First, typename Second, if_not_t< is_enum<Second>::value > = 0>
778 const Self& set(Second second, First&& value) const {
779 auto first = _::type<First>::id(this->world_);
780 flecs::set(this->world_, this->id_, FLECS_FWD(value),
781 ecs_pair(first, second));
782 return to_base();
783 }
784
793 template <typename First, typename Second, if_t< is_enum<Second>::value > = 0>
794 const Self& set(Second constant, const First& value) const {
795 const auto& et = enum_type<Second>(this->world_);
796 flecs::entity_t second = et.entity(constant);
797 return set<First>(second, value);
798 }
799
808 template <typename Second>
809 const Self& set_second(entity_t first, const Second& value) const {
810 auto second = _::type<Second>::id(this->world_);
811 flecs::set(this->world_, this->id_, value,
812 ecs_pair(first, second));
813 return to_base();
814 }
815
824 template <typename Second>
825 const Self& set_second(entity_t first, Second&& value) const {
826 auto second = _::type<Second>::id(this->world_);
827 flecs::set(this->world_, this->id_, FLECS_FWD(value),
828 ecs_pair(first, second));
829 return to_base();
830 }
831
832 template <typename First, typename Second>
833 const Self& set_second(const Second& value) const {
834 flecs::set<pair_object<First, Second>>(this->world_, this->id_, value);
835 return to_base();
836 }
837
853 template <typename Func>
854 const Self& insert(const Func& func) const;
855
877 template<typename T, typename ... Args, typename A = actual_type_t<T>>
878 const Self& emplace(Args&&... args) const {
879 flecs::emplace<A>(this->world_, this->id_,
880 _::type<T>::id(this->world_), FLECS_FWD(args)...);
881 return to_base();
882 }
883
884 template <typename First, typename Second, typename ... Args, typename P = pair<First, Second>,
885 typename A = actual_type_t<P>, if_not_t< flecs::is_pair<First>::value> = 0>
886 const Self& emplace(Args&&... args) const {
887 flecs::emplace<A>(this->world_, this->id_,
888 ecs_pair(_::type<First>::id(this->world_),
889 _::type<Second>::id(this->world_)),
890 FLECS_FWD(args)...);
891 return to_base();
892 }
893
894 template <typename First, typename ... Args>
895 const Self& emplace_first(flecs::entity_t second, Args&&... args) const {
896 flecs::emplace<First>(this->world_, this->id_,
897 ecs_pair(_::type<First>::id(this->world_), second),
898 FLECS_FWD(args)...);
899 return to_base();
900 }
901
902 template <typename Second, typename ... Args>
903 const Self& emplace_second(flecs::entity_t first, Args&&... args) const {
904 flecs::emplace<Second>(this->world_, this->id_,
905 ecs_pair(first, _::type<Second>::id(this->world_)),
906 FLECS_FWD(args)...);
907 return to_base();
908 }
909
915 template <typename Func>
916 const Self& with(const Func& func) const {
917 ecs_id_t prev = ecs_set_with(this->world_, this->id_);
918 func();
919 ecs_set_with(this->world_, prev);
920 return to_base();
921 }
922
929 template <typename First, typename Func>
930 const Self& with(const Func& func) const {
931 with(_::type<First>::id(this->world_), func);
932 return to_base();
933 }
934
941 template <typename Func>
942 const Self& with(entity_t first, const Func& func) const {
943 ecs_id_t prev = ecs_set_with(this->world_,
944 ecs_pair(first, this->id_));
945 func();
946 ecs_set_with(this->world_, prev);
947 return to_base();
948 }
949
951 template <typename Func>
952 const Self& scope(const Func& func) const {
953 ecs_entity_t prev = ecs_set_scope(this->world_, this->id_);
954 func();
955 ecs_set_scope(this->world_, prev);
956 return to_base();
957 }
958
961 return scoped_world(world_, id_);
962 }
963
964 /* Set the entity name.
965 */
966 const Self& set_name(const char *name) const {
967 ecs_set_name(this->world_, this->id_, name);
968 return to_base();
969 }
970
971 /* Set entity alias.
972 */
973 const Self& set_alias(const char *name) const {
974 ecs_set_alias(this->world_, this->id_, name);
975 return to_base();
976 }
977
978# ifdef FLECS_DOC
980# endif
981
982# ifdef FLECS_META
984# endif
985
986# ifdef FLECS_JSON
988# endif
989
991
992protected:
993 const Self& to_base() const {
994 return *static_cast<const Self*>(this);
995 }
996};
997
998}
Doc entity builder mixin.
Event entity mixin.
ecs_entity_t ecs_set_with(ecs_world_t *world, ecs_id_t id)
Set current with id.
void ecs_add_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Add a (component) id to an entity.
void ecs_remove_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Remove a (component) id from an entity.
#define ecs_assert(condition, error_code,...)
Assert.
Definition log.h:352
#define ecs_check(condition, error_code,...)
Check.
Definition log.h:399
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:339
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
Definition flecs.h:332
void ecs_enable_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id, bool enable)
Enable or disable component.
void ecs_enable(ecs_world_t *world, ecs_entity_t entity, bool enabled)
Enable or disable entity.
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.
bool ecs_has_id(const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Test if an entity has an 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.
const ecs_id_t ECS_AUTO_OVERRIDE
Automatically override component when it is inherited.
void ecs_set_alias(ecs_world_t *world, ecs_entity_t entity, const char *alias)
Set alias for entity.
ecs_entity_t ecs_set_name(ecs_world_t *world, ecs_entity_t entity, const char *name)
Set the name of an entity.
ecs_entity_t ecs_set_scope(ecs_world_t *world, ecs_entity_t scope)
Set the current scope.
JSON entity mixin.
Meta entity builder mixin.
Component information.
Definition flecs.h:1425
ecs_size_t size
Component size.
Definition flecs.h:1426
Component class.
Entity builder.
Definition builder.hpp:15
const Self & emplace_auto_override(Args &&... args) const
Emplace pair, mark pair for auto-overriding.
Definition builder.hpp:542
const Self & disable() const
Disable an entity.
Definition builder.hpp:566
const Self & add(E value) const
Add pair for enum constant.
Definition builder.hpp:42
const Self & set(Second constant, const First &value) const
Set a pair for an entity.
Definition builder.hpp:794
const Self & auto_override(flecs::entity_t second) const
Mark pair for auto-overriding.
Definition builder.hpp:423
const Self & enable(flecs::id_t second) const
Enable a pair.
Definition builder.hpp:612
const Self & remove(Second constant) const
Remove a pair.
Definition builder.hpp:379
const Self & remove(entity_t first, entity_t second) const
Remove a pair.
Definition builder.hpp:334
const Self & add_if(bool cond, E constant) const
Conditional add.
Definition builder.hpp:204
const Self & remove(Second second) const
Remove a pair.
Definition builder.hpp:357
const Self & emplace(Args &&... args) const
Emplace component.
Definition builder.hpp:878
const Self & set_auto_override(flecs::entity_t second, const First &val) const
Set pair, mark component for auto-overriding.
Definition builder.hpp:470
const Self & disable(flecs::id_t first, flecs::id_t second) const
Disable a pair.
Definition builder.hpp:656
const Self & emplace_auto_override(Args &&... args) const
Emplace component, mark component for auto-overriding.
Definition builder.hpp:523
const Self & add() const
Add a pair.
Definition builder.hpp:79
const Self & is_a() const
Shortcut for add(IsA, entity).
Definition builder.hpp:222
const Self & enable() const
Enable an entity.
Definition builder.hpp:557
const Self & remove_second(flecs::entity_t first) const
Removes a pair.
Definition builder.hpp:368
const Self & slot_of(entity_t second) const
Shortcut for add(SlotOf, entity).
Definition builder.hpp:257
const Self & auto_override() const
Mark component for auto-overriding.
Definition builder.hpp:412
const Self & enable() const
Enable a component.
Definition builder.hpp:591
scoped_world scope() const
Return world scoped to entity.
Definition builder.hpp:960
const Self & child_of() const
Shortcut for add(ChildOf, entity).
Definition builder.hpp:276
const Self & set(A &&value) const
Set a pair for an entity.
Definition builder.hpp:733
const Self & set_auto_override(A &&val) const
Set component, mark component for auto-overriding.
Definition builder.hpp:511
const Self & enable() const
Enable a pair.
Definition builder.hpp:623
const Self & enable(flecs::id_t first, flecs::id_t second) const
Enable a pair.
Definition builder.hpp:601
const Self & disable(flecs::id_t id) const
Disable an id.
Definition builder.hpp:636
const Self & slot() const
Shortcut for add(SlotOf, target(ChildOf)).
Definition builder.hpp:263
const Self & set(Second second, const First &value) const
Set a pair for an entity.
Definition builder.hpp:762
const Self & add_if(bool cond) const
Conditional add.
Definition builder.hpp:193
const Self & is_a(entity_t second) const
Shortcut for add(IsA, entity).
Definition builder.hpp:213
const Self & add(Second constant) const
Add a pair.
Definition builder.hpp:104
const Self & depends_on(E second) const
Shortcut for add(DependsOn, entity).
Definition builder.hpp:247
const Self & add_if(bool cond, flecs::entity_t first, flecs::entity_t second) const
Conditional add.
Definition builder.hpp:158
const Self & set_second(entity_t first, Second &&value) const
Set a pair for an entity.
Definition builder.hpp:825
const Self & set_auto_override(T &&val) const
Set component, mark component for auto-overriding.
Definition builder.hpp:457
const Self & add_if(bool cond) const
Conditional add.
Definition builder.hpp:143
const Self & remove() const
Remove a component from an entity.
Definition builder.hpp:303
const Self & disable() const
Disable a component.
Definition builder.hpp:646
const Self & add(id_t component) const
Add an entity to an entity.
Definition builder.hpp:56
const Self & add(entity_t first, entity_t second) const
Add a pair.
Definition builder.hpp:67
const Self & with(entity_t first, const Func &func) const
Entities created in function will have (first, this).
Definition builder.hpp:942
const Self & set(Second second, First &&value) const
Set a pair for an entity.
Definition builder.hpp:778
const Self & insert(const Func &func) const
Set 1..N components.
Definition impl.hpp:17
const Self & scope(const Func &func) const
The function will be ran with the scope set to the current entity.
Definition builder.hpp:952
const Self & add_if(bool cond, flecs::entity_t second) const
Conditional add.
Definition builder.hpp:181
const Self & add_second(flecs::entity_t first) const
Add a pair.
Definition builder.hpp:118
const Self & add_if(bool cond, flecs::id_t component) const
Conditional add.
Definition builder.hpp:128
const Self & with(const Func &func) const
Entities created in function will have (First, this).
Definition builder.hpp:930
const Self & disable(flecs::id_t second) const
Disable a pair.
Definition builder.hpp:667
const Self & set_auto_override(const T &val) const
Set component, mark component for auto-overriding.
Definition builder.hpp:445
const Self & remove(entity_t entity) const
Remove an entity from an entity.
Definition builder.hpp:323
const Self & set_auto_override(flecs::entity_t second, First &&val) const
Set pair, mark component for auto-overriding.
Definition builder.hpp:483
const Self & enable(flecs::id_t id, bool toggle=true) const
Enable an id.
Definition builder.hpp:580
const Self & child_of(entity_t second) const
Shortcut for add(ChildOf, entity).
Definition builder.hpp:230
const Self & depends_on(entity_t second) const
Shortcut for add(DependsOn, entity).
Definition builder.hpp:238
const Self & depends_on() const
Shortcut for add(DependsOn, entity).
Definition builder.hpp:285
const Self & auto_override(flecs::id_t id) const
Mark id for auto-overriding.
Definition builder.hpp:392
const Self & set(const A &value) const
Set a pair for an entity.
Definition builder.hpp:748
const Self & disable() const
Disable a pair.
Definition builder.hpp:678
const Self & auto_override(flecs::entity_t first, flecs::entity_t second) const
Mark pair for auto-overriding.
Definition builder.hpp:402
const Self & auto_override() const
Mark pair for auto-overriding.
Definition builder.hpp:434
const Self & slot_of() const
Shortcut for add(SlotOf, entity).
Definition builder.hpp:294
const Self & add() const
Add a component to an entity.
Definition builder.hpp:25
const Self & add(Second second) const
Add a pair.
Definition builder.hpp:90
const Self & set_auto_override(const A &val) const
Set component, mark component for auto-overriding.
Definition builder.hpp:497
const Self & with(const Func &func) const
Entities created in function will have the current entity.
Definition builder.hpp:916
const Self & set_second(entity_t first, const Second &value) const
Set a pair for an entity.
Definition builder.hpp:809
flecs::string_view name() const
Return the entity name.
flecs::entity target(int32_t index=0) const
Get target for a given pair.
Definition impl.hpp:41
Entity.
Definition entity.hpp:30
flecs::entity second() const
Get second element from a pair.
Definition impl.hpp:31
flecs::entity first() const
Get first element from a pair.
Definition impl.hpp:20
Type that represents a pair.
Definition pair.hpp:36
Scoped world.
Definition world.hpp:1217