Jagguar Game Engine
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
GameObject Class Reference

#include <GameObject.hpp>

Public Member Functions

 GameObject (std::string name)
 
 ~GameObject ()
 
void Update (SDL_Event e, int frame, std::vector< std::string > broadcastList)
 
void Render (SDL_Renderer *ren)
 
void AddComponent (Component *c)
 
void RemoveComponent (Component *c)
 
const std::vector< Component * > ListComponents ()
 
std::string GetName ()
 

Private Attributes

std::vector< Component * > m_components
 
std::string m_name
 

Detailed Description

A representation of any object in the game. Has minimal functionality on its own, holds a list of Component objects which handle all game-related tasks.

Constructor & Destructor Documentation

◆ GameObject()

GameObject::GameObject ( std::string  name)

Construct a new Game Object

Parameters
namethe name of the GameObject

◆ ~GameObject()

GameObject::~GameObject ( )

Destroy the Game Object

Member Function Documentation

◆ AddComponent()

void GameObject::AddComponent ( Component c)

Add a new Component to the GameObject.

Parameters
ca pointer to the Component to be added
Here is the caller graph for this function:

◆ GetName()

std::string GameObject::GetName ( )

Gets the name of the GameObject.

Returns
the name of the GameObject
Here is the caller graph for this function:

◆ ListComponents()

const std::vector< Component * > GameObject::ListComponents ( )

Gets a list of all components within the GameObject.

Returns
const std::vector<Component*>
Here is the caller graph for this function:

◆ RemoveComponent()

void GameObject::RemoveComponent ( Component c)

Remove a Component from the GameObject.

Parameters
ca pointer to the Component to be removed
Here is the caller graph for this function:

◆ Render()

void GameObject::Render ( SDL_Renderer *  ren)

Render all components within the GameObject.

Parameters
renthe renderer to be drawn to
See also
Engine::Render()
Component::Render()

◆ Update()

void GameObject::Update ( SDL_Event  e,
int  frame,
std::vector< std::string >  broadcastList 
)

Update all components within the GameObject.

Parameters
eany user input
framethe current frame
broadcastLista list of messages for components to talk to each other
See also
Engine::Update()
Component::Update()

The documentation for this class was generated from the following files: