Atlas
A Convenient Entity Component System
 All Classes Namespaces Files Functions Variables Typedefs Friends
Atlas::Entity Class Reference

Used to represent any game object. More...

#include <Entity.h>

Inheritance diagram for Atlas::Entity:
Collaboration diagram for Atlas::Entity:

Public Types

typedef unsigned int ID
 ID type for an Entity. More...
 
typedef std::unique_ptr< EntityPtr
 Standard pointer used an Entity. More...
 

Public Member Functions

template<typename Type >
Type * getComponent () const
 Retrieves a specified Component from the Entity. More...
 
std::vector< Component * > getAllComponents () const
 Retrieves all Components that are attached to the Entity. More...
 
void addComponent (Component::Ptr Component)
 Adds a Component to the Entity. More...
 
template<typename Type >
void removeComponent ()
 Removes a specified Component from the Entity. More...
 
ID getID () const
 Retrieves the ID assigned to the Entity. More...
 
bool isActive () const
 Checks if the Entity is active. More...
 
void setActive (bool Flag)
 Sets the active state of the Entity. More...
 
std::bitset< BITSIZEgetComponentBits () const
 Retrieves the Component bits in use by the Entity. More...
 
void setSystemBit (const std::bitset< BITSIZE > &Bit)
 Sets a System bit to be assigned to the Entity. More...
 
void removeSystemBit (const std::bitset< BITSIZE > &Bit)
 Removes a System bit from the Entity. More...
 
std::bitset< BITSIZEgetSystemBits () const
 Retrieves the System bits assigned to the Entity. More...
 
void toString () const
 Prints the ID, Component bits, Component list, and Active state of the Entity. More...
 
- Public Member Functions inherited from Atlas::NonCopyable
 NonCopyable ()=default
 Default Constructor. More...
 
virtual ~NonCopyable ()
 

Friends

class EntityManager
 

Detailed Description

Used to represent any game object.

Acts as a grouping/container for Components.

Member Typedef Documentation

typedef unsigned int Atlas::Entity::ID

ID type for an Entity.

typedef std::unique_ptr<Entity> Atlas::Entity::Ptr

Standard pointer used an Entity.

Member Function Documentation

void Atlas::Entity::addComponent ( Component::Ptr  Component)

Adds a Component to the Entity.

Usage Example:

entity.addComponent(Atlas::Component::Ptr(new HealthComponent()));
Parameters
Component- component to be added
std::vector<Component*> Atlas::Entity::getAllComponents ( ) const

Retrieves all Components that are attached to the Entity.

Returns
All Components owned by the Entity
template<typename Type >
Type* Atlas::Entity::getComponent ( ) const
inline

Retrieves a specified Component from the Entity.

Usage Example:

HealthComponent* health = entity.getComponent<HealthComponent>();
health->hitpoints -= damage;
Returns
Component casted to it's derived type

Here is the call graph for this function:

std::bitset<BITSIZE> Atlas::Entity::getComponentBits ( ) const

Retrieves the Component bits in use by the Entity.

Returns
Set of Component bits
ID Atlas::Entity::getID ( ) const

Retrieves the ID assigned to the Entity.

Returns
The ID

Here is the caller graph for this function:

std::bitset<BITSIZE> Atlas::Entity::getSystemBits ( ) const

Retrieves the System bits assigned to the Entity.

Returns
Set of System bits
bool Atlas::Entity::isActive ( ) const

Checks if the Entity is active.

Returns
True if Entity is active
template<typename Type >
void Atlas::Entity::removeComponent ( )
inline

Removes a specified Component from the Entity.

Usage Example:

entity.removeComponent<HealthComponent>();

Here is the call graph for this function:

void Atlas::Entity::removeSystemBit ( const std::bitset< BITSIZE > &  Bit)

Removes a System bit from the Entity.

Parameters
Bit- bit to be removed
void Atlas::Entity::setActive ( bool  Flag)

Sets the active state of the Entity.

Any inactive Entities will be removed by the EntityManager.

Parameters
Flag- status of Entity
void Atlas::Entity::setSystemBit ( const std::bitset< BITSIZE > &  Bit)

Sets a System bit to be assigned to the Entity.

Parameters
Bit- System bit to be added
void Atlas::Entity::toString ( ) const

Prints the ID, Component bits, Component list, and Active state of the Entity.

Friends And Related Function Documentation

friend class EntityManager
friend

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