|
Engine
Raylib based game framework
|
Manages scenes and the execution of the current active scene. More...
#include <SceneManager.hpp>
Public Member Functions | |
| template<typename SceneT, typename... Args> | |
| void | AddScene (Args &&... args) |
| Adds a scene to the manager. | |
| template<typename SceneT> | |
| void | RemoveScene () |
| Removes a scene from the manager. | |
| template<typename SceneT> | |
| void | ChangeScene () |
| Queues a scene transition to be applied at the end of the current frame. | |
| void | ClearScenes () |
| Removes all scenes and clears the active scene pointer. | |
Friends | |
| class | Engine |
Manages scenes and the execution of the current active scene.
Only one scene can be active at a time. Scene transitions are queued and applied at the end of the current Draw call so that OnExit and OnEnter are never called mid-update.
Scenes update and draw after systems each frame.
|
inline |
Adds a scene to the manager.
The scene is constructed within the manager and owned by it. Scenes must derive from the Scene base class.
| SceneT | Scene type |
| Args | Constructor argument types |
| args | SceneT constructor arguments |
Usage:
|
inline |
Queues a scene transition to be applied at the end of the current frame.
OnExit of the current scene is called followed by OnEnter of the next scene. The transition happens inside CheckForChange at the end of Draw. Asserts if the target scene does not exist or is already the active scene.
| SceneT | Type of the scene to transition to |
| void SceneManager::ClearScenes | ( | ) |
Removes all scenes and clears the active scene pointer.
Called by the Engine destructor.
|
inline |
Removes a scene from the manager.
Asserts if the scene to remove is the currently active scene.
| SceneT | Scene type to remove |