Sly Engine
SceneManager Class Reference

#include <SceneManager.h>

Collaboration diagram for SceneManager:
Collaboration graph

Static Public Member Functions

static void InitStartScene ()
 Initializes the start scene. More...
 
static SceneGetCurrentScene ()
 Gets current scene. More...
 
static void SetStartScene (Scene *startScene)
 Sets start scene. More...
 
static void SetNextScene (Scene *nextScene)
 Sets next scene. More...
 
static void Update ()
 Calls the main update loop for the current scene. More...
 
static void Draw ()
 Calls the current scene's draw loop. More...
 
static void Delete ()
 Deletes the scene swap commands and pointer instance. More...
 
static void LoadDefault ()
 Loads the default scene. More...
 
static void SetDefault (Scene *newScene)
 Sets up what scene should be loaded as the default startup. More...
 
static void SetupGodCam ()
 

Private Member Functions

 SceneManager ()
 Default constructor. More...
 
 SceneManager (const SceneManager &)=delete
 Copy constructor. More...
 
 SceneManager (SceneManager &&)=delete
 Move constructor. More...
 
SceneManageroperator= (const SceneManager &)=delete
 Assignment operator. More...
 
SceneManageroperator= (SceneManager &&)=delete
 Move assignment operator. More...
 
 ~SceneManager ()=default
 Deconstructor. More...
 
void privInitStartScene ()
 Private initialize start scene. More...
 
SceneprivGetCurrentScene ()
 Priv get current scene. More...
 
void privSetStartScene (Scene *startScene)
 Private set start scene. More...
 
void privSetNextScene (Scene *nextScene)
 Private set next scene. More...
 
void privChangeScene (Scene *nextScene)
 Private change scene. More...
 
void privUpdate ()
 Priv update. More...
 
void privDraw ()
 Private draw. More...
 
void privReloadDefault ()
 Priv reload default. More...
 
void privSetDefault (Scene *newScene)
 Priv set default. More...
 
void privSetupGodCam ()
 Private call to setup god camera. More...
 
void privDelete ()
 Private delete. More...
 

Static Private Member Functions

static SceneManagerInstance ()
 Gets the instance. More...
 

Private Attributes

ScenepDefaultScene
 Starter scene. More...
 
ScenepCurrentScene
 Keeps track of the currentScene registered. More...
 
SceneChangeNullCommandpCommandNull
 NonOp command for swapping the scene. More...
 
SceneChangeCommandSwappCommandSwap
 Command to swap to a new scene. More...
 
SceneChangeCommandBasepCommandBase
 Base command for Swap and Null commands. More...
 

Static Private Attributes

static SceneManagerptrInstance = nullptr
 The pointer instance. More...
 

Friends

class SceneManagerAttorney
 Dictates the usage of SceneManager internals. More...
 

Constructor & Destructor Documentation

◆ SceneManager() [1/3]

SceneManager::SceneManager ( )
private

Default constructor.

Here is the caller graph for this function:

◆ SceneManager() [2/3]

SceneManager::SceneManager ( const SceneManager )
privatedelete

Copy constructor.

◆ SceneManager() [3/3]

SceneManager::SceneManager ( SceneManager &&  )
privatedelete

Move constructor.

◆ ~SceneManager()

SceneManager::~SceneManager ( )
privatedefault

Deconstructor.

Member Function Documentation

◆ Delete()

static void SceneManager::Delete ( )
inlinestatic

Deletes the scene swap commands and pointer instance.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Draw()

static void SceneManager::Draw ( )
inlinestatic

Calls the current scene's draw loop.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCurrentScene()

static Scene * SceneManager::GetCurrentScene ( )
inlinestatic

Gets current scene.

Returns
Null if it fails, else the current scene.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitStartScene()

static void SceneManager::InitStartScene ( )
inlinestatic

Initializes the start scene.

Starts up the first scene. First scene is defined within this function which is passed to pCurrentScene.

Here is the call graph for this function:

◆ Instance()

static SceneManager & SceneManager::Instance ( )
inlinestaticprivate

Gets the instance.

Returns
A reference to a SceneManager.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LoadDefault()

static void SceneManager::LoadDefault ( )
inlinestatic

Loads the default scene.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

SceneManager& SceneManager::operator= ( const SceneManager )
privatedelete

Assignment operator.

◆ operator=() [2/2]

SceneManager& SceneManager::operator= ( SceneManager &&  )
privatedelete

Move assignment operator.

◆ privChangeScene()

void SceneManager::privChangeScene ( Scene nextScene)
private

Private change scene.

Parameters
nextSceneThe next scene to be loaded.

Performs the act of closing the current scene and starting the next one. The scene Initialization is called here.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ privDelete()

void SceneManager::privDelete ( )
private

Private delete.

Deletes the existing commands and the pointer instance for SceneManager.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ privDraw()

void SceneManager::privDraw ( )
private

Private draw.

Calls draw on the current scene.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ privGetCurrentScene()

Scene * SceneManager::privGetCurrentScene ( )
private

Priv get current scene.

Returns
Null if it fails, else a pointer to the current Scene.
Here is the caller graph for this function:

◆ privInitStartScene()

void SceneManager::privInitStartScene ( )
private

Private initialize start scene.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ privReloadDefault()

void SceneManager::privReloadDefault ( )
private

Priv reload default.

Deletes the current scene and loads the default back

Here is the call graph for this function:
Here is the caller graph for this function:

◆ privSetDefault()

void SceneManager::privSetDefault ( Scene newScene)
private

Priv set default.

Parameters
[in,out]newSceneIf non-null, the new scene.

Sets the default scene to the user specified one

Here is the caller graph for this function:

◆ privSetNextScene()

void SceneManager::privSetNextScene ( Scene nextScene)
private

Private set next scene.

Parameters
[in,out]nextSceneIf non-null, the next scene.

Readies the command for a scene change. pCommandSwap is initialized with the next scene data.

// Does not allow double scene registry.
assert(pCommandBase == pCommandNull && "Double Scene Change Requested, not allowed.");
// Set the scene change command (for the next frame) to swap to next scene.
pCommandSwap->Initialize(this, nextScene);
}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ privSetStartScene()

void SceneManager::privSetStartScene ( Scene startScene)
private

Private set start scene.

Parameters
[in,out]startSceneIf non-null, the start scene.
Here is the caller graph for this function:

◆ privSetupGodCam()

void SceneManager::privSetupGodCam ( )
private

Private call to setup god camera.

Sets the god camera up for usage. Notably useful for the "noclip" command or "god camera command."

Here is the call graph for this function:
Here is the caller graph for this function:

◆ privUpdate()

void SceneManager::privUpdate ( )
private

Priv update.

Executes the scene swap resulting in either a NoOp or a scene change. Afterwards, called scene update.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetDefault()

static void SceneManager::SetDefault ( Scene newScene)
inlinestatic

Sets up what scene should be loaded as the default startup.

Parameters
[in,out]newSceneIf non-null, the new scene.

This function was created with the "reload" console command in mind.

Here is the call graph for this function:

◆ SetNextScene()

static void SceneManager::SetNextScene ( Scene nextScene)
inlinestatic

Sets next scene.

Parameters
[in,out]nextSceneIf non-null, the next scene.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetStartScene()

static void SceneManager::SetStartScene ( Scene startScene)
inlinestatic

Sets start scene.

Parameters
[in,out]startSceneIf non-null, the start scene.
Here is the call graph for this function:

◆ SetupGodCam()

static void SceneManager::SetupGodCam ( )
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Update()

static void SceneManager::Update ( )
inlinestatic

Calls the main update loop for the current scene.

Checks for a scene change command and if present, executes it. Proceeds with calling the current scene's update loop.

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ SceneManagerAttorney

friend class SceneManagerAttorney
friend

Dictates the usage of SceneManager internals.

Member Data Documentation

◆ pCommandBase

SceneChangeCommandBase* SceneManager::pCommandBase
private

Base command for Swap and Null commands.

◆ pCommandNull

SceneChangeNullCommand* SceneManager::pCommandNull
private

NonOp command for swapping the scene.

◆ pCommandSwap

SceneChangeCommandSwap* SceneManager::pCommandSwap
private

Command to swap to a new scene.

◆ pCurrentScene

Scene* SceneManager::pCurrentScene
private

Keeps track of the currentScene registered.

◆ pDefaultScene

Scene* SceneManager::pDefaultScene
private

Starter scene.

◆ ptrInstance

SceneManager * SceneManager::ptrInstance = nullptr
staticprivate

The pointer instance.


The documentation for this class was generated from the following files:
SceneManager::pCommandNull
SceneChangeNullCommand * pCommandNull
NonOp command for swapping the scene.
Definition: SceneManager.h:38
SceneManager::pCommandBase
SceneChangeCommandBase * pCommandBase
Base command for Swap and Null commands.
Definition: SceneManager.h:40
SceneManager::pCommandSwap
SceneChangeCommandSwap * pCommandSwap
Command to swap to a new scene.
Definition: SceneManager.h:39
SceneChangeCommandSwap::Initialize
void Initialize(SceneManager *inputMgr, Scene *theScene)
Initializes this.
Definition: SceneChangeCommandSwap.cpp:14
Scene
Definition: Scene.h:21
SceneManager::privSetNextScene
void privSetNextScene(Scene *nextScene)
Private set next scene.
Definition: SceneManager.cpp:43