VOX
A little voxel engine
|
This class is the main class of the ECS system you can use it to create entitites, add component to entities, fetch components from entities and remove them. More...
#include <Manager.hpp>
Classes | |
class | ComponentAlreadyExists |
class | ComponentDoesNotExist |
class | EntityAlreadyExists |
class | EntityDoesNotExist |
Public Types | |
typedef SparseSet< entityType > | entitySet |
template<typename ComponentType > | |
using | componentSet = ComponentStorage< entityType, ComponentType > |
Public Member Functions | |
Manager () | |
~Manager () | |
Manager (Manager &other)=delete | |
Manager (Manager &&other)=delete | |
Manager & | operator= (Manager &other)=delete |
Manager & | operator= (Manager &&other)=delete |
std::pair< bool, entityType > | createEntity () |
Create a new entity. More... | |
void | removeEntity (entityType entity) |
Remove an entity from the manager. More... | |
bool | isAlive (entityType entity) const |
template<typename ComponentType > | |
void | add (entityType entity, ComponentType component) |
add a component to an entity More... | |
template<typename... ComponentTypes> | |
void | add (entityType entity, ComponentTypes... components) |
add multiple components to an entity More... | |
template<typename... ComponentTypes> | |
void | remove (entityType entity) |
remove any components from an entity More... | |
template<typename ComponentType > | |
ComponentType & | getComponent (entityType entity) |
get a component attached to an entity More... | |
template<typename... ComponentTypes> | |
std::tuple< ComponentTypes &... > | getComponents (entityType entity) |
Get multiple components attached to an entity as a tuple. More... | |
template<typename ComponentType > | |
ComponentType * | tryGetComponent (entityType entity) |
Try to get a component attached to an entity. More... | |
template<typename... ComponentTypes> | |
std::tuple< ComponentTypes *... > | tryGetComponents (entityType entity) |
try to get multiple components attached to an entity as a tuple More... | |
template<typename... ComponentTypes> | |
View< entityType, ComponentTypes... > | view () |
get an iterable view of entities that have all the components listed in the tparams More... | |
Static Public Member Functions | |
static constexpr uint32_t | getEntityVersion (const entityType &entity) |
Get the version of the entity, see the entity doc for more info. More... | |
static constexpr uint32_t | getEntityIndex (const entityType &entity) |
Get the index of the entity in the entity array, see the entity doc for more info. More... | |
Friends | |
template<ValidEntity entity, typename... ComponentTypes> | |
class | View |
This class is the main class of the ECS system you can use it to create entitites, add component to entities, fetch components from entities and remove them.
Go see the Entity page for more info on how the entities are stored
entityType | the internal type used for entities id, must be integral and unsigned, default uint32_t |
using ecs::Manager< entityType >::componentSet = ComponentStorage<entityType, ComponentType> |
typedef SparseSet<entityType> ecs::Manager< entityType >::entitySet |
|
inline |
|
inline |
|
delete |
|
delete |
|
inline |
add a component to an entity
ComponentType |
entity | |
component |
|
inline |
add multiple components to an entity
ComponentTypes |
entity | |
components |
|
inline |
Create a new entity.
std::pair<TRUE,entityType> | if the entity was created successfully |
std::pair<FALSE,undefined> | if the entity could not be created |
|
inline |
get a component attached to an entity
ComponentType |
entity |
|
inline |
Get multiple components attached to an entity as a tuple.
you can use
ComponentTypes |
entity |
|
inlinestaticconstexpr |
Get the index of the entity in the entity array, see the entity doc for more info.
entity |
|
inlinestaticconstexpr |
Get the version of the entity, see the entity doc for more info.
entity |
|
inline |
|
delete |
|
delete |
|
inline |
remove any components from an entity
ComponentTypes |
entity |
|
inline |
Remove an entity from the manager.
entity |
|
inline |
Try to get a component attached to an entity.
ComponentType |
entity |
|
inline |
try to get multiple components attached to an entity as a tuple
ComponentTypes |
entity |
|
inline |
get an iterable view of entities that have all the components listed in the tparams
ComponentTypes |
|
friend |