The Table Engine
component.h
Go to the documentation of this file.
1 #pragma once
2 
3 class GameObject;
4 
5 #include <string>
6 
24 class Component
25 {
26 protected:
27  std::string m_name;
29 
30 public:
34  Component();
35 
40  Component(std::string name);
41 
45  virtual ~Component();
46 
51  std::string getName();
52 
58 
63  void setName(std::string name);
64 
69  void setOwner(GameObject* owner);
70 
74  virtual void input();
75 
79  virtual void update();
80 
84  virtual void render();
85 };
Base class for all game components, providing basic component functionalities.
Definition: component.h:25
GameObject * m_owner
Pointer to the GameObject that owns this component.
Definition: component.h:28
void setName(std::string name)
Sets the name of the component.
Definition: component.cpp:19
virtual void render()
Virtual method for rendering, intended to be overridden by derived components.
Definition: component.cpp:35
virtual void update()
Virtual method for updating the component's state, intended to be overridden by derived components.
Definition: component.cpp:31
Component()
Default constructor for the Component.
Definition: component.cpp:7
std::string m_name
Name of the component, useful for identification or debugging.
Definition: component.h:27
virtual ~Component()
Virtual destructor for safe polymorphic use.
Definition: component.cpp:9
std::string getName()
Retrieves the name of the component.
Definition: component.cpp:11
virtual void input()
Virtual method for handling input, intended to be overridden by derived components.
Definition: component.cpp:27
GameObject * getOwner()
Retrieves the GameObject that owns this component.
Definition: component.cpp:15
void setOwner(GameObject *owner)
Sets the GameObject owner of this component.
Definition: component.cpp:23
Core class representing an entity in the game world.
Definition: gameobject.h:20