The Table Engine
component.cpp
Go to the documentation of this file.
1 #include <string>
2 #include <iostream>
3 
4 #include "component.h"
5 #include "gameobject.h"
6 
7 Component::Component() : m_name(""), m_owner(NULL) {}
8 Component::Component(std::string name) : m_name(name), m_owner(NULL) {}
10 
11 std::string Component::getName() {
12  return m_name;
13 }
14 
16  return m_owner;
17 }
18 
19 void Component::setName(std::string name) {
20  m_name = name;
21 }
22 
24  m_owner = owner;
25 }
26 
28 
29 }
30 
32 
33 }
34 
36 
37 }
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
Defines the Component base class for all components in the game engine.