Gamedev Framework (gf)  0.14.0
A C++14 framework for 2D games
Public Member Functions | List of all members
gf::SceneManager Class Reference

A scene manager. More...

#include <gf/SceneManager.h>

Public Member Functions

 SceneManager (StringRef title, Vector2i size)
 Constructor. More...
 
void run ()
 Run the scene manager until completion. More...
 
void pushScene (Scene &scene)
 Add a scene on top of the stack. More...
 
void popScene ()
 Remove the top scene from the non-empty stack. More...
 
void replaceScene (Scene &scene)
 Replace the top scene with a new scene. More...
 
const RenderTargetgetRenderer () const
 Get the renderer associated to the scene. More...
 

Detailed Description

A scene manager.

A scene manager handles several scenes, organised into a stack. It has a window and a renderer and use them to handle the scenes.

The top of the stack is the active scene. The manager runs the active scene while the stack is not empty. All the scene in the stack receive inputs, are updated and are rendered, beginning from the base of the stack until the top.

See also
gf::Scene

Constructor & Destructor Documentation

◆ SceneManager()

gf::SceneManager::SceneManager ( StringRef  title,
Vector2i  size 
)

Constructor.

Parameters
titleThe title of the window
sizeThe size of the window

Member Function Documentation

◆ getRenderer()

const RenderTarget& gf::SceneManager::getRenderer ( ) const
inline

Get the renderer associated to the scene.

◆ popScene()

void gf::SceneManager::popScene ( )

Remove the top scene from the non-empty stack.

◆ pushScene()

void gf::SceneManager::pushScene ( Scene scene)

Add a scene on top of the stack.

Parameters
sceneThe scene to add

◆ replaceScene()

void gf::SceneManager::replaceScene ( Scene scene)
inline

Replace the top scene with a new scene.

It is equivalent to popping the current top scene and pushing the new scene.

Parameters
sceneThe scene to add

◆ run()

void gf::SceneManager::run ( )

Run the scene manager until completion.