Lums
|
This class defines a core. More...
#include <Core.hpp>
Public Member Functions | |
Window & | window () |
void | setWindow (Window *win) |
LUMS_EXPORTED void | start () |
LUMS_EXPORTED void | stop () |
template<typename T , typename... Args> | |
T & | push (Args...args) |
LUMS_EXPORTED void | pop () |
LUMS_EXPORTED void | remove (GameState *state) |
LUMS_EXPORTED void | clear () |
template<typename T , typename... Args> | |
T & | transition (Args...args) |
LUMS_EXPORTED bool | stateless () const |
LUMS_EXPORTED | ~Core () |
Friends | |
class | Singleton< Core > |
Additional Inherited Members | |
Static Public Member Functions inherited from lm::Singleton< Core > | |
static Core & | instance () |
Protected Member Functions inherited from lm::Singleton< Core > | |
Singleton ()=default | |
Singleton (const Singleton< Core > &)=delete | |
Singleton< Core > & | operator= (const Singleton< Core > &)=delete |
This class defines a core.
A core is composed of a window, a renderer, a state machine and a main loop. The goal of this class is to provide a simple, yet efficient way to handle the context of your game.
LUMS_EXPORTED lm::Core::~Core | ( | ) |
Core dtor
LUMS_EXPORTED void lm::Core::clear | ( | ) |
Clear the internal stack, and delete every element.
LUMS_EXPORTED void lm::Core::pop | ( | ) |
Pop the topmost State. If there is no state, it's a no-op.
|
inline |
Push a new State.
T | The class to be instanciated. Must inherit GameState. |
Args | Argument types. |
args | Argument instances. |
LUMS_EXPORTED void lm::Core::remove | ( | GameState * | state | ) |
Remove a state from the internal stack. If the state does not exist within the internal stack, it's a no-op.
state | The state to be removed |
|
inline |
Set the linked window
win | A pointer to a window |
LUMS_EXPORTED void lm::Core::start | ( | ) |
Start the core. This method will not return until Core::Stop have been called.
LUMS_EXPORTED bool lm::Core::stateless | ( | ) | const |
Check if the core is stateless.
LUMS_EXPORTED void lm::Core::stop | ( | ) |
Stop the core.
|
inline |
Do a transition. This method clear the stack, then push a new GameState.
T | A class to be instanciated. |
Args | Argument types. |
args | Argument instances. |
|
inline |
Get the window linked to the core. It's undefined behavior to call this method when no window is attached.