Claire's Game Engine
Full C++ Engine using OpenGL
Loading...
Searching...
No Matches
Component Class Reference

Base class for all components that can be attached to an Actor. Components define behavior or functionality and are updated each frame. They can respond to events such as start, update, end, or world transform changes. More...

#include <Component.h>

Inheritance diagram for Component:
ColliderComponent MoveComponent RenderComponent Transform BoxColliderComponent RectangleColliderComponent EditorController PlayerController MeshComponent RectangleRenderComponent SpriteRenderComponent AnimatedSpriteRenderComponent

Public Member Functions

 Component (Actor *pOwner, int pUpdateOrder=100)
 Constructor for Component.
 
virtual ~Component ()
 
virtual void OnStart ()
 Called when the component is initialized (during actor start). This can be used to perform any setup operations for the component.
 
virtual void Update ()
 Called every frame to update the component. This can be used to perform actions that need to be updated periodically.
 
virtual void OnEnd ()
 Called when the component is about to be destroyed (during actor destruction). This can be used to clean up or release any resources.
 
virtual void OnUpdateWorldTrandform ()
 Called when the world transform of the actor is updated. This allows the component to react to changes in the actor's world transform.
 
void SetActive (bool isActive)
 Sets the active status of the component.
 
void SetOwner (Actor *pOwner)
 Sets the actor that owns this component.
 
int GetUpdateOrder () const
 Returns the update order of the component. Components with lower update orders are updated first.
 
ActorGetOwner () const
 Returns the actor that owns this component.
 

Protected Attributes

ActormOwner = nullptr
 The actor that owns this component.
 

Detailed Description

Base class for all components that can be attached to an Actor. Components define behavior or functionality and are updated each frame. They can respond to events such as start, update, end, or world transform changes.

Constructor & Destructor Documentation

◆ Component()

Component::Component ( Actor * pOwner,
int pUpdateOrder = 100 )

Constructor for Component.

Parameters
pOwnerThe actor that owns this component.
pUpdateOrderThe update order priority for the component (default: 100).

◆ ~Component()

virtual Component::~Component ( )
inlinevirtual

Member Function Documentation

◆ GetOwner()

Actor * Component::GetOwner ( ) const

Returns the actor that owns this component.

Returns
The actor that owns this component.

◆ GetUpdateOrder()

int Component::GetUpdateOrder ( ) const

Returns the update order of the component. Components with lower update orders are updated first.

Returns
The update order of the component.

◆ OnEnd()

virtual void Component::OnEnd ( )
inlinevirtual

Called when the component is about to be destroyed (during actor destruction). This can be used to clean up or release any resources.

Reimplemented in ColliderComponent, and RenderComponent.

◆ OnStart()

virtual void Component::OnStart ( )
inlinevirtual

Called when the component is initialized (during actor start). This can be used to perform any setup operations for the component.

Reimplemented in ColliderComponent, and RenderComponent.

◆ OnUpdateWorldTrandform()

virtual void Component::OnUpdateWorldTrandform ( )
inlinevirtual

Called when the world transform of the actor is updated. This allows the component to react to changes in the actor's world transform.

◆ SetActive()

void Component::SetActive ( bool isActive)

Sets the active status of the component.

Parameters
isActiveWhether the component should be active or not.

◆ SetOwner()

void Component::SetOwner ( Actor * pOwner)

Sets the actor that owns this component.

Parameters
pOwnerThe actor to assign as the owner of this component.

◆ Update()

virtual void Component::Update ( )
inlinevirtual

Called every frame to update the component. This can be used to perform actions that need to be updated periodically.

Reimplemented in AnimatedSpriteRenderComponent, EditorController, and MoveComponent.

Member Data Documentation

◆ mOwner

Actor* Component::mOwner = nullptr
protected

The actor that owns this component.


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