SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
spark::core::SceneManager Class Referencefinal

A class used to manage scenes in the game. More...

#include <SceneManager.h>

Static Public Member Functions

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::SceneScene (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.
 

Detailed Description

A class used to manage scenes in the game.

Member Function Documentation

◆ 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
nameA 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
nameA string representing the name of the scene.
sceneA 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
nameA string representing the name of the scene to get.
failA 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
nameA string representing the name of the scene to unregister.