GEJM  1.0.0.0
a 2D platformer made by students
Public Member Functions | List of all members
Game Class Reference

#include <Game.h>

Public Member Functions

 Game ()
 
 ~Game ()
 
void gameLoop ()
 
void startGame ()
 
void pauseGame ()
 
void resumeGame ()
 
void quitToMenu ()
 
void gameOver ()
 
void wonGame ()
 
void loadLevel ()
 
void unloadLevel ()
 
GameState getGameState () const
 
PlayerControllergetPlayerController () const
 
bool getHasEnded () const
 
bool getPosUpdated () const
 
int getLevelWidth () const
 
int getLevelHeight () const
 
Uint8 getLevelCoins () const
 
double getPosAlpha () const
 
std::list< Object * > const & getObjectList () const
 

Detailed Description

Game is a core game class. It's responsible for level loading and updating game state.

Constructor & Destructor Documentation

Game::Game ( )

The default constructor. Sets gameState to menu.

See also
GameState

Game implementation The default constructor. Sets gameState to menu.

See also
GameState
Game::~Game ( )

The default destructor. Unloads level.

Member Function Documentation

void Game::gameLoop ( )

Updates current state of game.

Returns
void
void Game::gameOver ( )

Changes gameState to GameState::Quit.

Returns
void
GameState Game::getGameState ( ) const

Get current GameState.

Returns
GameState
bool Game::getHasEnded ( ) const

Check if game has ended.

Returns
bool
Uint8 Game::getLevelCoins ( ) const

Get number of coins spawned on loaded level.

Returns
int
int Game::getLevelHeight ( ) const

Get height of loaded level.

Returns
int
int Game::getLevelWidth ( ) const

Get width of loaded level.

Returns
int
std::list< Object * > const & Game::getObjectList ( ) const

Get reference to constant list of loaded game objects.

Returns
std::list<Object*> const&
PlayerController * Game::getPlayerController ( ) const

Get pointer to PlayerController.

Returns
PlayerController*
double Game::getPosAlpha ( ) const

Get coefficient of game state between steps, where 0 is previous step and 1 is current step.

Returns
double
bool Game::getPosUpdated ( ) const

Check if game state has changed.

Returns
bool
void Game::loadLevel ( )

Unloads level if loaded, loads level and initializes Physics.

Returns
void
See also
Physics
void Game::pauseGame ( )

Changes gameState to GameState::Pause.

Returns
void
void Game::quitToMenu ( )

Changes gameState to GameState::Menu and unloads level.

Returns
void
void Game::resumeGame ( )

Changes gameState to GameState::Playing.

Returns
void
void Game::startGame ( )

Changes gameState to GameState::Playing and loads level.

Returns
void
void Game::unloadLevel ( )

Unloads level if loaded.

Returns
void
void Game::wonGame ( )

Changes gameState to GameState::Won.

Returns
void

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