Entity Class Reference

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

Collaboration diagram for Entity:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Entity (const std::string &name, Entity *parent=NULL)
 Constructor.
 ~Entity ()
 Deconstructor.
void refAdd ()
 Increases the reference counter.
void refRelease ()
 Decreases the reference counter.
u32 getID () const
 Gets the ID of this entity.
const std::string & getName () const
 Gets the name of this entity.
bool addComponent (EntityComponent *component)
 Adds a component to the 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 & getPosition () const
 Gets the position of the entity.
void removeAllChildren ()
 Removes all children.
void removeAllComponents ()
 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 setPosition (const vector3df &position)
 Sets the position of the entity.
void onPositionChange (void *p)
 Updates the position 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.

Static Public Member Functions

static EntityrefFactory (const std::string &name)
 Will be used to instanciate objects of this class.


Detailed Description

Represents an object in the game world.

Definition at line 29 of file Entity.h.


Constructor & Destructor Documentation

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

Constructor.

Parameters:
name Name of the entity.
parent Parent of the entity.

Definition at line 26 of file Entity.cpp.

Entity::~Entity (  ) 

Deconstructor.

Definition at line 67 of file Entity.cpp.


Member Function Documentation

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 138 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 167 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 155 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 191 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 179 of file Entity.cpp.

u32 Entity::getID (  )  const

Gets the ID of this entity.

Definition at line 109 of file Entity.cpp.

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

Gets the name of this entity.

Definition at line 115 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 203 of file Entity.cpp.

const vector3df & Entity::getPosition (  )  const

Gets the position of the entity.

Definition at line 209 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 417 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 396 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 410 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 424 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 403 of file Entity.cpp.

void Entity::refAdd (  ) 

Increases the reference counter.

Note:
For internal use only!

Definition at line 84 of file Entity.cpp.

Entity * Entity::refFactory ( const std::string &  name  )  [static]

Will be used to instanciate objects of this class.

Note:
For internal use only!

Definition at line 78 of file Entity.cpp.

void Entity::refRelease (  ) 

Decreases the reference counter.

Note:
For internal use only!

Definition at line 90 of file Entity.cpp.

void Entity::removeAllChildren (  ) 

Removes all children.

Definition at line 215 of file Entity.cpp.

void Entity::removeAllComponents (  ) 

Removes all components.

Definition at line 227 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 288 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 264 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 236 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 360 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 338 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 312 of file Entity.cpp.

void Entity::setPosition ( const vector3df &  position  ) 

Sets the position of the entity.

Parameters:
position New position of the entity.

Definition at line 382 of file Entity.cpp.


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

Generated on Wed Jun 10 22:26:25 2009 for Sirrf - Simple Irrlicht Framework by  doxygen 1.5.8