0.45.0
![]() |
#include <iEntity.h>
Public Member Functions | |
const iEntityID & | getID () const |
iEntityIDPath | getIDPath () const |
void | setName (const iaString &name) |
const iaString & | getName () const |
void | setParent (const iEntityID &parentID) |
void | setParent (iEntityPtr parent) |
void | removeParent () |
iEntityPtr | getParent () const |
bool | hasParent () const |
bool | isRoot () const |
const std::vector< iEntityPtr > & | getChildren () const |
const std::vector< iEntityPtr > & | getInactiveChildren () const |
void | setActive (bool active) |
void | setActiveExclusive (bool active) |
bool | isActive () const |
iEntityScenePtr | getScene () const |
iEntityComponentMask | getComponentMask () const |
template<typename T > | |
T * | addComponent (T *component) |
void | addComponent (const std::type_index &typeID, iEntityComponentPtr component) |
template<typename T > | |
T * | getComponent () const |
iEntityComponentPtr | getComponent (const std::type_index &typeID) const |
const std::vector< std::type_index > | getComponentTypes () |
template<typename T > | |
void | destroyComponent () |
template<typename T > | |
void | reloadComponent () |
void | addBehaviour (const iBehaviourDelegate &behaviour, const std::any &userData=std::any(), const iaString &name="", uint8 priority=100) |
void | removeBehaviour (const iBehaviourDelegate &behaviour) |
void | clearComponents () |
bool | isHierarchyDirty () const |
void | setDirtyHierarchy () |
void | resetDirtyHierarchy () |
template<typename T > | |
T * | addComponent (T *component) |
template<typename T > | |
T * | getComponent () const |
template<typename T > | |
void | destroyComponent () |
template<typename T > | |
void | reloadComponent () |
Static Public Member Functions | |
static iEntityComponentMask | calcComponentMask (const std::vector< std::type_index > &types) |
Friends | |
class | iEntityScene |
class | iEntityTransformTraverser |
class | iTransformComponent |
entity definition
Igor uses the terms entity, component and system but it is not a classic entity component system or ECS. An entity is a hierarchical element in the scene with parents and children. It behaves more like a game object.
void igor::iEntity::addBehaviour | ( | const iBehaviourDelegate & | behaviour, |
const std::any & | userData = std::any() , |
||
const iaString & | name = "" , |
||
uint8 | priority = 100 |
||
) |
adds behaviour to entity
behaviour | the behaviour to be added |
userData | user data added to behaviour |
name | the name of the behaviour |
priority | execution priority (low = 0, default = 100, high = ...) |
void igor::iEntity::addComponent | ( | const std::type_index & | typeID, |
iEntityComponentPtr | component | ||
) |
adds component with given type id
entity takes ownership of component
typeID | the given type id |
component | the component to add |
T * igor::iEntity::addComponent | ( | T * | component | ) |
add component
entity takes ownership of component
component | the component to add |
T * igor::iEntity::addComponent | ( | T * | component | ) |
|
static |
calculate type hash from component types
types | the types to use for calculation |
void igor::iEntity::clearComponents | ( | ) |
removes all components
void igor::iEntity::destroyComponent | ( | ) |
destroys given component by type
void igor::iEntity::destroyComponent | ( | ) |
const std::vector< iEntityPtr > & igor::iEntity::getChildren | ( | ) | const |
T * igor::iEntity::getComponent | ( | ) | const |
T * igor::iEntity::getComponent | ( | ) | const |
iEntityComponentPtr igor::iEntity::getComponent | ( | const std::type_index & | typeID | ) | const |
typeID | the given type |
iEntityComponentMask igor::iEntity::getComponentMask | ( | ) | const |
const std::vector< std::type_index > igor::iEntity::getComponentTypes | ( | ) |
const iEntityID & igor::iEntity::getID | ( | ) | const |
iEntityIDPath igor::iEntity::getIDPath | ( | ) | const |
This is slow. Use with care
const std::vector< iEntityPtr > & igor::iEntity::getInactiveChildren | ( | ) | const |
const iaString & igor::iEntity::getName | ( | ) | const |
iEntityPtr igor::iEntity::getParent | ( | ) | const |
iEntityScenePtr igor::iEntity::getScene | ( | ) | const |
bool igor::iEntity::hasParent | ( | ) | const |
bool igor::iEntity::isActive | ( | ) | const |
bool igor::iEntity::isHierarchyDirty | ( | ) | const |
bool igor::iEntity::isRoot | ( | ) | const |
used for special case handling
void igor::iEntity::reloadComponent | ( | ) |
destroys given component by type
void igor::iEntity::reloadComponent | ( | ) |
void igor::iEntity::removeBehaviour | ( | const iBehaviourDelegate & | behaviour | ) |
removes behaviour from entity
behaviour | the behaviour to be removed |
void igor::iEntity::removeParent | ( | ) |
removes parent connection
void igor::iEntity::resetDirtyHierarchy | ( | ) |
resets dirty flag on this entity
void igor::iEntity::setActive | ( | bool | active | ) |
sets wether and entity is active or not
active | if true entity will be active |
void igor::iEntity::setActiveExclusive | ( | bool | active | ) |
sets wether and entity is active or not while at the same time make sure all siblings will be set to the opposite
active | if true entity will be active |
void igor::iEntity::setDirtyHierarchy | ( | ) |
sets dirty flag up and down the hierarchy
void igor::iEntity::setName | ( | const iaString & | name | ) |
sets name of entity
name | the name to set |
void igor::iEntity::setParent | ( | const iEntityID & | parentID | ) |
sets parent of this entity by id
parentID | the given parent id |
void igor::iEntity::setParent | ( | iEntityPtr | parent | ) |
sets parent of this entity
parent | the given parent |
|
friend |
|
friend |
|
friend |