Engine
Frameworkcreatedbymeusableforthecreationofsimplegames.CurrentlysupportsOpenGL(Verysimple)andVulkan.
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
Engine::Entity Class Reference

This object is able a holder object for components. NOTE: only the EntitySystem is allowed to create this object. More...

#include <Entity.hpp>

Public Member Functions

virtual ~Entity ()=default
 
template<typename ComponentType >
eastl::weak_ptr< ComponentType > GetComponent ()
 This method allows you to get the first component of the given type. More...
 
template<typename ComponentType >
eastl::vector< eastl::weak_ptr< ComponentType > > GetComponents ()
 This method allows you to get all of the components of the given type. More...
 
eastl::vector< eastl::shared_ptr< Component > > GetAllComponents () const
 Returns all the components of this entity. More...
 
template<class ComponentType , class... Args>
eastl::weak_ptr< ComponentType > AddComponent (Args &&...args)
 Allows you to create a component of the given type. More...
 
template<class ComponentType , class... Args>
eastl::vector< eastl::weak_ptr< ComponentType > > AddComponents (size_t count, Args &&...args)
 Allows you to create X amount of components of the given type. More...
 
template<typename ComponentType >
void RemoveComponent (size_t amountToRemove=1)
 Allows X amount of components of the given type. More...
 
template<typename ComponentType >
void RemoveAllComponents ()
 Deletes all the components of the given type. More...
 
eastl::shared_ptr< EntityGetPointer () const
 Allows you to retrieve current shared pointer from the entity system. More...
 
virtual void Update ()
 The general update method of the Entity class. More...
 
size_t ComponentCount () const
 Returns the amount of components on this entity. More...
 
uint64_t GetID () const
 Returns the currently assigned ID of this entity. More...
 
bool GetIsActive () const
 This method will return the active state of this entity. More...
 
void SetIsActive (bool isActive)
 This method will allow you to change the active state of this entity. More...
 

Public Attributes

eastl::string name
 The name of this entity. More...
 

Protected Member Functions

 Entity (eastl::string name="")
 
virtual void InitializeEntity ()
 

Protected Attributes

uint64_t Id
 
eastl::vector< eastl::shared_ptr< Component > > components
 

Friends

class EntitySystem
 
class Map
 
class EntityContact
 

Detailed Description

This object is able a holder object for components. NOTE: only the EntitySystem is allowed to create this object.

Definition at line 13 of file Entity.hpp.

Constructor & Destructor Documentation

virtual Engine::Entity::~Entity ( )
virtualdefault
Engine::Entity::Entity ( eastl::string  name = "")
explicitprotected

Definition at line 7 of file Entity.cpp.

Member Function Documentation

template<class ComponentType , class... Args>
eastl::weak_ptr< ComponentType > Engine::Entity::AddComponent ( Args &&...  args)

Allows you to create a component of the given type.

Parameters
...argsThe arguments required to initialize the component.
Returns
Returns the just created component of the given type as a weak pointer.

Definition at line 161 of file Entity.hpp.

template<class ComponentType , class... Args>
eastl::vector< eastl::weak_ptr< ComponentType > > Engine::Entity::AddComponents ( size_t  count,
Args &&...  args 
)

Allows you to create X amount of components of the given type.

Parameters
countThe amount of components you want to add of this given type.
...argsThe arguments required to initialize the components.
Returns
Returns a vector of the just created components of the given type as a vector of weak pointers.

Definition at line 180 of file Entity.hpp.

size_t Engine::Entity::ComponentCount ( ) const

Returns the amount of components on this entity.

Returns

Definition at line 39 of file Entity.cpp.

eastl::vector< eastl::shared_ptr< Component > > Engine::Entity::GetAllComponents ( ) const

Returns all the components of this entity.

Returns
Returns a vector of all the components of this entity.

Definition at line 15 of file Entity.cpp.

template<typename ComponentType >
eastl::weak_ptr< ComponentType > Engine::Entity::GetComponent ( )

This method allows you to get the first component of the given type.

Returns
Returns the first component of the given type as a weak pointer.

Definition at line 134 of file Entity.hpp.

template<typename ComponentType >
eastl::vector< eastl::weak_ptr< ComponentType > > Engine::Entity::GetComponents ( )

This method allows you to get all of the components of the given type.

Returns
Returns the all of the components of the given type as a weak pointer.

Definition at line 147 of file Entity.hpp.

uint64_t Engine::Entity::GetID ( ) const

Returns the currently assigned ID of this entity.

Returns

Definition at line 44 of file Entity.cpp.

bool Engine::Entity::GetIsActive ( ) const

This method will return the active state of this entity.

Returns
Returns true if this entity is active.

Definition at line 49 of file Entity.cpp.

eastl::shared_ptr< Entity > Engine::Entity::GetPointer ( ) const

Allows you to retrieve current shared pointer from the entity system.

Returns

Definition at line 20 of file Entity.cpp.

void Engine::Entity::InitializeEntity ( )
protectedvirtual

Definition at line 11 of file Entity.cpp.

template<typename ComponentType >
void Engine::Entity::RemoveAllComponents ( )

Deletes all the components of the given type.

Definition at line 225 of file Entity.hpp.

template<typename ComponentType >
void Engine::Entity::RemoveComponent ( size_t  amountToRemove = 1)

Allows X amount of components of the given type.

Parameters
amountToRemoveWill remove 1 component by default, can be change optionally.

Definition at line 205 of file Entity.hpp.

void Engine::Entity::SetIsActive ( bool  isActive)

This method will allow you to change the active state of this entity.

Parameters
isActiveThis value will define if this entity will be active or not.

Definition at line 54 of file Entity.cpp.

void Engine::Entity::Update ( )
virtual

The general update method of the Entity class.

Definition at line 25 of file Entity.cpp.

Friends And Related Function Documentation

friend class EntityContact
friend

Definition at line 128 of file Entity.hpp.

friend class EntitySystem
friend

Definition at line 114 of file Entity.hpp.

friend class Map
friend

Definition at line 115 of file Entity.hpp.

Member Data Documentation

eastl::vector<eastl::shared_ptr<Component> > Engine::Entity::components
protected

Definition at line 116 of file Entity.hpp.

uint64_t Engine::Entity::Id
protected

Definition at line 113 of file Entity.hpp.

eastl::string Engine::Entity::name

The name of this entity.

Definition at line 98 of file Entity.hpp.


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