Flecs
v4.1
A fast entity component system (ECS) for C & C++
Toggle main menu visibility
Loading...
Searching...
No Matches
impl.hpp
Go to the documentation of this file.
1
5
6
#pragma once
7
8
#include "
builder.hpp
"
9
10
namespace
flecs {
11
12
template
<
typename
... Components>
13
struct
alert final :
entity
14
{
15
using
entity::entity
;
16
17
explicit
alert() {
18
id_
= 0;
19
world_
=
nullptr
;
20
}
21
22
explicit
alert(
flecs::world_t
*
world
,
const
ecs_alert_desc_t
*desc) {
23
world_
=
world
;
24
id_
=
ecs_alert_init
(
world
, desc);
25
}
26
};
27
28
inline
alerts::alerts(
flecs::world
&
world
) {
29
world
.
import
<
metrics
>();
30
31
// Import C module.
32
FlecsAlertsImport
(
world
);
33
34
world
.
component
<AlertsActive>();
35
world
.
component
<Instance>();
36
37
world
.
entity
<
alerts::Alert
>(
"::flecs::alerts::Alert"
);
38
world
.
entity
<
alerts::Info
>(
"::flecs::alerts::Info"
);
39
world
.
entity
<
alerts::Warning
>(
"::flecs::alerts::Warning"
);
40
world
.
entity
<
alerts::Error
>(
"::flecs::alerts::Error"
);
41
}
42
43
template
<
typename
... Comps,
typename
... Args>
44
inline
flecs::alert_builder
<Comps...>
world::alert
(Args &&... args)
const
{
45
return
flecs::alert_builder
<Comps...>(
world_
, FLECS_FWD(args)...);
46
}
47
48
}
FlecsAlertsImport
FLECS_API void FlecsAlertsImport(ecs_world_t *world)
Alert module import function.
ecs_alert_init
FLECS_API ecs_entity_t ecs_alert_init(ecs_world_t *world, const ecs_alert_desc_t *desc)
Create a new alert.
flecs::world::alert
flecs::alert_builder< Comps... > alert(Args &&... args) const
Create an alert.
Definition
impl.hpp:44
flecs::world::import
flecs::entity import()
Import a module.
Definition
impl.hpp:107
flecs::world::component
flecs::component< T > component(Args &&... args) const
Find or register a component.
Definition
impl.hpp:11
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
builder.hpp
Alert builder.
ecs_alert_desc_t
Alert descriptor, used with ecs_alert_init().
Definition
alerts.h:78
flecs::alert_builder
Alert builder.
Definition
builder.hpp:24
flecs::alert::entity
entity()
Default constructor.
Definition
entity.hpp:32
flecs::alerts::Alert
Definition
decl.hpp:23
flecs::alerts::Error
Definition
decl.hpp:26
flecs::alerts::Info
Definition
decl.hpp:24
flecs::alerts::Warning
Definition
decl.hpp:25
flecs::entity::entity
entity()
Default constructor.
Definition
entity.hpp:32
flecs::id::id_
flecs::id_t id_
The raw ID value.
Definition
decl.hpp:149
flecs::id::world_
flecs::world_t * world_
World is optional, but guarantees that entity identifiers extracted from the ID are valid.
Definition
decl.hpp:147
flecs::metrics
Metrics module.
Definition
decl.hpp:22
flecs::world
The world.
Definition
world.hpp:246
flecs::world::world_
world_t * world_
Pointer to the underlying C world.
Definition
world.hpp:1540