|
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 , ENEMIES , COLLIDERS , PROJECTILE , HEARTS , POWERUPS } |
| Used for rendering order (last is highest) or retrieving entities of group. More... | |
| enum class | TeamLabel { NONE , BLUE , RED } |
| Allows grouping entities by team association for hits, win conditions, etc. More... | |
Public Member Functions | |
| Entity (Manager &mManager) | |
| void | update () const |
| void | draw () const |
| bool | isActive () const |
| void | destroy () |
| bool | hasGroup (Group mGroup) |
| void | addGroup (Group mGroup) |
| void | delGroup (Group mGroup) |
| std::bitset< MAX_GROUPS > | getGroupBitSet () |
| void | setTeam (TeamLabel teamLabel) |
| TeamLabel | getTeam () |
| Manager & | getManager () |
| template<typename T > | |
| bool | hasComponent () const |
| template<typename T , typename... TArgs> | |
| T & | addComponent (TArgs &&...mArgs) |
| Adds specified type as component and calls Component::init() | |
| template<typename T > | |
| T & | getComponent () const |
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 |
Used for rendering order (last is highest) or retrieving entities of group.
Label used in singular entity shouldn't use plural
HEARTS are rendered above POWERUPS, missleading order
PROJECTILE are rendered above POWERUPS, missleading order
Generalize HEARTS as UI or similar
| Enumerator | |
|---|---|
| MAPTILES | Entity using TileComponent. |
| PLAYERS | Primary entity in player controll. |
| ENEMIES |
|
| COLLIDERS | Fixed collider entity, e.g. a wall. |
| PROJECTILE |
|
| HEARTS |
|
| POWERUPS |
|
|
strong |
Adds specified type as component and calls Component::init()
| mArgs | Constructor arguments of component |
| void Entity::addGroup | ( | Group | mGroup | ) |
| void Entity::delGroup | ( | Group | mGroup | ) |
|
inline |
Mark for destruction for Manager::refresh() and disables collision
| void Entity::draw | ( | ) | const |
Call after update to render components.
| std::bitset< MAX_GROUPS > Entity::getGroupBitSet | ( | ) |
| Entity::TeamLabel Entity::getTeam | ( | ) |
|
inline |
| bool Entity::hasGroup | ( | Group | mGroup | ) |
| void Entity::setTeam | ( | Entity::TeamLabel | teamLabel | ) |
| void Entity::update | ( | ) | const |
Call each frame to update all components