Engine
Raylib based game framework
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SceneManager Class Reference

Manages scenes and the the execution of the current scene. More...

#include <SceneManager.h>

Public Member Functions

void Update (const float deltaT)
 Updates current scene.
 
void Draw ()
 Renders the current scene.
 
template<typename T , typename... Args>
requires std::is_base_of_v<Scene, T>
void AddScene (Args &&... args)
 Adds a scene to the manager.
 
template<typename T >
requires std::is_base_of_v<Scene, T>
void RemoveScene ()
 Removes a scene from the manager.
 
template<typename T >
requires std::is_base_of_v<Scene, T>
void ChangeScene ()
 Queues a scene change at the end of the frame.
 
void ClearScenes ()
 Removes all scenes.
 

Detailed Description

Manages scenes and the the execution of the current scene.

Only one scene can be active at the time. Scenes update and render after systems.

Member Function Documentation

◆ AddScene()

template<typename T , typename... Args>
requires std::is_base_of_v<Scene, T>
void SceneManager::AddScene ( Args &&...  args)
inline

Adds a scene to the manager.

The scene is constructed in within the manager and owned by it. Scenes must derive from the Scene base class.

Template Parameters
TScene type
ArgsConstructor arguments types
Parameters
argsScene constructor arguments

Usage:

sceneManager.AddScene<MenuScene>("Menu", menuTitle);

◆ ChangeScene()

template<typename T >
requires std::is_base_of_v<Scene, T>
void SceneManager::ChangeScene ( )
inline

Queues a scene change at the end of the frame.

OnExit of the current scene will be called. OnEnter of the next scene will be called.

Template Parameters
Scenetype

◆ RemoveScene()

template<typename T >
requires std::is_base_of_v<Scene, T>
void SceneManager::RemoveScene ( )
inline

Removes a scene from the manager.

Template Parameters
Scenetype

◆ Update()

void SceneManager::Update ( const float  deltaT)

Updates current scene.

Parameters
deltaTDuration of previous frame

The documentation for this class was generated from the following files: