Flecs v3.2
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 m_id = 0;
19 m_world = nullptr;
20 }
21
22 explicit alert(flecs::world_t *world, ecs_alert_desc_t *desc)
23 {
24 m_world = world;
25 m_id = ecs_alert_init(world, desc);
26
27 if (desc->filter.terms_buffer) {
28 ecs_os_free(desc->filter.terms_buffer);
29 }
30 }
31};
32
33inline alerts::alerts(flecs::world& world) {
35
36 /* Import C module */
37 FlecsAlertsImport(world);
38
39 world.component<AlertsActive>();
40 world.component<Instance>();
41
42 world.entity<alerts::Alert>("::flecs::alerts::Alert");
43 world.entity<alerts::Info>("::flecs::alerts::Info");
44 world.entity<alerts::Warning>("::flecs::alerts::Warning");
45 world.entity<alerts::Error>("::flecs::alerts::Error");
46}
47
48template <typename... Comps, typename... Args>
49inline flecs::alert_builder<Comps...> world::alert(Args &&... args) const {
50 return flecs::alert_builder<Comps...>(m_world, FLECS_FWD(args)...);
51}
52
53}
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.
ecs_filter_desc_t filter
Alert query.
Definition alerts.h:84
ecs_term_t * terms_buffer
For filters with lots of terms an outside array can be provided.
Definition flecs.h:1006
Alert builder.
Definition builder.hpp:24
Entity.
Definition entity.hpp:30
The world.
Definition world.hpp:132