Anvil Engine
Loading...
Searching...
No Matches
IComponent Class Referenceabstract

The IComponent class is an abstract base class that defines the interface for all components in the ANVIL engine. Components are modular parts that can be attached to entities to give them specific functionality. More...

#include <IComponent.h>

Inheritance diagram for IComponent:
MeshComponent RigidBodyComponent

Public Member Functions

virtual ~IComponent ()
 Virtual destructor for the IComponent class. Ensures proper cleanup of derived class objects when deleted through a base class pointer.
virtual void OnInit (AEntity *owner)=0
 Called when the component is initialized.
virtual void OnUpdate (float dt)=0
 Called once per frame to update the component's state.
virtual void OnRender (AShader *shader)=0
 Called to render the component.

Public Attributes

AEntitym_owner = nullptr
 Pointer to the entity that owns this component. This allows the component to access its parent entity and other components attached to it.

Detailed Description

The IComponent class is an abstract base class that defines the interface for all components in the ANVIL engine. Components are modular parts that can be attached to entities to give them specific functionality.

Constructor & Destructor Documentation

◆ ~IComponent()

virtual IComponent::~IComponent ( )
inlinevirtual

Virtual destructor for the IComponent class. Ensures proper cleanup of derived class objects when deleted through a base class pointer.

Member Function Documentation

◆ OnInit()

virtual void IComponent::OnInit ( AEntity * owner)
pure virtual

Called when the component is initialized.

Parameters
ownerA pointer to the AEntity that owns this component.

Implemented in MeshComponent, and RigidBodyComponent.

◆ OnRender()

virtual void IComponent::OnRender ( AShader * shader)
pure virtual

Called to render the component.

Parameters
shaderThe shader program to use for rendering.

Implemented in MeshComponent, and RigidBodyComponent.

◆ OnUpdate()

virtual void IComponent::OnUpdate ( float dt)
pure virtual

Called once per frame to update the component's state.

Parameters
dtThe time elapsed since the last frame, in seconds.

Implemented in MeshComponent, and RigidBodyComponent.

Member Data Documentation

◆ m_owner

AEntity* IComponent::m_owner = nullptr

Pointer to the entity that owns this component. This allows the component to access its parent entity and other components attached to it.


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