dEngine
Simple 2D C++ game engine
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
dengine::GameState Class Reference

Manges and stores the current state of the game GameState is used to manage the current state of the game as a whole. A few game states that are built in reference whether the game is currently being played, at the gameover screen, or at the flash screen. More...

#include <GameStates.h>

Public Member Functions

 GameState ()
 
 ~GameState ()
 
int getGameState ()
 Retrieve the current gamestate. More...
 
void setGameState (int state)
 Set the game state. This can be done with an int or with the GAMESTATES enum. More...
 

Static Public Member Functions

static GameStateGetInstance ()
 

Private Attributes

int currentstate = GAMESTATES::Splash
 

Static Private Attributes

static GameState instance
 

Detailed Description

Manges and stores the current state of the game GameState is used to manage the current state of the game as a whole. A few game states that are built in reference whether the game is currently being played, at the gameover screen, or at the flash screen.

Constructor & Destructor Documentation

◆ GameState()

GameState::GameState ( )

◆ ~GameState()

GameState::~GameState ( )

Member Function Documentation

◆ getGameState()

int GameState::getGameState ( )

Retrieve the current gamestate.

See also
GAMESTATES
Returns
int that corrosponds to a game state in GAMESTATES

Referenced by dengine::Game::loop().

◆ GetInstance()

GameState & GameState::GetInstance ( )
static

◆ setGameState()

void GameState::setGameState ( int  state)

Set the game state. This can be done with an int or with the GAMESTATES enum.

See also
GAMESTATES
Parameters
stateThe current state of the game

Referenced by dengine::Game::Game(), and dengine::EventSystem::processEvents().

Member Data Documentation

◆ currentstate

int dengine::GameState::currentstate = GAMESTATES::Splash
private

Referenced by getGameState(), and setGameState().

◆ instance

GameState GameState::instance
staticprivate

Referenced by GetInstance().