SceneManager

Qualified name: algan.scene\_manager.SceneManager

class SceneManager[source]

Bases: Singleton

Maintain the stack of active Scene objects.

SceneManager.instance() returns the manager (not a Scene). Access the topmost scene through current_scene. A default scene is created lazily when the stack is empty, preserving Algan’s traditional module-level authoring style while allowing nested, isolated scenes.

Methods

activating

Temporarily make scene current while preserving the stack.

push

Push scene and make it active.

reset

Discard every scene and return a fresh default active scene.

set_scene_class

terminate

Pop scene from the stack.

Attributes

current_scene

Return the topmost active scene, creating the default lazily.

scene_stack

An immutable snapshot of the active-scene stack.

activating(scene)[source]

Temporarily make scene current while preserving the stack.

This is used for scene-owned callbacks such as custom initializers when an explicit, currently inactive scene is reset or rendered.

property current_scene

Return the topmost active scene, creating the default lazily.

push(scene)[source]

Push scene and make it active.

A scene may occur at most once in the stack. Re-entering an already active scene is therefore a no-op; reactivating an inactive scene moves it to the top.

classmethod reset()[source]

Discard every scene and return a fresh default active scene.

This retains the singleton manager object itself; only its scene stack is reset. Existing scene references remain valid objects but are marked terminated and no longer receive implicitly-created mobs.

property scene_stack

An immutable snapshot of the active-scene stack.

terminate(scene)[source]

Pop scene from the stack.

Stack discipline is deliberate: terminating a covered scene would make containment ambiguous, so only the current topmost scene can be popped. Calling this for an already-terminated scene is harmless.