Flecs: include/flecs/addons/cpp/mixins/alerts/impl.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
impl.hpp
Go to the documentation of this file.
1
5
6#pragma once
7
8#include "builder.hpp"
9
10namespace flecs {
11
12template <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, ecs_alert_desc_t *desc) {
23 world_ = world;
24 id_ = ecs_alert_init(world, desc);
25 }
26};
27
28inline 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
43template <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 alert.
Definition impl.hpp:44
flecs::world::import
flecs::entity import()
Import a module.
Definition impl.hpp:115
flecs::world::component
flecs::component< T > component(Args &&... args) const
Find or register component.
Definition impl.hpp:11
flecs::world::entity
flecs::entity entity(Args &&... args) const
Create an entity.
Definition impl.hpp:190
builder.hpp
Alert builder.
ecs_alert_desc_t
Alert descriptor, used with ecs_alert_init().
Definition alerts.h:77
flecs::alert_builder
Alert builder.
Definition builder.hpp:24
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::metrics
Definition decl.hpp:21
flecs::world
The world.
Definition world.hpp:158