scene - Scene management

class scene.SceneManager

The SceneManager takes care of scene transitions, preserving scene states and everything else to maintain and ensure the control flow between different scenes.

name

The name of the Scene.

scenes

The scene stack.

next

The next Scene to run on calling update().

current

The currently running/active Scene.

switched

A sdl2.ext.EventHandler that is invoked, when a new Scene is started.

push(scene : Scene) → None

Pushes a new Scene to the scene stack.

The current scene will be put on the scene stack for later execution, while the passed scene will be set as current one. Once the newly pushed scene has ended or was paused, the previous scene will continue its execution.

pop() → None

Pops a scene from the scene stack, bringing it into place for being executed on the next update.

pause() → None

Pauses the current scene.

unpause() → None

Continues the current scene.

update() → None

Updates the scene state and switches to the next scene, if any has been pushed into place.

class scene.Scene([name=None])

A simple scene state object used to maintain the application workflow based on the presentation of an application.

manager

The SceneManager, the Scene is currently executed on.

Note

This will be set automatically on starting the Scene by the SceneManager. If the Scene is ended, it will be reset.

state

The current scene state.

started

A sdl2.ext.EventHandler that is invoked, when the Scene starts.

paused

A sdl2.ext.EventHandler that is invoked, when the Scene is paused.

unpaused

A sdl2.ext.EventHandler that is invoked, when the Scene is unpaused.

ended

A sdl2.ext.EventHandler that is invoked, when the Scene ends.

is_running

Indicates, if the scene is currently running.

is_paused

Indicates, if the scene is currently paused.

has_ended

Indicates, if the scene has ended.

start() → None

Starts the Scene. If the Scene is running or paused, nothing will be done.

pause() → None

Pauses the Scene. If the Scene is not running, nothing will be done.

unpause() → None

Continues the Scene. If the Scene is not paused, nothing will be done.

end() → None

Ends the Scene. If the Scene has ended already, nothing will be done.