Carpenter Engine
A C++ game engine with a build once run anywhere solution
|
The game class singleton used to run the game loop. More...
#include <Game.hpp>
Public Member Functions | |
Success | AddScene (const char *id, Scene *scene) |
Success | SwitchScene (const char *id) |
Success | UnloadScene (const char *id) |
void | DrawScene () |
void | UpdateScene (float dt) |
Graphics::Renderer & | GetRenderer () |
Static Public Member Functions | |
static Game & | getInstance (Engine::Scene *startingScene=nullptr) |
The game class singleton used to run the game loop.
This class communicates with the game DOM to run the game loop. This allows the programmers to code without worrying about a main function. The game can hold multiple scenes and switch between them using the SwitchScene
method.
GetInstance
method to get the singleton instance and assign it only to references of the class.Engine::Success Engine::Game::AddScene | ( | const char * | id, |
Scene * | scene | ||
) |
Adds a scene to the game
id | The loaded scene ID |
scene | The scene to add |
void Engine::Game::DrawScene | ( | ) |
Draws the current scene
Engine::Graphics::Renderer & Engine::Game::GetRenderer | ( | ) |
Returns the base renderer associated with the game engine
Engine::Success Engine::Game::SwitchScene | ( | const char * | id | ) |
Switches the scene requested
id | The ID of the scene to switch to |
Engine::Success Engine::Game::UnloadScene | ( | const char * | id | ) |
Deletes a loaded scene from the game
id | The ID of the scene to delete |
void Engine::Game::UpdateScene | ( | float | dt | ) |
Updates the current scene