Rune Engine  Version 0.2.7-alpha
Documentation for how to make games using the Rune Engine.
rune::GameObject Class Reference

Entity control system main object used for all objects in the scene. More...

#include <gameObject.h>

Inheritance diagram for rune::GameObject:
Collaboration diagram for rune::GameObject:

Public Member Functions

 GameObject ()
 Default empty constructor.
 
void addComponent (rune::Component &)
 Add a component to this game object. More...
 
int getNumComponents (void)
 Get the number of components present on this game object. More...
 
void instantiate (GameObject &)
 
std::vector< Component * > & getComponentList ()
 Return a pointer to a component based off of index. Used for iterating through all components. More...
 
template<class classVariable >
classVariable * getComponent ()
 
- Public Member Functions inherited from rune::Subject
void subscribe (Observer &newObserver)
 Tell the subject that an observer would like to be notified of signals. More...
 
bool unsubscribe (Observer &newObserver)
 Tell the subject that an observer would no longer like to be notified of signals. More...
 

Public Attributes

rune::Transform transform
 The location, scale, and rotation of the object in the world.
 

Additional Inherited Members

- Protected Member Functions inherited from rune::Subject
void sendSignal (Signal)
 Send a signal to all observers. More...
 
int getNumObservers (void)
 Get the number of observers subscribed to this subject. More...
 
- Protected Attributes inherited from rune::Subject
std::vector< Observer * > observers
 List of observers currently subscribed to this object.
 

Detailed Description

Entity control system main object used for all objects in the scene.

Author
Thomas Montano
Date
March 2 2020

Member Function Documentation

◆ addComponent()

void rune::GameObject::addComponent ( rune::Component newScript)

Add a component to this game object.

Parameters
newScriptThe new component to be added to the game object.

◆ getComponent()

template<class classVariable >
classVariable* rune::GameObject::getComponent ( )
inline

Locate components of the object based on data type Call the function like this: getComponent<rune::Sprite>();

Warning
Do not call this in a rune::GameObject constructor. Call it in either start() or update()

◆ getComponentList()

std::vector< rune::Component * > & rune::GameObject::getComponentList ( )

Return a pointer to a component based off of index. Used for iterating through all components.

Parameters
indexThe position in the components vector to be accessed.
Returns
A pointer to the component requested.

◆ getNumComponents()

int rune::GameObject::getNumComponents ( void  )

Get the number of components present on this game object.

Returns
The number of components currently attached to this game object.

◆ instantiate()

void rune::GameObject::instantiate ( rune::GameObject newObject)
Parameters
newObjectThe object that should be instantiated and copied.

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