GlPortal Class Reference  0.1.1
Source code documentation of the free and open 3D action puzzle game.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Data Structures | Public Member Functions | Data Fields | Private Member Functions | Private Attributes | Friends
radix::Entity Class Reference

ECS entity, Component container It is created like this:

Entity &trigger = world.entities.create();
Transform &t = trigger.addComponent<Transform>();
More...

#include <external/RadixEngine/include/radix/Entity.hpp>

Data Structures

struct  ComponentAddedEvent
 
struct  ComponentRemovedEvent
 
struct  NameChangedEvent
 

Public Member Functions

 Entity (EntityManager &manager, EntityId id)
 
 ~Entity ()
 
bool operator== (const Entity &o) const
 
bool operator!= (const Entity &o) const
 
std::string getName () const
 
void setName (const std::string &)
 
template<typename T , typename... TArgs>
T & addComponent (TArgs &&...mArgs)
 
template<typename T >
bool hasComponent () const
 
template<typename T >
T & getComponent () const
 
template<class T >
void removeComponent ()
 
void clearComponents ()
 

Data Fields

EntityManagermanager
 
EntityId id
 Entity (instance) identifier. More...
 
std::array< std::unique_ptr
< Component >
, Component::MaxId
components
 

Private Member Functions

 Entity (Entity &)=delete
 
Entityoperator= (Entity &)=delete
 
 Entity (Entity &&)=delete
 
Entityoperator= (Entity &&)=delete
 
void addComponent (ComponentTypeId, Component *)
 
void removeComponent (ComponentTypeId)
 

Private Attributes

std::string name
 Entity's name. More...
 

Friends

class EntityManager
 

Detailed Description

ECS entity, Component container It is created like this:

Entity &trigger = world.entities.create();
Transform &t = trigger.addComponent<Transform>();

Constructor & Destructor Documentation

radix::Entity::Entity ( Entity )
privatedelete
radix::Entity::Entity ( Entity &&  )
privatedelete
radix::Entity::Entity ( EntityManager manager,
EntityId  id 
)
inline
radix::Entity::~Entity ( )
inline

Member Function Documentation

void radix::Entity::addComponent ( ComponentTypeId  id,
Component comp 
)
private
template<typename T , typename... TArgs>
T& radix::Entity::addComponent ( TArgs &&...  mArgs)
inline
void radix::Entity::clearComponents ( )
template<typename T >
T& radix::Entity::getComponent ( ) const
inline
std::string radix::Entity::getName ( ) const
inline
template<typename T >
bool radix::Entity::hasComponent ( ) const
inline
bool radix::Entity::operator!= ( const Entity o) const
inline
Entity& radix::Entity::operator= ( Entity )
privatedelete
Entity& radix::Entity::operator= ( Entity &&  )
privatedelete
bool radix::Entity::operator== ( const Entity o) const
inline
void radix::Entity::removeComponent ( ComponentTypeId  id)
private
template<class T >
void radix::Entity::removeComponent ( )
inline
void radix::Entity::setName ( const std::string &  newName)

Friends And Related Function Documentation

friend class EntityManager
friend

Field Documentation

std::array<std::unique_ptr<Component>, Component::MaxId> radix::Entity::components
EntityId radix::Entity::id

Entity (instance) identifier.

Note
IDs are stable and may be used as permanent access keys, but consider using getName when not referring to a particular unique instance but rather any entity that has.
EntityManager& radix::Entity::manager
std::string radix::Entity::name
private

Entity's name.

Used to find a specific entity from the World entity list.


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