Flecs: include/flecs/addons/cpp/mixins/system/builder.hpp Source File
Description: A fast entity component system (ECS) for C & C++

| 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
5
6#pragma once
7
8#include "../../utils/node_builder.hpp"
9#include "builder_i.hpp"
10
11namespace flecs {
12namespace _ {
13 template <typename ... Components>
14 using system_builder_base = node_builder<
15 system, ecs_system_desc_t, system_builder<Components...>,
16 system_builder_i, Components ...>;
17}
18
23template <typename ... Components>
24struct system_builder final : _::system_builder_base<Components...> {
25 system_builder(flecs::world_t* world, const char *name = nullptr)
26 : _::system_builder_base<Components...>(world, name)
27 {
28 _::sig<Components...>(world).populate(this);
29
30#ifdef FLECS_PIPELINE
31 ecs_add_id(world, this->desc_.entity, ecs_dependson(flecs::OnUpdate));
32 ecs_add_id(world, this->desc_.entity, flecs::OnUpdate);
33#endif
34 }
35};
36
37}
ecs_add_id
void ecs_add_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id)
Add a (component) id to an entity.
ecs_system_desc_t
struct ecs_system_desc_t ecs_system_desc_t
Use with ecs_system_init() to create or update a system.
flecs::_
Int to enum.
Definition component.hpp:21
node_builder.hpp
Base builder class for node objects, like systems, observers.
flecs::_::node_builder
Definition node_builder.hpp:16
flecs::system_builder
System builder.
Definition decl.hpp:23
flecs::world::system
flecs::system system(flecs::entity e) const
Upcast entity to a system.
builder_i.hpp
System builder interface.