My Project
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SceneManager Class Reference

The SceneManager class manages the current scene of the game and transitions between scenes. More...

#include <SceneManager.h>

Public Member Functions

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.
 
SceneGetCurrentScene () 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.
 

Detailed Description

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.

Member Function Documentation

◆ 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
deltaTimeThe 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
rendererThe SDL renderer used for scene rendering.
windowThe 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
newSceneThe new scene to switch to.

◆ Update()

void SceneManager::Update ( float deltaTime)
inline

Updates the current scene.

Parameters
deltaTimeThe time since the last frame in seconds.

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