souleng
Game engine providing full Python scripting support
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
GameObject Struct Reference

Main unit of gameplay which contains and updated components. More...

#include <GameObject.hpp>

Inheritance diagram for GameObject:

Public Member Functions

std::weak_ptr< GameObjectGetThisPtr ()
 
virtual void Input ()
 Refreshes input for all components and children each frame.
 
virtual void Update (float dt)
 Runs Update on all components and children.
 
virtual void Render ()
 Renders all components and children.
 
template<typename T >
void AddComponent (std::shared_ptr< T > component)
 Adds a component of the specified type.
 
template<typename T >
std::shared_ptr< T > GetComponent ()
 Retrieves an existing component of the specified type, or nullptr if there is none.
 
void AddChild (std::shared_ptr< GameObject > child)
 Adds a child GameObject to this GameObject.
 
std::shared_ptr< GameObjectGetChildAtIndex (size_t idx)
 
void SetRenderable (bool renderable)
 
bool IsRenderable () const
 Queries if this GameObject can be rendered.
 
bool Intersects (std::shared_ptr< GameObject > e)
 

Protected Attributes

std::map< ComponentType, std::shared_ptr< Component > > mComponents
 
bool mRenderable {true}
 
std::vector< std::shared_ptr< GameObject > > mChildren
 

Detailed Description

Main unit of gameplay which contains and updated components.

Member Function Documentation

◆ GetChildAtIndex()

std::shared_ptr< GameObject > GameObject::GetChildAtIndex ( size_t idx)

Gets a specified child GameObject

Parameters
idxThe index of the child GameObject

◆ Intersects()

bool GameObject::Intersects ( std::shared_ptr< GameObject > e)

Determines the intersection between this GameObject and another

Parameters
eThe other GameObject in the potential collision

◆ SetRenderable()

void GameObject::SetRenderable ( bool renderable)

Changes whether or not this GameObject is being rendered

Parameters
renderableThe value to set

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