Public Member Functions | |
Entity (const std::string &name, Entity *parent=NULL, AssetGroup *group=NULL) | |
Constructor. | |
~Entity () | |
Deconstructor. | |
u32 | getID () const |
Gets the ID of this entity. | |
const std::string & | getName () const |
Gets the name of this entity. | |
bool | addChild (Entity *entity) |
Adds a child to the entity. | |
bool | addComponent (EntityComponent *component) |
Adds a component to the entity. | |
AssetGroup * | getAssetGroup () |
Gets pointer to the AssetGroup that is linked to this entity. | |
Entity * | getChild (const u32 id) |
Gets the child with the given ID from this entity. | |
Entity * | getChild (const std::string &name) |
Gets the child with the given name from this entity. | |
EntityComponent * | getComponent (const u32 id) |
Gets the component with the given ID from this entity. | |
EntityComponent * | getComponent (const std::string &name) |
Gets the component with the given name from this entity. | |
Entity * | getParent () const |
Gets the parent of this entity. | |
const vector3df & | getAbsolutePosition () const |
Gets the absolute position of the entity. | |
const vector3df & | getPosition () const |
Gets the position of the entity. | |
const vector3df & | getAbsoluteRotation () const |
Gets the absolute rotation of the entity. | |
const vector3df & | getRotation () const |
Gets the rotation of the entity. | |
bool | loadXML (const std::string &fileName) |
Loads Entity data from a XML file. | |
bool | loadXML (IXMLReader *file) |
Loads Entity data from a XML file through a IXMLReader object. | |
void | removeChildren () |
Removes all children. | |
void | removeComponents () |
Removes all components. | |
bool | removeChild (Entity *entity) |
Removes the given child. | |
bool | removeChild (const u32 id) |
Removes the child with the given ID. | |
bool | removeChild (const std::string &name) |
Removes the child with the given name. | |
bool | removeComponent (EntityComponent *component) |
Removes the given component. | |
bool | removeComponent (const u32 id) |
Removes the component with the given ID. | |
bool | removeComponent (const std::string &name) |
Removes the component with the given name. | |
void | removeParent () |
Removes the current parent of this entity. | |
void | setAbsolutePosition (const vector3df &position) |
Sets the absolute position of the entity. | |
void | setPosition (const vector3df &position) |
Sets the position of the entity. | |
void | setAbsoluteRotation (const vector3df &rotation) |
Sets the absolute rotation of the entity. | |
void | setRotation (const vector3df &rotation) |
Sets the rotation of the entity. | |
bool | setParent (Entity *parent) |
Sets the parent of the entity. | |
void | onPositionChange (void *p) |
Updates the position of the entity after its parent has been updated. | |
void | onRotationChange (void *p) |
Updates the rotation of the entity after its parent has been updated. | |
void | onUpdate (void *p) |
Updates the entity if the parent is updated. | |
void | onRender (void *p) |
Renders the entity if the parent is rendered. | |
void | onPause (void *p) |
Pauses the entity if the parent is paused. | |
void | onUnPause (void *p) |
Updates the entity if the parent is unpaused. |
XML:
<Entity name="" parent=""> <!-- Properties --> <Components> <!-- Components --> </Components> </Entity>
Definition at line 42 of file Entity.h.
Entity::Entity | ( | const std::string & | name, | |
Entity * | parent = NULL , |
|||
AssetGroup * | group = NULL | |||
) |
Constructor.
name | Name of the entity. | |
parent | Parent of the entity. | |
group | Pointer to the AssetGroup that will be used as an alternative source for loading assets instead of the global unmanaged asset pool. |
Definition at line 26 of file Entity.cpp.
Entity::~Entity | ( | ) |
bool Entity::addChild | ( | Entity * | entity | ) |
Adds a child to the entity.
entity | Pointer to the child to add. |
Definition at line 65 of file Entity.cpp.
bool Entity::addComponent | ( | EntityComponent * | component | ) |
Adds a component to the entity.
component | Pointer to the component to add. |
Definition at line 91 of file Entity.cpp.
const vector3df & Entity::getAbsolutePosition | ( | ) | const |
const vector3df & Entity::getAbsoluteRotation | ( | ) | const |
AssetGroup * Entity::getAssetGroup | ( | ) |
Gets pointer to the AssetGroup that is linked to this entity.
Definition at line 109 of file Entity.cpp.
Entity * Entity::getChild | ( | const std::string & | name | ) |
Gets the child with the given name from this entity.
Definition at line 127 of file Entity.cpp.
Entity * Entity::getChild | ( | const u32 | id | ) |
Gets the child with the given ID from this entity.
Definition at line 115 of file Entity.cpp.
EntityComponent * Entity::getComponent | ( | const std::string & | name | ) |
Gets the component with the given name from this entity.
Definition at line 151 of file Entity.cpp.
EntityComponent * Entity::getComponent | ( | const u32 | id | ) |
Gets the component with the given ID from this entity.
Definition at line 139 of file Entity.cpp.
u32 Entity::getID | ( | ) | const |
const std::string & Entity::getName | ( | ) | const |
Entity * Entity::getParent | ( | ) | const |
Gets the parent of this entity.
Definition at line 163 of file Entity.cpp.
const vector3df & Entity::getPosition | ( | ) | const |
const vector3df & Entity::getRotation | ( | ) | const |
bool Entity::loadXML | ( | IXMLReader * | file | ) |
Loads Entity data from a XML file through a IXMLReader object.
file | Pointer to the IXMLReader object that will be used. |
Definition at line 212 of file Entity.cpp.
bool Entity::loadXML | ( | const std::string & | fileName | ) |
Loads Entity data from a XML file.
fileName | Filename of the file where the data is retrieved from. |
Definition at line 193 of file Entity.cpp.
void Entity::onPause | ( | void * | p | ) |
Pauses the entity if the parent is paused.
Definition at line 631 of file Entity.cpp.
void Entity::onPositionChange | ( | void * | p | ) |
Updates the position of the entity after its parent has been updated.
Definition at line 597 of file Entity.cpp.
void Entity::onRender | ( | void * | p | ) |
Renders the entity if the parent is rendered.
Definition at line 625 of file Entity.cpp.
void Entity::onRotationChange | ( | void * | p | ) |
Updates the rotation of the entity after its parent has been updated.
Definition at line 608 of file Entity.cpp.
void Entity::onUnPause | ( | void * | p | ) |
Updates the entity if the parent is unpaused.
Definition at line 637 of file Entity.cpp.
void Entity::onUpdate | ( | void * | p | ) |
Updates the entity if the parent is updated.
Definition at line 619 of file Entity.cpp.
bool Entity::removeChild | ( | const std::string & | name | ) |
Removes the child with the given name.
name | Name of the child to remove. |
Definition at line 394 of file Entity.cpp.
bool Entity::removeChild | ( | const u32 | id | ) |
Removes the child with the given ID.
id | ID of the child to remove. |
Definition at line 371 of file Entity.cpp.
bool Entity::removeChild | ( | Entity * | entity | ) |
Removes the given child.
entity | Pointer to the child to remove. |
Definition at line 344 of file Entity.cpp.
void Entity::removeChildren | ( | ) |
bool Entity::removeComponent | ( | const std::string & | name | ) |
Removes the component with the given name.
name | Name of the component to remove. |
Definition at line 465 of file Entity.cpp.
bool Entity::removeComponent | ( | const u32 | id | ) |
Removes the component with the given ID.
id | ID of the component to remove. |
Definition at line 443 of file Entity.cpp.
bool Entity::removeComponent | ( | EntityComponent * | component | ) |
Removes the given component.
component | Pointer to the component to remove. |
Definition at line 417 of file Entity.cpp.
void Entity::removeComponents | ( | ) |
void Entity::removeParent | ( | ) |
void Entity::setAbsolutePosition | ( | const vector3df & | position | ) |
Sets the absolute position of the entity.
XML:
<absolutePosition x="" y="" z="" />
position | New absolute position of the entity. |
Definition at line 507 of file Entity.cpp.
void Entity::setAbsoluteRotation | ( | const vector3df & | rotation | ) |
Sets the absolute rotation of the entity.
XML:
<absoluteRotation x="" y="" z="" />
rotation | New absolute rotation of the entity. |
Definition at line 575 of file Entity.cpp.
bool Entity::setParent | ( | Entity * | parent | ) |
Sets the parent of the entity.
parent | Parent of the entity. |
Definition at line 529 of file Entity.cpp.
void Entity::setPosition | ( | const vector3df & | position | ) |
Sets the position of the entity.
XML:
<position x="" y="" z="" />
position | New position of the entity. |
Definition at line 518 of file Entity.cpp.
void Entity::setRotation | ( | const vector3df & | rotation | ) |
Sets the rotation of the entity.
XML:
<rotation x="" y="" z="" />
rotation | New rotation of the entity. |
Definition at line 586 of file Entity.cpp.