Muto 0.0.1
Cross-Platform Application Template
GitHub Repo | Muto Updates | Muto's Author
Loading...
Searching...
No Matches
Muto::ScriptableEntity Class Reference

Base class for scriptable entities within a scene. More...

#include <ScriptableEntity.h>

Public Member Functions

template<typename T >
T & GetComponent ()
 Retrieves a reference to a component of type T attached to the entity.
 
virtual ~ScriptableEntity ()
 

Protected Member Functions

virtual void OnCreate ()
 Sets the entity associated with this scriptable entity.
 
virtual void OnDestroy ()
 Called when the entity is destroyed.
 
virtual void OnUpdate (Timestep ts)
 Called every frame to update the entity.
 

Private Attributes

Entity m_Entity
 

Friends

class Scene
 

Detailed Description

Base class for scriptable entities within a scene.

A ScriptableEntity allows for custom behavior to be defined for entities in a scene, not already provided as standardized components.

Constructor & Destructor Documentation

◆ ~ScriptableEntity()

virtual Muto::ScriptableEntity::~ScriptableEntity ( )
inlinevirtual
16{};

Member Function Documentation

◆ GetComponent()

template<typename T >
T & Muto::ScriptableEntity::GetComponent ( )
inline

Retrieves a reference to a component of type T attached to the entity.

Template Parameters
TThe type of the component to retrieve.
Returns
Reference to the component of type T. Will assert if the component does not exist.
25 {
26 return m_Entity.GetComponent<T>();
27 }
T & GetComponent()
Retrieves a reference to the component of type T attached to the entity if it exists....
Definition Entity.h:73
Entity m_Entity
Definition ScriptableEntity.h:48
@ T
Definition KeyCodes.h:60

References m_Entity.

◆ OnCreate()

virtual void Muto::ScriptableEntity::OnCreate ( )
inlineprotectedvirtual

Sets the entity associated with this scriptable entity.

Meant for internal use by the Scene class. Should be overridden in derived classes if additional setup is required when the entity is set.

34{}

◆ OnDestroy()

virtual void Muto::ScriptableEntity::OnDestroy ( )
inlineprotectedvirtual

Called when the entity is destroyed.

Meant for internal use by the Scene class. Should be overridden in derived classes to handle cleanup.

40{}

◆ OnUpdate()

virtual void Muto::ScriptableEntity::OnUpdate ( Timestep  ts)
inlineprotectedvirtual

Called every frame to update the entity.

Parameters
tsThe timestep representing the time elapsed since the last update. Custom behavior should be implemented here in derived classes.
46{}

Friends And Related Symbol Documentation

◆ Scene

friend class Scene
friend

Member Data Documentation

◆ m_Entity

Entity Muto::ScriptableEntity::m_Entity
private

Referenced by GetComponent().


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