The SceneManager class manages the current scene of the game and transitions between scenes.
More...
#include <SceneManager.h>
|
void | SwitchScene (std::unique_ptr< Scene > newScene) |
| Switches to a new scene, performing cleanup on the old scene and initialization on the new one.
|
|
void | HandleInput (float deltaTime) |
| Forwards input to the current scene.
|
|
void | Update (float deltaTime) |
| Updates the current scene.
|
|
void | Render () |
| Renders the current scene.
|
|
Scene * | GetCurrentScene () const |
| Returns a pointer to the current scene.
|
|
void | LoadNextLevel (SDL_Renderer *renderer, SDL_Window *window) |
| Loads the next level based on the current level index.
|
|
The SceneManager class manages the current scene of the game and transitions between scenes.
It holds a pointer to the currently active scene and provides methods to switch to a new scene, forward input to the current scene, and update and render the current scene. The SceneManager ensures that the lifecycle methods of the scenes are called appropriately.
◆ GetCurrentScene()
Scene * SceneManager::GetCurrentScene |
( |
| ) |
const |
|
inline |
Returns a pointer to the current scene.
- Returns
- A pointer to the current scene.
◆ HandleInput()
void SceneManager::HandleInput |
( |
float | deltaTime | ) |
|
|
inline |
Forwards input to the current scene.
- Parameters
-
deltaTime | The time since the last frame in seconds. |
◆ LoadNextLevel()
void SceneManager::LoadNextLevel |
( |
SDL_Renderer * | renderer, |
|
|
SDL_Window * | window ) |
|
inline |
Loads the next level based on the current level index.
- Parameters
-
renderer | The SDL renderer used for scene rendering. |
window | The SDL window where the scene is rendered. |
Advances the level index and switches to the corresponding scene.
◆ SwitchScene()
void SceneManager::SwitchScene |
( |
std::unique_ptr< Scene > | newScene | ) |
|
|
inline |
Switches to a new scene, performing cleanup on the old scene and initialization on the new one.
- Parameters
-
newScene | The new scene to switch to. |
◆ Update()
void SceneManager::Update |
( |
float | deltaTime | ) |
|
|
inline |
Updates the current scene.
- Parameters
-
deltaTime | The time since the last frame in seconds. |
The documentation for this class was generated from the following file: