My Project
Loading...
Searching...
No Matches
Engine::Component Class Referenceabstract

Base class for all components in the engine. Components define behavior that can be attached to a GameObject. More...

#include <Component.hpp>

Inheritance diagram for Engine::Component:
Engine::AssetComponent Engine::MeshComponent Engine::RigidBodyComponent Engine::TextureComponent Engine::Transform

Public Member Functions

virtual ~Component ()=default
 Virtual destructor to allow proper cleanup of derived components.
virtual void Start ()
 Called once when the component is first initialized.
virtual void Update (float dt)
 Called every frame to update the component logic.
virtual void OnDestroy ()
 Called when the component is destroyed or removed from the GameObject.
virtual std::string GetTypeName () const =0
 Returns the name of the component type. Useful for debugging, logging, or editor systems.

Public Attributes

GameObjectgameObject = nullptr
 Pointer to the GameObject that owns this component.

Protected Member Functions

 Component ()=default
 Protected constructor to prevent direct instantiation of the base class.

Detailed Description

Base class for all components in the engine. Components define behavior that can be attached to a GameObject.

Constructor & Destructor Documentation

◆ ~Component()

virtual Engine::Component::~Component ( )
virtualdefault

Virtual destructor to allow proper cleanup of derived components.

◆ Component()

Engine::Component::Component ( )
protecteddefault

Protected constructor to prevent direct instantiation of the base class.

Member Function Documentation

◆ GetTypeName()

virtual std::string Engine::Component::GetTypeName ( ) const
pure virtual

Returns the name of the component type. Useful for debugging, logging, or editor systems.

Returns
Component type name

Implemented in Engine::MeshComponent, Engine::RigidBodyComponent, Engine::TextureComponent, and Engine::Transform.

◆ OnDestroy()

virtual void Engine::Component::OnDestroy ( )
inlinevirtual

Called when the component is destroyed or removed from the GameObject.

Reimplemented in Engine::AssetComponent, Engine::MeshComponent, Engine::RigidBodyComponent, and Engine::TextureComponent.

◆ Start()

virtual void Engine::Component::Start ( )
inlinevirtual

Called once when the component is first initialized.

Reimplemented in Engine::AssetComponent, Engine::MeshComponent, Engine::RigidBodyComponent, and Engine::TextureComponent.

◆ Update()

virtual void Engine::Component::Update ( float dt)
inlinevirtual

Called every frame to update the component logic.

Parameters
dtDelta time between frames

Reimplemented in Engine::AssetComponent, Engine::MeshComponent, Engine::RigidBodyComponent, Engine::TextureComponent, and Engine::Transform.

Member Data Documentation

◆ gameObject

GameObject* Engine::Component::gameObject = nullptr

Pointer to the GameObject that owns this component.


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