|
VEGO-Engine
0.1
|
Main class for any object in game, stores associations, labeling and components. More...
#include <Entity.h>
Public Types | |
| enum class | GroupLabel { MAPTILES , PLAYERS , COLLIDERS , PROJECTILE , HEARTS , POWERUPS } |
| Some premade Entity groups used to avoid checking all entities for everything all of the time. More... | |
Public Member Functions | |
| Entity (Manager &mManager) | |
| void | update (uint_fast16_t diffTime) const |
| Call each frame to update all components. | |
| bool | isActive () const |
| void | destroy () |
| Manager & | getManager () |
| template<typename T> | |
| bool | hasComponent () const |
| template<typename T, typename... TArgs> | |
| T & | addComponent (TArgs &&...mArgs) |
| Adds specified type as component and calls its CONSTRUCTOR. | |
| template<typename T> | |
| T & | getComponent () const |
| Access a specific component of an entity. | |
| template<typename T> | |
| std::shared_ptr< T > | getComponentAsPointer () const |
| Access a specific component of an entity as a pointer. | |
Main class for any object in game, stores associations, labeling and components.
The entity class is the primary class each object in the game needs to use. Add components to assign functionality.
More detailed description
Some functions in entity class are only supposed to be called in specific context, which might be valid uses for friend keyword. Example: Entity() should only be called from Manager::addEntity(). Verify each functions intended use/scope.
|
strong |
Some premade Entity groups used to avoid checking all entities for everything all of the time.
| Enumerator | |
|---|---|
| MAPTILES | Entity using TileComponent, internal use only. |
| PLAYERS | Primary entity in player control, used to be able to interact with pickupables. |
| COLLIDERS | Fixed collider entity, e.g. a wall. |
| PROJECTILE | Not used. |
| HEARTS | Not used. |
| POWERUPS | Not used. |
|
inline |
Adds specified type as component and calls its CONSTRUCTOR.
e.g. addComponent<Type of component>(parameters of constructor)
| mArgs | Constructor arguments of component |
|
inline |
Mark for destruction for Manager::refresh() and disables collision
|
inline |
Access a specific component of an entity.
| T | Type of component to access |
|
inline |
Access a specific component of an entity as a pointer.
| T | Type of component to access |
|
inline |
|
inline |