SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
spark::core::details::AbstractGameObject< Impl > Class Template Reference

A CRTP class to implement a GameObject. It is used to wrap the onSpawn, onUpdate and onDestroyed methods to include custom code around user implementation. More...

#include <AbstractGameObject.h>

Inheritance diagram for spark::core::details::AbstractGameObject< Impl >:
spark::patterns::Composite< GameObject, GameObjectDeleter >

Public Member Functions

 AbstractGameObject (GameObject *parent=nullptr)
 
 AbstractGameObject (const AbstractGameObject &other)=delete
 
 AbstractGameObject (AbstractGameObject &&other) noexcept=default
 
AbstractGameObjectoperator= (const AbstractGameObject &other)=delete
 
AbstractGameObjectoperator= (AbstractGameObject &&other) noexcept=default
 
void onSpawn ()
 Method calling the corresponding method on the implementation, the children and components.
 
void onUpdate (float dt)
 Method calling the corresponding method on the implementation, the children and components.
 
void onDestroyed ()
 Method calling the corresponding method on the implementation, the children and components.
 
- Public Member Functions inherited from spark::patterns::Composite< GameObject, GameObjectDeleter >
 Composite (GameObject *parent)
 
 Composite (const Composite &other)=delete
 
 Composite (Composite &&other) noexcept=default
 
Compositeoperator= (const Composite &other)=delete
 
Compositeoperator= (Composite &&other) noexcept=default
 
std::vector< GameObject * > children () const
 
GameObject * parent ()
 
const GameObject * parent () const
 
GameObject * root ()
 
const GameObject * root () const
 

Friends

class spark::core::GameObject
 

Detailed Description

template<typename Impl>
class spark::core::details::AbstractGameObject< Impl >

A CRTP class to implement a GameObject. It is used to wrap the onSpawn, onUpdate and onDestroyed methods to include custom code around user implementation.

Template Parameters
ImplThe implementation of the GameObject.

Member Function Documentation

◆ onUpdate()

template<typename Impl >
void spark::core::details::AbstractGameObject< Impl >::onUpdate ( float dt)

Method calling the corresponding method on the implementation, the children and components.

Parameters
dtThe time in seconds since the last frame.