Mana
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
Game Class Reference

The main class responsible for running the game. More...

#include <game.h>

Public Member Functions

 Game ()
 Constructs the game, creating all the managers, handlers, engines and GUI windows that make up the game.
 
 ~Game ()
 Destructor, cleans up the game.
 
void logic ()
 This method takes the game a small step further.
 
bool keyDownEvent (SDL_KeyboardEvent &event)
 Handles an SDL_KEYDOWN event and returns whether it was consumed.
 
void handleInput ()
 Continuous input handling.
 
void changeMap (const std::string &mapName)
 Changes the currently active map.
 
MapgetCurrentMap ()
 Returns the currently active map.
 
const std::string & getCurrentMapName ()
 
int getCurrentTileWidth () const
 Convenience functions used to get the current tile width and height.
 
int getCurrentTileHeight () const
 
void updateWindowMenuCaptions ()
 Update the key shortcuts in the window menu.
 
void videoResized (int width, int height)
 

Static Public Member Functions

static Gameinstance ()
 Provides access to the game instance.
 

Private Attributes

int mLastTarget
 
bool mDisconnected = false
 
WindowMenumWindowMenu
 
MapmCurrentMap = nullptr
 
std::string mMapName
 
Timer mParticleEngineTimer
 

Static Private Attributes

static GamemInstance = nullptr
 

Detailed Description

The main class responsible for running the game.

The game starts after you have selected your character.

Definition at line 36 of file game.h.

Constructor & Destructor Documentation

◆ Game()

Game::Game ( )

Constructs the game, creating all the managers, handlers, engines and GUI windows that make up the game.

Definition at line 207 of file game.cpp.

◆ ~Game()

Game::~Game ( )

Destructor, cleans up the game.

Definition at line 242 of file game.cpp.

Member Function Documentation

◆ changeMap()

void Game::changeMap ( const std::string &  mapPath)

Changes the currently active map.

Should only be called while the game is running.

Definition at line 857 of file game.cpp.

◆ getCurrentMap()

Map * Game::getCurrentMap ( )
inline

Returns the currently active map.

Definition at line 70 of file game.h.

◆ getCurrentMapName()

const std::string & Game::getCurrentMapName ( )
inline

Definition at line 72 of file game.h.

◆ getCurrentTileHeight()

int Game::getCurrentTileHeight ( ) const

Definition at line 925 of file game.cpp.

◆ getCurrentTileWidth()

int Game::getCurrentTileWidth ( ) const

Convenience functions used to get the current tile width and height.

Definition at line 917 of file game.cpp.

◆ handleInput()

void Game::handleInput ( )

Continuous input handling.

Definition at line 708 of file game.cpp.

◆ instance()

static Game * Game::instance ( )
inlinestatic

Provides access to the game instance.

Definition at line 53 of file game.h.

◆ keyDownEvent()

bool Game::keyDownEvent ( SDL_KeyboardEvent &  event)

Handles an SDL_KEYDOWN event and returns whether it was consumed.

Definition at line 400 of file game.cpp.

◆ logic()

void Game::logic ( )

This method takes the game a small step further.

It is called 100 times per second.

Definition at line 349 of file game.cpp.

◆ updateWindowMenuCaptions()

void Game::updateWindowMenuCaptions ( )
inline

Update the key shortcuts in the window menu.

Definition at line 83 of file game.h.

◆ videoResized()

void Game::videoResized ( int  width,
int  height 
)

Definition at line 933 of file game.cpp.

Member Data Documentation

◆ mCurrentMap

Map* Game::mCurrentMap = nullptr
private

Definition at line 94 of file game.h.

◆ mDisconnected

bool Game::mDisconnected = false
private

Definition at line 90 of file game.h.

◆ mInstance

Game * Game::mInstance = nullptr
staticprivate

Definition at line 99 of file game.h.

◆ mLastTarget

int Game::mLastTarget
private

Definition at line 89 of file game.h.

◆ mMapName

std::string Game::mMapName
private

Definition at line 95 of file game.h.

◆ mParticleEngineTimer

Timer Game::mParticleEngineTimer
private

Definition at line 97 of file game.h.

◆ mWindowMenu

WindowMenu* Game::mWindowMenu
private

Definition at line 92 of file game.h.


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