Flecs: include/flecs/addons/cpp/mixins/meta/component.inl 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
component.inl
1
3template <typename Func>
4 component& opaque(const Func& type_support) {
5 flecs::world world(world_);
6 auto ts = type_support(world);
7 ts.desc.entity = _::type<T>::id(world_);
8 ecs_opaque_init(world_, &ts.desc);
9 return *this;
10}
11
12 flecs::opaque<T> opaque(flecs::entity_t as_type) {
13 return flecs::opaque<T>(world_).as_type(as_type);
14}
15
16 flecs::opaque<T> opaque(flecs::entity as_type) {
17 return this->opaque(as_type.id());
18}
19
20 flecs::opaque<T> opaque(flecs::untyped_component as_type) {
21 return this->opaque(as_type.id());
22}
23
25template <typename ElemType>
26 flecs::opaque<T, ElemType> opaque(flecs::id_t as_type) {
27 return flecs::opaque<T, ElemType>(world_).as_type(as_type);
28}
29
31component<T>& constant(const char *name, T value) {
32 int32_t v = static_cast<int32_t>(value);
33 untyped_component::constant(name, v);
34 return *this;
35}
ecs_opaque_init
FLECS_API ecs_entity_t ecs_opaque_init(ecs_world_t *world, const ecs_opaque_desc_t *desc)
Create a new opaque type.
flecs::entity_view::id
entity_t id() const
Get entity id.
Definition entity_view.hpp:50
flecs::entity
Entity.
Definition entity.hpp:30
flecs::opaque
Type safe interface for opaque types.
Definition opaque.hpp:32
flecs::opaque::as_type
opaque & as_type(flecs::id_t func)
Type that describes the type kind/structure of the opaque type.
Definition opaque.hpp:40
flecs::untyped_component
Untyped component class.
Definition component.hpp:350
flecs::world
The world.
Definition world.hpp:137
flecs::world::component
flecs::component< T > component(Args &&... args) const
Find or register component.