Loading...
Searching...
No Matches
hellfire::Entity Class Reference
Collaboration diagram for hellfire::Entity:

Public Member Functions

virtual ~Entity ()=default
 
 Entity (const EntityID id, const std::string &name)
 
 Entity (const std::string &name)
 
uint32_t get_id () const
 
const std::string & get_name () const
 
void set_name (const std::string &name)
 
template<ComponentType T, typename... Args>
T * add_component (Args &&... args)
 
template<ComponentType T>
T * get_component () const
 
template<ComponentType T>
bool has_component () const
 
template<ComponentType T>
bool remove_component ()
 
const std::vector< ScriptComponent * > & get_script_components () const
 
void initialize_scripts () const
 
void update_scripts (float delta_time) const
 
void cleanup_scripts () const
 
void broadcast_event (const std::string &event_name, void *data=nullptr) const
 
template<ScriptComponentType T>
void send_event_to_script (const std::string &event_name, void *data=nullptr)
 
TransformComponenttransform ()
 
const TransformComponenttransform () const
 
template<ComponentType T, typename... Args>
T * add_component (Args &&... args)
 
template<ComponentType T>
T * get_component () const
 
template<ComponentType T>
bool remove_component ()
 
template<ScriptComponentType T>
void send_event_to_script (const std::string &event_name, void *data)
 
template<ComponentType T, typename... Args>
T * add_component (Args &&... args)
 
template<ComponentType T>
T * get_component () const
 
template<ComponentType T>
bool remove_component ()
 
template<ScriptComponentType T>
void send_event_to_script (const std::string &event_name, void *data)
 

Private Attributes

EntityID id_
 
std::string name_
 
std::unordered_map< std::type_index, std::unique_ptr< Component > > components_
 
std::vector< ScriptComponent * > script_components_
 

Detailed Description

Definition at line 33 of file Entity.h.

Constructor & Destructor Documentation

◆ ~Entity()

virtual hellfire::Entity::~Entity ( )
virtualdefault

◆ Entity() [1/2]

hellfire::Entity::Entity ( const EntityID  id,
const std::string &  name 
)
inlineexplicit

Definition at line 37 of file Entity.h.

◆ Entity() [2/2]

hellfire::Entity::Entity ( const std::string &  name)
inlineexplicit

Definition at line 41 of file Entity.h.

Member Function Documentation

◆ add_component() [1/3]

template<ComponentType T, typename... Args>
T * hellfire::Entity::add_component ( Args &&...  args)

◆ add_component() [2/3]

template<ComponentType T, typename... Args>
T * hellfire::Entity::add_component ( Args &&...  args)

Definition at line 8 of file Entity.inl.

◆ add_component() [3/3]

template<ComponentType T, typename... Args>
T * hellfire::Entity::add_component ( Args &&...  args)

Definition at line 8 of file Entity.inl.

◆ broadcast_event()

void hellfire::Entity::broadcast_event ( const std::string &  event_name,
void *  data = nullptr 
) const

Definition at line 36 of file Entity.cpp.

◆ cleanup_scripts()

void hellfire::Entity::cleanup_scripts ( ) const

Definition at line 30 of file Entity.cpp.

◆ get_component() [1/3]

template<ComponentType T>
T * hellfire::Entity::get_component ( ) const

◆ get_component() [2/3]

template<ComponentType T>
T * hellfire::Entity::get_component ( ) const

Definition at line 27 of file Entity.inl.

◆ get_component() [3/3]

template<ComponentType T>
T * hellfire::Entity::get_component ( ) const

Definition at line 27 of file Entity.inl.

◆ get_id()

uint32_t hellfire::Entity::get_id ( ) const
inline

Definition at line 45 of file Entity.h.

◆ get_name()

const std::string & hellfire::Entity::get_name ( ) const
inline

Definition at line 46 of file Entity.h.

◆ get_script_components()

const std::vector< ScriptComponent * > & hellfire::Entity::get_script_components ( ) const

Definition at line 11 of file Entity.cpp.

◆ has_component()

template<ComponentType T>
bool hellfire::Entity::has_component ( ) const
inline

Definition at line 57 of file Entity.h.

◆ initialize_scripts()

void hellfire::Entity::initialize_scripts ( ) const

Definition at line 16 of file Entity.cpp.

◆ remove_component() [1/3]

template<ComponentType T>
bool hellfire::Entity::remove_component ( )

◆ remove_component() [2/3]

template<ComponentType T>
bool hellfire::Entity::remove_component ( )

Definition at line 35 of file Entity.inl.

◆ remove_component() [3/3]

template<ComponentType T>
bool hellfire::Entity::remove_component ( )

Definition at line 35 of file Entity.inl.

◆ send_event_to_script() [1/3]

template<ScriptComponentType T>
void hellfire::Entity::send_event_to_script ( const std::string &  event_name,
void *  data 
)

Definition at line 60 of file Entity.inl.

◆ send_event_to_script() [2/3]

template<ScriptComponentType T>
void hellfire::Entity::send_event_to_script ( const std::string &  event_name,
void *  data 
)

Definition at line 60 of file Entity.inl.

◆ send_event_to_script() [3/3]

template<ScriptComponentType T>
void hellfire::Entity::send_event_to_script ( const std::string &  event_name,
void *  data = nullptr 
)

◆ set_name()

void hellfire::Entity::set_name ( const std::string &  name)
inline

Definition at line 47 of file Entity.h.

◆ transform() [1/2]

TransformComponent * hellfire::Entity::transform ( )

Definition at line 42 of file Entity.cpp.

◆ transform() [2/2]

const TransformComponent * hellfire::Entity::transform ( ) const

Definition at line 52 of file Entity.cpp.

◆ update_scripts()

void hellfire::Entity::update_scripts ( float  delta_time) const

Definition at line 22 of file Entity.cpp.

Member Data Documentation

◆ components_

std::unordered_map<std::type_index, std::unique_ptr<Component> > hellfire::Entity::components_
private

Definition at line 87 of file Entity.h.

◆ id_

EntityID hellfire::Entity::id_
private

Definition at line 85 of file Entity.h.

◆ name_

std::string hellfire::Entity::name_
private

Definition at line 86 of file Entity.h.

◆ script_components_

std::vector<ScriptComponent *> hellfire::Entity::script_components_
private

Definition at line 88 of file Entity.h.


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