Entity Class Reference

Represents an object in the game world. More...

Inheritance diagram for Entity:

Inheritance graph
[legend]
Collaboration diagram for Entity:

Collaboration graph
[legend]

List of all members.

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.
AssetGroupgetAssetGroup ()
 Gets pointer to the AssetGroup that is linked to this entity.
EntitygetChild (const u32 id)
 Gets the child with the given ID from this entity.
EntitygetChild (const std::string &name)
 Gets the child with the given name from this entity.
EntityComponentgetComponent (const u32 id)
 Gets the component with the given ID from this entity.
EntityComponentgetComponent (const std::string &name)
 Gets the component with the given name from this entity.
EntitygetParent () 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.


Detailed Description

Represents an object in the game world.

XML:

 <Entity name="" parent="">
    <!-- Properties -->
    <Components>
       <!-- Components -->
    </Components>
 </Entity>

Definition at line 42 of file Entity.h.


Constructor & Destructor Documentation

Entity::Entity ( const std::string &  name,
Entity parent = NULL,
AssetGroup group = NULL 
)

Constructor.

Parameters:
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 (  ) 

Deconstructor.

Definition at line 44 of file Entity.cpp.


Member Function Documentation

bool Entity::addChild ( Entity entity  ) 

Adds a child to the entity.

Parameters:
entity Pointer to the child to add.
Returns:
True if addition was successful, false if addition was a failure.

Definition at line 65 of file Entity.cpp.

bool Entity::addComponent ( EntityComponent component  ) 

Adds a component to the entity.

Parameters:
component Pointer to the component to add.
Returns:
True if addition was successful, false if addition was a failure.

Definition at line 91 of file Entity.cpp.

const vector3df & Entity::getAbsolutePosition (  )  const

Gets the absolute position of the entity.

Definition at line 169 of file Entity.cpp.

const vector3df & Entity::getAbsoluteRotation (  )  const

Gets the absolute rotation of the entity.

Definition at line 181 of file Entity.cpp.

AssetGroup * Entity::getAssetGroup (  ) 

Gets pointer to the AssetGroup that is linked to this entity.

Returns:
Pointer to the AssetGroup if available, else NULL.

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.

Returns:
Pointer to the child if found, else NULL.

Definition at line 127 of file Entity.cpp.

Entity * Entity::getChild ( const u32  id  ) 

Gets the child with the given ID from this entity.

Returns:
Pointer to the child if found, else NULL.

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.

Returns:
Pointer to the component if found, else NULL.

Definition at line 151 of file Entity.cpp.

EntityComponent * Entity::getComponent ( const u32  id  ) 

Gets the component with the given ID from this entity.

Returns:
Pointer to the component if found, else NULL.

Definition at line 139 of file Entity.cpp.

u32 Entity::getID (  )  const

Gets the ID of this entity.

Definition at line 53 of file Entity.cpp.

const std::string & Entity::getName (  )  const

Gets the name of this entity.

Definition at line 59 of file Entity.cpp.

Entity * Entity::getParent (  )  const

Gets the parent of this entity.

Returns:
Pointer to the parent, NULL if there is no parent.

Definition at line 163 of file Entity.cpp.

const vector3df & Entity::getPosition (  )  const

Gets the position of the entity.

Definition at line 175 of file Entity.cpp.

const vector3df & Entity::getRotation (  )  const

Gets the rotation of the entity.

Definition at line 187 of file Entity.cpp.

bool Entity::loadXML ( IXMLReader *  file  ) 

Loads Entity data from a XML file through a IXMLReader object.

Parameters:
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.

Parameters:
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.

Note:
For internal use only!

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.

Note:
For internal use only!

Definition at line 597 of file Entity.cpp.

void Entity::onRender ( void *  p  ) 

Renders the entity if the parent is rendered.

Note:
For internal use only!

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.

Note:
For internal use only!

Definition at line 608 of file Entity.cpp.

void Entity::onUnPause ( void *  p  ) 

Updates the entity if the parent is unpaused.

Note:
For internal use only!

Definition at line 637 of file Entity.cpp.

void Entity::onUpdate ( void *  p  ) 

Updates the entity if the parent is updated.

Note:
For internal use only!

Definition at line 619 of file Entity.cpp.

bool Entity::removeChild ( const std::string &  name  ) 

Removes the child with the given name.

Parameters:
name Name of the child to remove.
Returns:
True if removal was successful, false if removal was a failure.

Definition at line 394 of file Entity.cpp.

bool Entity::removeChild ( const u32  id  ) 

Removes the child with the given ID.

Parameters:
id ID of the child to remove.
Returns:
True if removal was successful, false if removal was a failure.

Definition at line 371 of file Entity.cpp.

bool Entity::removeChild ( Entity entity  ) 

Removes the given child.

Parameters:
entity Pointer to the child to remove.
Returns:
True if removal was successful, false if removal was a failure.

Definition at line 344 of file Entity.cpp.

void Entity::removeChildren (  ) 

Removes all children.

Definition at line 324 of file Entity.cpp.

bool Entity::removeComponent ( const std::string &  name  ) 

Removes the component with the given name.

Parameters:
name Name of the component to remove.
Returns:
True if removal was successful, false if removal was a failure.

Definition at line 465 of file Entity.cpp.

bool Entity::removeComponent ( const u32  id  ) 

Removes the component with the given ID.

Parameters:
id ID of the component to remove.
Returns:
True if removal was successful, false if removal was a failure.

Definition at line 443 of file Entity.cpp.

bool Entity::removeComponent ( EntityComponent component  ) 

Removes the given component.

Parameters:
component Pointer to the component to remove.
Returns:
True if removal was successful, false if removal was a failure.

Definition at line 417 of file Entity.cpp.

void Entity::removeComponents (  ) 

Removes all components.

Definition at line 335 of file Entity.cpp.

void Entity::removeParent (  ) 

Removes the current parent of this entity.

Definition at line 487 of file Entity.cpp.

void Entity::setAbsolutePosition ( const vector3df &  position  ) 

Sets the absolute position of the entity.

XML:

     <absolutePosition x="" y="" z="" />

Parameters:
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="" />

Parameters:
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.

Parameters:
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="" />

Parameters:
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="" />

Parameters:
rotation New rotation of the entity.

Definition at line 586 of file Entity.cpp.


The documentation for this class was generated from the following files:

Generated on Fri Aug 21 23:55:13 2009 for Sirrf - Simple Irrlicht Framework by  doxygen 1.5.8