Flecs
v4.1
A fast entity component system (ECS) for C & C++
Toggle main menu visibility
Loading...
Searching...
No Matches
builder.hpp
Go to the documentation of this file.
1
5
6
#pragma once
7
8
#include "
../../utils/function_traits.hpp
"
9
#include "
../../utils/node_builder.hpp
"
10
#include "
builder_i.hpp
"
11
12
namespace
flecs {
13
namespace
_
{
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
24
template
<
typename
... Components>
25
struct
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
40
private
:
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
}
function_traits.hpp
Compile-time utilities to inspect properties of functions.
ecs_add_id
void ecs_add_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t component)
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() and ecs_system_update().
flecs::world::entity
flecs::entity entity(Args &&... args) const
Create an entity.
Definition
impl.hpp:190
flecs::world_t
ecs_world_t world_t
World type.
Definition
c_types.hpp:18
ecs_dependson
#define ecs_dependson(e)
Construct a DependsOn pair.
Definition
flecs_c.h:926
flecs::_
Int to enum.
Definition
component.hpp:18
node_builder.hpp
Base builder class for node objects, like systems and observers.
flecs::_::node_builder
Definition
node_builder.hpp:16
flecs::_::sig
Definition
signature.hpp:38
flecs::system
System.
Definition
impl.hpp:78
flecs::term_ref_builder_i::name
Base & name(const char *name)
Specify the value of the identifier by name.
Definition
builder_i.hpp:58
flecs::world
The world.
Definition
world.hpp:246
flecs::world::system
flecs::system system(flecs::entity e) const
Upcast an entity to a system.
builder_i.hpp
System builder interface.