The Table Engine
script.h
Go to the documentation of this file.
1 #pragma once
2 
11 #include <string>
12 
13 class GameObject; // Forward declaration to avoid circular dependency.
14 
22 class Script {
23  public:
24  std::string m_name;
26 
30  Script();
31 
36  Script(std::string name);
37 
41  virtual ~Script();
42 
47  std::string getName();
48 
54 
59  void setOwner(GameObject* owner);
60 
64  virtual void input();
65 
69  virtual void update();
70 
74  virtual void render();
75 };
Core class representing an entity in the game world.
Definition: gameobject.h:20
Base class for scripting custom behaviors in game objects.
Definition: script.h:22
Script()
Default constructor, initializes an empty script.
Definition: script.cpp:5
void setOwner(GameObject *owner)
Sets the owner of this script.
Definition: script.cpp:17
virtual void input()
Virtual method for handling input. Should be overridden by derived classes.
Definition: script.cpp:21
std::string getName()
Retrieves the name of the script.
Definition: script.cpp:9
virtual ~Script()
Virtual destructor to allow for cleanup in derived script classes.
Definition: script.cpp:7
std::string m_name
Name of the script, useful for identification or debugging.
Definition: script.h:24
virtual void render()
Virtual method for rendering operations. Should be overridden by derived classes.
Definition: script.cpp:27
GameObject * getOwner()
Retrieves the owner GameObject of this script.
Definition: script.cpp:13
GameObject * m_owner
Pointer to the GameObject that owns this script.
Definition: script.h:25
virtual void update()
Virtual method for updating the script's state. Should be overridden by derived classes.
Definition: script.cpp:24