2D_Game_Engine
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
ComponentManager< T, > Class Template Reference

#include <entity.hpp>

Public Member Functions

void AddComponent (T &component, uint32_t uid)
 
void RemoveComponent (uint32_t uid)
 
T * GetComponent (uint32_t uid)
 
std::vector< T > & GetComponents ()
 
RectGetComponentAsRect (int index)
 
void Update (Scene *scene, float frame_time)
 
void Render (Scene *scene)
 

Public Attributes

std::vector< Tm_Components
 

Detailed Description

template<typename T, ComponentType< T > = 0>
class ComponentManager< T, >

Definition at line 356 of file entity.hpp.

Member Function Documentation

◆ AddComponent()

template<typename T , ComponentType< T > = 0>
void ComponentManager< T, >::AddComponent ( T & component,
uint32_t uid )
inline

Add a component to the entity with the given uid.

Definition at line 363 of file entity.hpp.

◆ GetComponent()

template<typename T , ComponentType< T > = 0>
T * ComponentManager< T, >::GetComponent ( uint32_t uid)
inline
Returns
pointer to the component with the given uid, or nullptr if not found

Definition at line 389 of file entity.hpp.

◆ GetComponentAsRect()

template<typename T , ComponentType< T > = 0>
Rect * ComponentManager< T, >::GetComponentAsRect ( int index)
inline
Returns
a pointer to the component found at the given index, converted to a Rect

Definition at line 407 of file entity.hpp.

◆ GetComponents()

template<typename T , ComponentType< T > = 0>
std::vector< T > & ComponentManager< T, >::GetComponents ( )
inline
Returns
a reference to the components vector

Definition at line 400 of file entity.hpp.

◆ RemoveComponent()

template<typename T , ComponentType< T > = 0>
void ComponentManager< T, >::RemoveComponent ( uint32_t uid)
inline

Remove the component with the given uid.

Definition at line 373 of file entity.hpp.

◆ Render()

template<typename T , ComponentType< T > = 0>
void ComponentManager< T, >::Render ( Scene * scene)

Renders all the components in the vector. Some components type don't need to be rendered.

◆ Update()

template<typename T , ComponentType< T > = 0>
void ComponentManager< T, >::Update ( Scene * scene,
float frame_time )

Updates all the components in the vector. Some components type don't need to be updated.

Member Data Documentation

◆ m_Components

template<typename T , ComponentType< T > = 0>
std::vector<T> ComponentManager< T, >::m_Components

Definition at line 358 of file entity.hpp.


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