![]() |
Dauphine
0.1
A platforming/stealth game in a medieval fantasy setting, developed with SDL2.
|
Main structure class for the game. More...
#include <Game.h>
Public Types | |
| enum | GStates : uint8_t { SPLASH = 0, MENU, LEVEL_ONE, OPTIONS, CREDITS, GAMEOVER } |
| All possible game states. | |
Public Member Functions | |
| ~Game () | |
| The destructor. More... | |
| void | runGame () |
| The main game loop. More... | |
| void | setState (const GStates state_) |
| Sets the current game state. More... | |
| AudioHandler & | getAudioHandler () |
| std::array< bool, GameKeys::MAX > | getInput () |
| ResourceManager & | getResources () |
| void | stop () |
| Stops execution and closes the game. | |
Static Public Member Functions | |
| static Game & | instance () |
| Singleton imeplementation for Game. More... | |
Private Member Functions | |
| Game () | |
| The constructor. More... | |
| void | initializeStates () |
| Loads all the states. More... | |
| void | destroyStates () |
| Deletes all the loaded states. More... | |
Private Attributes | |
| Window * | window |
| The game Window. More... | |
| bool | isRunning |
| Whether the game is currently running/looping or not. More... | |
| AudioHandler * | audioHandler |
| The Game AudioHandler. More... | |
| InputHandler * | inputHandler |
| The Game InputHandler. More... | |
| ResourceManager * | resourceManager |
| The Game ResourceManager. More... | |
| StateGame * | currentState |
| The current state, which the game is in. More... | |
| std::map< GStates, StateGame * > | statesMap |
| Map containing all possible states. More... | |
| FPSmanager | fpsManager |
| The FPSManager from SDL2_GFX. More... | |
Main structure class for the game.
Contains all the necessary functionalities to loop and update the game. Is the state machine (controls current state), contains all the different possible states.
| Game::~Game | ( | ) |
The destructor.
Destroys the game's Window and states, and unloads current state.
|
private |
The constructor.
Sets the game window and tells the game that it is OK to begin looping. Also, it begins the FPS manager.
|
private |
Deletes all the loaded states.
Every new state implemented should be deleted here.
| AudioHandler & Game::getAudioHandler | ( | ) |
| std::array< bool, GameKeys::MAX > Game::getInput | ( | ) |
| ResourceManager & Game::getResources | ( | ) |
|
private |
Loads all the states.
Every new state implemented should be initialized here.
|
static |
| void Game::runGame | ( | ) |
The main game loop.
Orders the game structure, such as inputs, updates, and rendering.
| void Game::setState | ( | const GStates | state_) |
Sets the current game state.
| state_ | : The state you want to be changed into. |
|
private |
The Game AudioHandler.
|
private |
The current state, which the game is in.
|
private |
The FPSManager from SDL2_GFX.
Handles the framerate capping.
|
private |
The Game InputHandler.
|
private |
Whether the game is currently running/looping or not.
|
private |
The Game ResourceManager.
1.8.4