12#define FLECS_IBUILDER template<typename IBase, typename ... Components> class
14template<
typename T,
typename TDesc,
typename Base, FLECS_IBUILDER IBuilder,
typename ... Components>
17 using IBase = IBuilder<Base, Components ...>;
27 entity_desc.
name = name;
28 entity_desc.
sep =
"::";
35 template <
typename Func>
38 typename std::decay<Func>::type, Components...>;
39 return build<Invoker>(FLECS_FWD(func));
44 template <
typename Func>
47 typename std::decay<Func>::type, Components...>;
49 return build<Invoker>(FLECS_FWD(func));
53 flecs::world_t* world_v()
override {
return m_world; }
55 flecs::world_t *m_world;
59 template <
typename Invoker,
typename Func>
60 T build(Func&& func) {
61 auto ctx = FLECS_NEW(Invoker)(FLECS_FWD(func));
62 m_desc.callback = Invoker::run;
63 m_desc.binding_ctx = ctx;
64 m_desc.binding_ctx_free =
reinterpret_cast<
67 return T(m_world, &m_desc, m_instanced);
ecs_entity_t ecs_entity_init(ecs_world_t *world, const ecs_entity_desc_t *desc)
Find or create an entity.
void(* ecs_ctx_free_t)(void *ctx)
Function to cleanup context data.
Used with ecs_entity_init.
const char * sep
Optional custom separator for hierarchical names.
const char * name
Name of the entity.
Class for iterating over query results.