hx3d
1
2D/3D Simple Game Framework
|
Manages entity in a world. More...
#include <engine.hpp>
Public Member Functions | |
Ptr< Entity > | createEntity () |
Create a new entity with the last entity id available. More... | |
void | registerEntity (const Ptr< Entity > &entity) |
Affect an ID to a uninitialized entity. More... | |
void | removeEntity (const Ptr< Entity > &entity) |
Mark the entity for deletion from the engine. More... | |
template<class T > | |
Ptr< T > | getComponent (const Ptr< Entity > &entity) |
Get the component for an entity. More... | |
template<class T > | |
void | addComponent (const Ptr< Entity > &entity, const Ptr< Component > &component) |
Add a component for an entity. More... | |
template<class T , class... Args> | |
void | createComponent (const Ptr< Entity > &entity, Args...args) |
Create a component for an entity with variable args. More... | |
template<class T > | |
void | addSystem (const Ptr< System > &sys) |
Add a system to the engine. More... | |
template<class T , class... Args> | |
void | createSystem (Args...args) |
Create a system into the engine. More... | |
unsigned int | getComponentSize (const Ptr< Entity > &entity) |
Get the number of components for an entity. More... | |
unsigned int | getEntityCount () |
Get the number of entities. More... | |
unsigned int | getBits (const Ptr< Entity > &entity) |
Get the bits corresponding to the entity components. More... | |
template<class T > | |
void | registerComponentAdded (std::function< void(const Ptr< Component > &, const Ptr< Entity > &)> callback) |
Register a callback for a certain component type when it's added. More... | |
template<class T > | |
void | registerComponentRemoved (std::function< void(const Ptr< Component > &, const Ptr< Entity > &)> callback) |
Register a callback for a certain component type when it's removed. More... | |
void | update (const float delta) |
Update the engine. More... | |
void | clear () |
Remove everything from the engine. | |
Manages entity in a world.
Definition at line 41 of file engine.hpp.
void hx3d::ecs::Engine::addComponent | ( | const Ptr< Entity > & | entity, |
const Ptr< Component > & | component | ||
) |
Add a component for an entity.
Definition at line 42 of file engine.inl.hpp.
Add a system to the engine.
sys | System (Ptr) |
Definition at line 80 of file engine.inl.hpp.
void hx3d::ecs::Engine::createComponent | ( | const Ptr< Entity > & | entity, |
Args... | args | ||
) |
Create a component for an entity with variable args.
entity | Entity (Ptr) |
args | Arguments |
Definition at line 47 of file engine.inl.hpp.
Create a new entity with the last entity id available.
Definition at line 28 of file engine.cpp.
void hx3d::ecs::Engine::createSystem | ( | Args... | args | ) |
Create a system into the engine.
args | Arguments |
Definition at line 88 of file engine.inl.hpp.
Get the bits corresponding to the entity components.
entity | Entity (Ptr) |
Definition at line 67 of file engine.cpp.
Get the component for an entity.
entity | Entity (Ptr) |
Definition at line 25 of file engine.inl.hpp.
Get the number of components for an entity.
entity | Entity (Ptr) |
Definition at line 53 of file engine.cpp.
unsigned int hx3d::ecs::Engine::getEntityCount | ( | ) |
void hx3d::ecs::Engine::registerComponentAdded | ( | std::function< void(const Ptr< Component > &, const Ptr< Entity > &)> | callback | ) |
Register a callback for a certain component type when it's added.
callback | Callback function |
Definition at line 96 of file engine.inl.hpp.
void hx3d::ecs::Engine::registerComponentRemoved | ( | std::function< void(const Ptr< Component > &, const Ptr< Entity > &)> | callback | ) |
Register a callback for a certain component type when it's removed.
callback | Callback function |
Definition at line 101 of file engine.inl.hpp.
Affect an ID to a uninitialized entity.
entity | Entity (Ptr) |
Definition at line 37 of file engine.cpp.
Mark the entity for deletion from the engine.
The deletion is delayed until the next update.
entity | Entity (Ptr) |
Definition at line 49 of file engine.cpp.
void hx3d::ecs::Engine::update | ( | const float | delta | ) |