The Table Engine
|
Base class for all game components, providing basic component functionalities. More...
#include <component.h>
Public Member Functions | |
Component () | |
Default constructor for the Component. More... | |
Component (std::string name) | |
Constructs a Component with a specified name. More... | |
virtual | ~Component () |
Virtual destructor for safe polymorphic use. More... | |
std::string | getName () |
Retrieves the name of the component. More... | |
GameObject * | getOwner () |
Retrieves the GameObject that owns this component. More... | |
void | setName (std::string name) |
Sets the name of the component. More... | |
void | setOwner (GameObject *owner) |
Sets the GameObject owner of this component. More... | |
virtual void | input () |
Virtual method for handling input, intended to be overridden by derived components. More... | |
virtual void | update () |
Virtual method for updating the component's state, intended to be overridden by derived components. More... | |
virtual void | render () |
Virtual method for rendering, intended to be overridden by derived components. More... | |
Protected Attributes | |
std::string | m_name |
Name of the component, useful for identification or debugging. More... | |
GameObject * | m_owner |
Pointer to the GameObject that owns this component. More... | |
Base class for all game components, providing basic component functionalities.
This class defines the interface and common functionalities for all components that can be attached to GameObjects. Components can manipulate or extend the capabilities of GameObjects by overriding input, update, and render methods.
Definition at line 24 of file component.h.
Component::Component | ( | ) |
Default constructor for the Component.
Definition at line 7 of file component.cpp.
Component::Component | ( | std::string | name | ) |
Constructs a Component with a specified name.
name | Name of the component. |
Definition at line 8 of file component.cpp.
|
virtual |
Virtual destructor for safe polymorphic use.
Definition at line 9 of file component.cpp.
std::string Component::getName | ( | ) |
Retrieves the name of the component.
Definition at line 11 of file component.cpp.
GameObject * Component::getOwner | ( | ) |
Retrieves the GameObject that owns this component.
Definition at line 15 of file component.cpp.
|
virtual |
Virtual method for handling input, intended to be overridden by derived components.
Definition at line 27 of file component.cpp.
|
virtual |
Virtual method for rendering, intended to be overridden by derived components.
Reimplemented in Texture, AnimationsManager, and Collide.
Definition at line 35 of file component.cpp.
void Component::setName | ( | std::string | name | ) |
Sets the name of the component.
name | New name for the component. |
Definition at line 19 of file component.cpp.
void Component::setOwner | ( | GameObject * | owner | ) |
Sets the GameObject owner of this component.
owner | Pointer to the GameObject to become the new owner. |
Definition at line 23 of file component.cpp.
|
virtual |
Virtual method for updating the component's state, intended to be overridden by derived components.
Reimplemented in Texture, Input, AnimationsManager, Animation, Transform, Collide, and Camera.
Definition at line 31 of file component.cpp.
|
protected |
Name of the component, useful for identification or debugging.
Definition at line 27 of file component.h.
|
protected |
Pointer to the GameObject that owns this component.
Definition at line 28 of file component.h.