A class used to manage scenes in the game.
More...
#include <SceneManager.h>
|
static void | RegisterScene (std::string name, std::unique_ptr< core::Scene > scene) |
| Registers a new scene. If a scene with the same name is already registered, an exception is thrown.
|
|
static void | UnregisterScene (const std::string &name) |
| Unregister a scene. If the scene is not registered, an exception is thrown.
|
|
static void | LoadScene (const std::string &name) |
| Loads a scene by its name into the current spark::core::Application. If the scene is not registered, an exception is thrown.
|
|
static std::shared_ptr< core::Scene > | Scene (const std::string &name, bool fail=true) |
| Gets a scene by its name. If the scene is not registered, an exception is thrown.
|
|
static void | UnregisterAllScenes () |
| Unregister all scenes.
|
|
A class used to manage scenes in the game.
◆ LoadScene()
void spark::core::SceneManager::LoadScene |
( |
const std::string & | name | ) |
|
|
static |
Loads a scene by its name into the current spark::core::Application. If the scene is not registered, an exception is thrown.
- Parameters
-
name | A string representing the name of the scene to load. |
◆ RegisterScene()
void spark::core::SceneManager::RegisterScene |
( |
std::string | name, |
|
|
std::unique_ptr< core::Scene > | scene ) |
|
static |
Registers a new scene. If a scene with the same name is already registered, an exception is thrown.
- Parameters
-
name | A string representing the name of the scene. |
scene | A unique pointer to the scene to register. |
◆ Scene()
std::shared_ptr< core::Scene > spark::core::SceneManager::Scene |
( |
const std::string & | name, |
|
|
bool | fail = true ) |
|
static |
Gets a scene by its name. If the scene is not registered, an exception is thrown.
- Parameters
-
name | A string representing the name of the scene to get. |
fail | A boolean indicating if an exception should be thrown if the scene is not registered. |
- Returns
- A unique pointer to the scene.
◆ UnregisterScene()
void spark::core::SceneManager::UnregisterScene |
( |
const std::string & | name | ) |
|
|
static |
Unregister a scene. If the scene is not registered, an exception is thrown.
- Parameters
-
name | A string representing the name of the scene to unregister. |