Flecs v4.0
A fast entity component system (ECS) for C & C++
|
Registering and working with components. More...
Classes | |
struct | flecs::untyped_component |
Untyped component class. More... | |
struct | flecs::component< T > |
Component class. More... | |
Functions | |
void | flecs::reset () |
Reset static component ids. | |
template<typename T , typename... Args> | |
flecs::component< T > | flecs::world::component (Args &&... args) const |
Find or register component. | |
template<typename... Args> | |
flecs::untyped_component | flecs::world::component (Args &&... args) const |
Find or register untyped component. | |
Registering and working with components.
flecs::untyped_component component | ( | Args &&... | args | ) | const |
Find or register untyped component.
Method available on flecs::world class.
|
inline |
Reset static component ids.
When components are registered their component ids are stored in a static type specific variable. This stored id is passed into component registration functions to ensure consistent ids across worlds.
In some cases this can be undesirable, like when a process repeatedly creates worlds with different components. A typical example where this can happen is when running multiple tests in a single process, where each test registers its own set of components.
This operation can be used to prevent reusing of component ids and force generating a new ids upon registration.
Note that this operation should never be called while there are still alive worlds in a process. Doing so results in undefined behavior.
Also note that this operation does not actually change the static component variables. It only ensures that the next time a component id is requested, a new id will be generated.
Definition at line 557 of file component.hpp.