Lums
Public Member Functions | Friends | List of all members
lm::Core Class Reference

This class defines a core. More...

#include <Core.hpp>

Inheritance diagram for lm::Core:
lm::Singleton< Core >

Public Member Functions

Windowwindow ()
 
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 Coreinstance ()
 
- Protected Member Functions inherited from lm::Singleton< Core >
 Singleton ()=default
 
 Singleton (const Singleton< Core > &)=delete
 
Singleton< Core > & operator= (const Singleton< Core > &)=delete
 

Detailed Description

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.

Constructor & Destructor Documentation

LUMS_EXPORTED lm::Core::~Core ( )

Core dtor

Member Function Documentation

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.

template<typename T , typename... Args>
T& lm::Core::push ( Args...  args)
inline

Push a new State.

Template Parameters
TThe class to be instanciated. Must inherit GameState.
ArgsArgument types.
Parameters
argsArgument instances.
Returns
A reference to the constructed object.
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.

Parameters
stateThe state to be removed
void lm::Core::setWindow ( Window win)
inline

Set the linked window

Parameters
winA 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.

Returns
True if the core is stateless
LUMS_EXPORTED void lm::Core::stop ( )

Stop the core.

template<typename T , typename... Args>
T& lm::Core::transition ( Args...  args)
inline

Do a transition. This method clear the stack, then push a new GameState.

Template Parameters
TA class to be instanciated.
ArgsArgument types.
Parameters
argsArgument instances.
Returns
A reference to the constructed object.
Window& lm::Core::window ( )
inline

Get the window linked to the core. It's undefined behavior to call this method when no window is attached.

Returns
A reference to the linked window

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