Flecs v3.2
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
component.inl
1
3template <typename Func>
4component& opaque(const Func& type_support) {
5 flecs::world world(m_world);
6 auto ts = type_support(world);
7 ts.desc.entity = _::cpp_type<T>::id(m_world);
8 ecs_opaque_init(m_world, &ts.desc);
9 return *this;
10}
11
12flecs::opaque<T> opaque(flecs::entity_t as_type) {
13 return flecs::opaque<T>(m_world).as_type(as_type);
14}
15
16flecs::opaque<T> opaque(flecs::entity as_type) {
17 return this->opaque(as_type.id());
18}
19
21 return this->opaque(as_type.id());
22}
23
25template <typename ElemType>
26flecs::opaque<T, ElemType> opaque(flecs::id_t as_type) {
27 return flecs::opaque<T, ElemType>(m_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}
FLECS_API ecs_entity_t ecs_opaque_init(ecs_world_t *world, const ecs_opaque_desc_t *desc)
Create a new opaque type.
entity_t id() const
Get entity id.
Entity.
Definition entity.hpp:30
Type safe interface for opaque types.
Definition opaque.hpp:32
opaque & as_type(flecs::id_t func)
Type that describes the type kind/structure of the opaque type.
Definition opaque.hpp:40
Untyped component class.
The world.
Definition world.hpp:132