13template <
typename T,
typename TDesc,
typename Base,
14 template <
typename,
typename...>
class IBuilder,
typename... Components>
15struct builder : IBuilder<Base, Components...> {
16 using IBase = IBuilder<Base, Components...>;
18 explicit builder(
world_t *
world,
const char *name =
nullptr)
19 : IBase(&desc_), desc_{}, world_(
world)
24 builder(
const builder& other)
25 : IBase(&desc_, other.term_index_), desc_(other.desc_), world_(other.world_) { }
27 builder(builder&& other) noexcept : builder(other) { }
33 operator const TDesc*()
const {
38 return T(world_, &desc_);
41 template <
typename Func,
typename... Each>
42 T run(Func&& func, Each&&... each_func) {
44 set_callback<Delegate, Delegate::run, true>(desc_, FLECS_FWD(func));
45 if constexpr (
sizeof...(Each)) {
46 return each(FLECS_FWD(each_func)...);
52 template <
typename Func>
54 set_each_callback<false>(desc_, FLECS_FWD(func), arg_list<Components...>{});
58 template <
typename Func>
59 T run_each(Func&& func) {
60 set_each_callback<true>(desc_, FLECS_FWD(func), arg_list<Components...>{});
69 void set_name(
const char *name) {
ecs_world_t world_t
World type.
ecs_entity_t ecs_entity_init(ecs_world_t *world, const ecs_entity_desc_t *desc)
Find or create an entity.
Used with ecs_entity_init().
const char * sep
Optional custom separator for hierarchical names.
const char * root_sep
Optional, used for identifiers relative to the root.
const char * name
Name of the entity.