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
6#pragma once
7
8#include "builder.hpp"
9
10namespace flecs {
11
12template <typename ... Components>
13struct 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) {
30
31 /* Import C module */
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>
44inline flecs::alert_builder<Comps...> world::alert(Args &&... args) const {
45 return flecs::alert_builder<Comps...>(world_, FLECS_FWD(args)...);
46}
47
48}
FLECS_API void FlecsAlertsImport(ecs_world_t *world)
Alert module import function.
FLECS_API ecs_entity_t ecs_alert_init(ecs_world_t *world, const ecs_alert_desc_t *desc)
Create a new alert.
flecs::alert_builder< Comps... > alert(Args &&... args) const
Create alert.
flecs::entity import()
Import a module.
flecs::component< T > component(Args &&... args) const
Find or register component.
flecs::entity entity(Args &&... args) const
Create an entity.
Alert builder.
Alert descriptor, used with ecs_alert_init().
Definition alerts.h:77
Alert builder.
Definition builder.hpp:24
Entity.
Definition entity.hpp:30
The world.
Definition world.hpp:137