Flecs v4.1
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
10#include "builder_i.hpp"
11
12namespace flecs {
13namespace _ {
14 template <typename ... Components>
15 using system_builder_base = node_builder<
16 system, ecs_system_desc_t, system_builder<Components...>,
17 system_builder_i, Components ...>;
18}
19
24template <typename ... Components>
25struct system_builder final : _::system_builder_base<Components...> {
26 system_builder(flecs::world_t* world, const char *name = nullptr)
27 : _::system_builder_base<Components...>(world, name)
28 {
29 _::sig<Components...>(world).populate(this);
30
31#ifdef FLECS_PIPELINE
32 ecs_add_id(world, this->desc_.entity, ecs_dependson(flecs::OnUpdate));
33 ecs_add_id(world, this->desc_.entity, flecs::OnUpdate);
34#endif
35 }
36
37 template <typename Func>
38 system each(Func&& func);
39
40private:
41 template <typename ... CallbackComponents, typename Func>
42 system each_callback(_::arg_list<CallbackComponents...>, Func&& func);
43
44 template <typename ... CallbackComponents>
45 void prepend_each_callback_signature();
46};
47
48}
Compile-time utilities to inspect properties of functions.
void ecs_add_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
Add a (component) ID to an entity.
struct ecs_system_desc_t ecs_system_desc_t
Use with ecs_system_init() to create or update a system.
ecs_world_t world_t
World type.
Definition c_types.hpp:18
#define ecs_dependson(e)
Construct a DependsOn pair.
Definition flecs_c.h:926
Base builder class for node objects, like systems and observers.
System builder.
Definition builder.hpp:25
System.
Definition impl.hpp:78
The world.
Definition world.hpp:246
System builder interface.