Loading...
Searching...
No Matches
hellfire::ScriptComponent Class Reference

#include <ScriptComponent.h>

Inheritance diagram for hellfire::ScriptComponent:
Collaboration diagram for hellfire::ScriptComponent:

Classes

struct  PropertyInfo
 

Public Types

enum class  PropertyType {
  FLOAT , INT , BOOL , STRING ,
  VEC2 , VEC3 , VEC4 , COLOR3 ,
  COLOR4 , TEXTURE , MATERIAL , ARRAY
}
 

Public Member Functions

 ScriptComponent ()=default
 
virtual ~ScriptComponent ()=default
 
const std::vector< PropertyInfo > & get_properties () const
 
virtual void on_init ()
 
virtual void on_update (float delta_time)
 
virtual void on_remove ()
 
virtual void on_event (const std::string &event_name, void *data=nullptr)
 
void init ()
 
void update (const float delta_time)
 
void remove ()
 
void trigger_event (const std::string &event_name, void *data=nullptr)
 
void set_enabled (const bool enabled)
 
bool is_enabled () const
 
TransformComponentget_transform () const
 
template<typename T >
bool has_component () const
 
template<typename T >
T * get_component () const
 
virtual const char * get_class_name () const
 
- Public Member Functions inherited from hellfire::Component
virtual ~Component ()=default
 
Entityget_owner () const
 
virtual void on_added (Entity *owner)
 
virtual void on_removed ()
 

Protected Member Functions

template<typename T >
void register_property (const std::string &name, T *ptr, PropertyType type)
 

Protected Attributes

std::vector< PropertyInfoproperties_
 
bool enabled_ = true
 

Detailed Description

Definition at line 29 of file ScriptComponent.h.

Member Enumeration Documentation

◆ PropertyType

Enumerator
FLOAT 
INT 
BOOL 
STRING 
VEC2 
VEC3 
VEC4 
COLOR3 
COLOR4 
TEXTURE 
MATERIAL 
ARRAY 

Definition at line 31 of file ScriptComponent.h.

Constructor & Destructor Documentation

◆ ScriptComponent()

hellfire::ScriptComponent::ScriptComponent ( )
default

◆ ~ScriptComponent()

virtual hellfire::ScriptComponent::~ScriptComponent ( )
virtualdefault

Member Function Documentation

◆ get_class_name()

virtual const char * hellfire::ScriptComponent::get_class_name ( ) const
inlinevirtual

Definition at line 100 of file ScriptComponent.h.

◆ get_component()

template<typename T >
T * hellfire::ScriptComponent::get_component ( ) const
inline

Definition at line 96 of file ScriptComponent.h.

◆ get_properties()

const std::vector< PropertyInfo > & hellfire::ScriptComponent::get_properties ( ) const
inline

Definition at line 60 of file ScriptComponent.h.

◆ get_transform()

TransformComponent * hellfire::ScriptComponent::get_transform ( ) const

Definition at line 9 of file ScriptComponent.cpp.

◆ has_component()

template<typename T >
bool hellfire::ScriptComponent::has_component ( ) const
inline

Definition at line 91 of file ScriptComponent.h.

◆ init()

void hellfire::ScriptComponent::init ( )
inline

Definition at line 76 of file ScriptComponent.h.

◆ is_enabled()

bool hellfire::ScriptComponent::is_enabled ( ) const
inline

Definition at line 84 of file ScriptComponent.h.

◆ on_event()

virtual void hellfire::ScriptComponent::on_event ( const std::string &  event_name,
void *  data = nullptr 
)
inlinevirtual

Definition at line 72 of file ScriptComponent.h.

◆ on_init()

virtual void hellfire::ScriptComponent::on_init ( )
inlinevirtual

Definition at line 63 of file ScriptComponent.h.

◆ on_remove()

virtual void hellfire::ScriptComponent::on_remove ( )
inlinevirtual

Definition at line 69 of file ScriptComponent.h.

◆ on_update()

virtual void hellfire::ScriptComponent::on_update ( float  delta_time)
inlinevirtual

Definition at line 66 of file ScriptComponent.h.

◆ register_property()

template<typename T >
void hellfire::ScriptComponent::register_property ( const std::string &  name,
T *  ptr,
PropertyType  type 
)
inlineprotected

Definition at line 50 of file ScriptComponent.h.

◆ remove()

void hellfire::ScriptComponent::remove ( )
inline

Definition at line 78 of file ScriptComponent.h.

◆ set_enabled()

void hellfire::ScriptComponent::set_enabled ( const bool  enabled)
inline

Definition at line 82 of file ScriptComponent.h.

◆ trigger_event()

void hellfire::ScriptComponent::trigger_event ( const std::string &  event_name,
void *  data = nullptr 
)
inline

Definition at line 80 of file ScriptComponent.h.

◆ update()

void hellfire::ScriptComponent::update ( const float  delta_time)
inline

Definition at line 77 of file ScriptComponent.h.

Member Data Documentation

◆ enabled_

bool hellfire::ScriptComponent::enabled_ = true
protected

Definition at line 54 of file ScriptComponent.h.

◆ properties_

std::vector<PropertyInfo> hellfire::ScriptComponent::properties_
protected

Definition at line 46 of file ScriptComponent.h.


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