Level H Engine
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
GameObject Class Reference

Contains details and functions for the game object. More...

#include <GameObject.h>

Inheritance diagram for GameObject:
Inheritance graph
Collaboration diagram for GameObject:
Collaboration graph

Public Member Functions

 GameObject (std::string name)
 Constructs Application. More...
 
virtual ~GameObject ()
 Destructs GameObject (virtual). More...
 
template<class T >
std::weak_ptr< T > addComponent ()
 A template for adding components to the components vector. More...
 
template<class T >
std::weak_ptr< T > getComponent ()
 A template for getting a component from the components vector. More...
 
void setName (std::string inName)
 A function to set the name of the game object. More...
 
std::string getName ()
 A function to get the name of the game object. More...
 
virtual void awake ()
 A virtual function for the game objects awake. More...
 
virtual void update ()
 A virtual function for the game objects update. More...
 
virtual void render ()
 A virtual function for the game objects render. More...
 
virtual void destroy ()
 A virtual function for the game objects destroy. More...
 
void setDestroyed (bool inDestroyed)
 A function to set the componets destroyed boolean. More...
 
bool getDestroyed ()
 A function to get the componets destroyed boolean. More...
 
bool checkForComponent (std::string id)
 A function to check the if the game object has a specific componet. More...
 

Static Public Member Functions

static std::weak_ptr< GameObjectcreate (std::string name)
 A static function to create a game object. More...
 

Private Attributes

std::string name
 The name of the game object. More...
 
std::vector< std::shared_ptr< Component > > components
 A vector of components attached to the game object. More...
 
std::vector< std::string > componentIDs
 A vector of the component ID's contained in the game object. More...
 
bool destroyed
 A boolean for if the game object is destroyed. More...
 

Detailed Description

Contains details and functions for the game object.

Constructor & Destructor Documentation

◆ GameObject()

GameObject::GameObject ( std::string  name)

Constructs Application.

Parameters
nameThe name of the game object.

◆ ~GameObject()

GameObject::~GameObject ( )
virtual

Destructs GameObject (virtual).

Member Function Documentation

◆ addComponent()

template<class T >
std::weak_ptr<T> GameObject::addComponent ( )
inline

A template for adding components to the components vector.

◆ awake()

void GameObject::awake ( )
virtual

A virtual function for the game objects awake.

Here is the caller graph for this function:

◆ checkForComponent()

bool GameObject::checkForComponent ( std::string  id)

A function to check the if the game object has a specific componet.

Parameters
idThe type ID of the component to check for.
Returns
If the game object contains the component.
Here is the caller graph for this function:

◆ create()

std::weak_ptr< GameObject > GameObject::create ( std::string  name)
static

A static function to create a game object.

Parameters
nameThe name to give to the game object.
Returns
A weak pointer to the created game object.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ destroy()

void GameObject::destroy ( )
virtual

A virtual function for the game objects destroy.

Here is the caller graph for this function:

◆ getComponent()

template<class T >
std::weak_ptr<T> GameObject::getComponent ( )
inline

A template for getting a component from the components vector.

Here is the call graph for this function:

◆ getDestroyed()

bool GameObject::getDestroyed ( )
inline

A function to get the componets destroyed boolean.

Returns
The boolean for the state of destroyed.
Here is the call graph for this function:

◆ getName()

std::string GameObject::getName ( )
inline

A function to get the name of the game object.

Parameters
Thename of the game object.
Here is the call graph for this function:

◆ render()

void GameObject::render ( )
virtual

A virtual function for the game objects render.

Here is the caller graph for this function:

◆ setDestroyed()

void GameObject::setDestroyed ( bool  inDestroyed)
inline

A function to set the componets destroyed boolean.

Parameters
inDestroyedA boolean for the state of destroyed.

◆ setName()

void GameObject::setName ( std::string  inName)
inline

A function to set the name of the game object.

Parameters
inNameThe name to give to the game object.

◆ update()

void GameObject::update ( )
virtual

A virtual function for the game objects update.

Here is the caller graph for this function:

Member Data Documentation

◆ componentIDs

std::vector< std::string > GameObject::componentIDs
private

A vector of the component ID's contained in the game object.

◆ components

std::vector< std::shared_ptr<Component> > GameObject::components
private

A vector of components attached to the game object.

◆ destroyed

bool GameObject::destroyed
private

A boolean for if the game object is destroyed.

◆ name

std::string GameObject::name
private

The name of the game object.


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