Represents a game object within a scene.
More...
|
| | this (string name, Scene *scene) |
| | Constructs a GameObject with the given name and scene.
|
| |
|
| ~this () |
| | Destructor for GameObject.
|
| |
| string | GetName () const |
| | Gets the name of the game object.
|
| |
| size_t | GetID () const |
| | Gets the ID of the game object.
|
| |
| Scene * | GetScene () |
| | Gets the scene that owns this game object.
|
| |
|
void | Update () |
| | Updates the game object by updating all its components.
|
| |
|
void | Input () |
| | Handles input for the game object by delegating to its components.
|
| |
| void | Render (SDL_Renderer *renderer) |
| | Renders the game object by delegating to its components.
|
| |
| | ComponentForType (T) GetComponent(ComponentType T)() const |
| | Gets a component of the specified type.
|
| |
| void | AddComponent (ComponentType T)(IComponent component) |
| | Adds a component to the game object.
|
| |
| bool | HasComponent (ComponentType T)() const |
| | Checks if the game object has a component of the specified type.
|
| |
|
|
IComponent[ComponentType] | mComponents |
| | Common components for all game objects.
|
| |
Represents a game object within a scene.
◆ this()
| GameObject::this |
( |
string | name, |
|
|
Scene * | scene ) |
|
inline |
Constructs a GameObject with the given name and scene.
- Parameters
-
| name | Name of the game object. |
| scene | Pointer to the scene that owns this game object. |
◆ AddComponent()
| void GameObject::AddComponent |
( |
ComponentType | T | ) |
|
|
inline |
Adds a component to the game object.
- Parameters
-
| T | The type of the component to add. |
| component | The component to add. |
◆ ComponentForType()
| GameObject::ComponentForType |
( |
T | | ) |
const |
|
inline |
Gets a component of the specified type.
- Parameters
-
| T | The type of the component to get. |
- Returns
- The component of the specified type.
◆ GetID()
| size_t GameObject::GetID |
( |
| ) |
const |
|
inline |
Gets the ID of the game object.
- Returns
- The ID of the game object.
◆ GetName()
| string GameObject::GetName |
( |
| ) |
const |
|
inline |
Gets the name of the game object.
- Returns
- The name of the game object.
◆ GetScene()
| Scene * GameObject::GetScene |
( |
| ) |
|
|
inline |
Gets the scene that owns this game object.
- Returns
- Pointer to the scene that owns this game object.
◆ HasComponent()
| bool GameObject::HasComponent |
( |
ComponentType | T | ) |
const |
|
inline |
Checks if the game object has a component of the specified type.
- Parameters
-
| T | The type of the component to check for. |
- Returns
- True if the game object has the component, false otherwise.
◆ Render()
| void GameObject::Render |
( |
SDL_Renderer * | renderer | ) |
|
|
inline |
Renders the game object by delegating to its components.
- Parameters
-
| renderer | Pointer to the SDL renderer. |
The documentation for this struct was generated from the following file: