![]() |
PERRY v1.0.0
P-E-R-R-Y/PERRY helps creating games with a bunch of tools.
|
define the Registry class More...
#include <Registry.hpp>
Classes | |
struct | is_tuple |
struct | is_tuple< std::tuple< Args... > > |
Public Member Functions | |
Entity | createEntity () |
handling entities (define in Registry.cpp) | |
Entity | entityFromIndex (std::size_t idx) |
Create a Entity object from an index. | |
void | killEntity (Entity const &e) |
Kill the given entity. | |
template<class Component> | |
SparseArray< Component > & | registerComponent () |
handling components (define in Registry_impl.hpp) | |
template<class ... Components> | |
void | registerComponents () |
register a list of components | |
template<class Tuple> | |
void | registerComponentsByExtraction () |
register every components by extraction from a tuple | |
template<class Component> | |
SparseArray< Component > & | getComponents () |
get components of a given type | |
template<class Component> | |
const SparseArray< Component > & | getComponents () const |
get immutable components of a given type | |
template<typename Component> | |
SparseArray< Component >::reference_type | addComponent (Entity const &to, Component &&c) |
template<typename Component, typename ... Params> | |
SparseArray< Component >::reference_type | emplaceComponent (Entity const &to, Params &&... p) |
emplace a component to the given entity | |
template<typename Component> | |
void | removeComponent (Entity const &from) |
remove a component from the given entity | |
template<typename T, typename... Args> | |
size_t | addSystem (Args &&... args) |
handling systems | |
template<typename T> | |
size_t | addSystem (std::unique_ptr< T > existingSystem) |
add a system to the registry | |
template<typename T> | |
void | removeSystem () |
remove a system from the registry | |
template<typename T> | |
void | callSystem () |
call a system | |
void | callSystems () |
call all systems | |
Private Attributes | |
size_t | _entitiesCount = 0 |
std::vector< Entity > | killedEntities |
std::unordered_map< std::type_index, std::any > | componentsArrays |
std::unordered_map< std::type_index, std::any > | systemsArrays |
std::vector< std::function< void(Registry &, Entity const &)> > | componentsRemoves |
std::unordered_map< std::type_index, std::unique_ptr< System > > | systems |
define the Registry class