![]() |
Gamedev Framework (gf) 1.2.0
A C++17 framework for 2D games
|
A scene manager. More...
#include <gf/SceneManager.h>
Public Member Functions | |
SceneManager (const std::string &title, Vector2i size, Flags< WindowHints > hints=All) | |
Constructor. More... | |
void | run (const RenderStates &states=RenderStates()) |
Run the scene manager until completion. More... | |
void | pushScene (Scene &scene) |
Add a scene on top of the stack. More... | |
void | pushScenes (Span< const Ref< Scene > > scenes) |
Add multiple scenes on top of the stack. More... | |
void | popScene () |
Remove the top scene from the non-empty stack. More... | |
void | popAllScenes () |
Remove all the scenes from the non-empty stack. More... | |
void | replaceScene (Scene &scene) |
Replace the top scene with a new scene. More... | |
void | replaceScene (Span< const Ref< Scene > > scenes) |
Replace the top scene with many scenes. More... | |
void | replaceAllScenes (Scene &scene) |
Replace all the scenes with a new scene. More... | |
void | replaceAllScenes (Span< const Ref< Scene > > scenes) |
Replace all the scenes with many scenes. More... | |
void | replaceScene (Scene &scene, SegueEffect &effect, Time duration, Easing easing=Ease::linear) |
Replace the top scene with a new scene and a transition. More... | |
void | replaceScene (Span< const Ref< Scene > > scenes, SegueEffect &effect, Time duration, Easing easing=Ease::linear) |
Replace the top scene with many scenes and a transition. More... | |
void | replaceAllScenes (Scene &scene, SegueEffect &effect, Time duration, Easing easing=Ease::linear) |
Replace all the scenes with a new scene and a transition. More... | |
void | replaceAllScenes (Span< const Ref< Scene > > scenes, SegueEffect &effect, Time duration, Easing easing=Ease::linear) |
Replace all the scenes with many scenes and a transition. More... | |
Window & | getWindow () |
Get the window associated to the scene. More... | |
RenderTarget & | getRenderer () |
Get the renderer associated to the scene. More... | |
Vector2f | computeWindowToGameCoordinates (Vector2i coords, const View &view) const |
Get the game coordinates from the window coordinates. More... | |
Vector2i | computeGameToWindowCoordinates (Vector2f coords, const View &view) const |
Get the window coordinates from the game coordinates. More... | |
Private Member Functions | |
virtual void | doGlobalProcessEvent (const Event &event) |
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.
gf::SceneManager::SceneManager | ( | const std::string & | title, |
Vector2i | size, | ||
Flags< WindowHints > | hints = All |
||
) |
Constructor.
title | The title of the window |
size | The initial size of the window |
hints | Some hints for the creation of the window |
Vector2i gf::SceneManager::computeGameToWindowCoordinates | ( | Vector2f | coords, |
const View & | view | ||
) | const |
Get the window coordinates from the game coordinates.
Vector2f gf::SceneManager::computeWindowToGameCoordinates | ( | Vector2i | coords, |
const View & | view | ||
) | const |
Get the game coordinates from the window coordinates.
|
privatevirtual |
|
inline |
Get the renderer associated to the scene.
|
inline |
Get the window associated to the scene.
void gf::SceneManager::popAllScenes | ( | ) |
Remove all the scenes from the non-empty stack.
void gf::SceneManager::popScene | ( | ) |
Remove the top scene from the non-empty stack.
void gf::SceneManager::pushScene | ( | Scene & | scene | ) |
Add a scene on top of the stack.
scene | The scene to add |
Add multiple scenes on top of the stack.
scenes | The scenes to add |
|
inline |
Replace all the scenes with a new scene.
It is equivalent to popping all the scenes and pushing the new scene.
scene | The scene to add |
void gf::SceneManager::replaceAllScenes | ( | Scene & | scene, |
SegueEffect & | effect, | ||
Time | duration, | ||
Easing | easing = Ease::linear |
||
) |
Replace all the scenes with a new scene and a transition.
scene | The scene to add |
effect | The effect during the transition |
duration | The duration of the transition |
easing | The easing of the transition |
Replace all the scenes with many scenes.
It is equivalent to popping all the scenes and pushing the new scenes.
scenes | The scenes to add |
void gf::SceneManager::replaceAllScenes | ( | Span< const Ref< Scene > > | scenes, |
SegueEffect & | effect, | ||
Time | duration, | ||
Easing | easing = Ease::linear |
||
) |
Replace all the scenes with many scenes and a transition.
scenes | The scenes to add |
effect | The effect during the transition |
duration | The duration of the transition |
easing | The easing of the transition |
|
inline |
Replace the top scene with a new scene.
It is equivalent to popping the current top scene and pushing the new scene.
scene | The scene to add |
void gf::SceneManager::replaceScene | ( | Scene & | scene, |
SegueEffect & | effect, | ||
Time | duration, | ||
Easing | easing = Ease::linear |
||
) |
Replace the top scene with a new scene and a transition.
scene | The scene to add |
effect | The effect during the transition |
duration | The duration of the transition |
easing | The easing of the transition |
Replace the top scene with many scenes.
It is equivalent to popping the current top scene and pushing the new scenes.
scenes | The scenes to add |
void gf::SceneManager::replaceScene | ( | Span< const Ref< Scene > > | scenes, |
SegueEffect & | effect, | ||
Time | duration, | ||
Easing | easing = Ease::linear |
||
) |
Replace the top scene with many scenes and a transition.
scenes | The scenes to add |
effect | The effect during the transition |
duration | The duration of the transition |
easing | The easing of the transition |
void gf::SceneManager::run | ( | const RenderStates & | states = RenderStates() | ) |
Run the scene manager until completion.
states | The render states to use for drawing |