The Table Engine
|
Singleton class that manages scenes and their transitions. More...
#include <scenemanager.h>
Public Member Functions | |
void | setRenderer (SDL_Renderer *renderer) |
Sets the renderer used for drawing game objects. More... | |
void | loadDemo () |
void | loadScenesFromJSON (const std::string &filePath) |
void | getNextScene () |
Advances to the next scene based on the current scene index. More... | |
int | getSceneIndex () |
Retrieves the index of the current scene. More... | |
SDL_Renderer * | getRenderer () |
Retrieves the current SDL_Renderer used by the SceneManager. More... | |
SceneTree * | getSceneTree () |
Retrieves the current scene tree managing the game objects. More... | |
void | cleanTree () |
Cleans up the scene tree, removing all inactive game objects. More... | |
Vec2 | getCameraWorldPosition () |
Retrieves the world position of the camera. More... | |
SceneTree * | createSceneTest1 () |
Creates a test scene. This method is an example of how to define specific scenes. More... | |
SceneTree * | createSceneTest2 () |
SceneTree * | createSceneTest3 () |
void | input () |
Processes input for the current scene. More... | |
void | update () |
Updates the state of the current scene. More... | |
void | render () |
Renders the current scene. More... | |
Static Public Member Functions | |
static SceneManager & | getInstance () |
Retrieves the singleton instance of SceneManager. More... | |
Public Attributes | |
bool | isDemo = false |
Static Public Attributes | |
static std::atomic< uint64_t > | m_totalObjects = 0 |
Total number of game objects created. More... | |
static std::atomic< uint64_t > | m_aliveObjects = 0 |
Current number of active game objects. More... | |
Private Member Functions | |
SceneManager () | |
Private constructor for singleton pattern. More... | |
SceneManager (const SceneManager &)=delete | |
Deleted copy constructor to prevent copying of singleton. More... | |
void | operator= (const SceneManager &)=delete |
Deleted assignment operator to prevent copying of singleton. More... | |
Private Attributes | |
SDL_Renderer * | m_renderer |
Renderer used to render the game objects. More... | |
std::vector< SceneTree * > | m_sceneTrees |
Array of scene trees. More... | |
int | m_currentSceneIndex = -1 |
Index of the current scene in the game. More... | |
Camera * | m_camera |
Singleton class that manages scenes and their transitions.
This class implements the singleton pattern to manage scenes throughout the game. It provides mechanisms to switch scenes, render them, and manage game objects within them.
Definition at line 26 of file scenemanager.h.
|
private |
Private constructor for singleton pattern.
Definition at line 20 of file scenemanager.cpp.
|
privatedelete |
Deleted copy constructor to prevent copying of singleton.
void SceneManager::cleanTree | ( | ) |
Cleans up the scene tree, removing all inactive game objects.
Definition at line 289 of file scenemanager.cpp.
SceneTree * SceneManager::createSceneTest1 | ( | ) |
Creates a test scene. This method is an example of how to define specific scenes.
Definition at line 175 of file scenemanager.cpp.
SceneTree * SceneManager::createSceneTest2 | ( | ) |
Definition at line 213 of file scenemanager.cpp.
SceneTree * SceneManager::createSceneTest3 | ( | ) |
Definition at line 251 of file scenemanager.cpp.
Vec2 SceneManager::getCameraWorldPosition | ( | ) |
Retrieves the world position of the camera.
Definition at line 156 of file scenemanager.cpp.
|
static |
Retrieves the singleton instance of SceneManager.
Definition at line 15 of file scenemanager.cpp.
void SceneManager::getNextScene | ( | ) |
Advances to the next scene based on the current scene index.
Definition at line 160 of file scenemanager.cpp.
SDL_Renderer * SceneManager::getRenderer | ( | ) |
Retrieves the current SDL_Renderer used by the SceneManager.
Definition at line 152 of file scenemanager.cpp.
int SceneManager::getSceneIndex | ( | ) |
Retrieves the index of the current scene.
Definition at line 171 of file scenemanager.cpp.
SceneTree * SceneManager::getSceneTree | ( | ) |
Retrieves the current scene tree managing the game objects.
Definition at line 28 of file scenemanager.cpp.
void SceneManager::input | ( | ) |
Processes input for the current scene.
Definition at line 303 of file scenemanager.cpp.
void SceneManager::loadDemo | ( | ) |
Definition at line 32 of file scenemanager.cpp.
void SceneManager::loadScenesFromJSON | ( | const std::string & | filePath | ) |
Definition at line 39 of file scenemanager.cpp.
|
privatedelete |
Deleted assignment operator to prevent copying of singleton.
void SceneManager::render | ( | ) |
Renders the current scene.
Definition at line 369 of file scenemanager.cpp.
void SceneManager::setRenderer | ( | SDL_Renderer * | renderer | ) |
Sets the renderer used for drawing game objects.
renderer | Pointer to SDL_Renderer. |
Definition at line 24 of file scenemanager.cpp.
void SceneManager::update | ( | ) |
Updates the state of the current scene.
Definition at line 314 of file scenemanager.cpp.
bool SceneManager::isDemo = false |
Definition at line 60 of file scenemanager.h.
|
static |
Current number of active game objects.
Definition at line 58 of file scenemanager.h.
|
private |
Definition at line 33 of file scenemanager.h.
|
private |
Index of the current scene in the game.
Definition at line 32 of file scenemanager.h.
|
private |
Renderer used to render the game objects.
Definition at line 29 of file scenemanager.h.
|
private |
Array of scene trees.
Definition at line 30 of file scenemanager.h.
|
static |
Total number of game objects created.
Definition at line 57 of file scenemanager.h.