Class SceneManager
A detached manager selects its first registered scene but does not invoke lifecycle methods.
Attaching it through ziviDomeLive.setSceneManager(SceneManager) installs the facade
lifecycle and activates the selection with fresh SceneServices. Scene membership uses
Java object identity (==), not Object.equals(Object).
Mutation methods are intended for the Processing thread and are not thread-safe.
API stability: Stable.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivateScene(Scene scene) Activates a scene by instance; registers it first if it is not in the manager yet.voidDisposes the active scene, clears all registrations, and resets the manager.booleancontainsScene(Scene scene) Returns true when the manager already contains the provided scene instance.Returns the current scene.intReturns the total number of registered scenes.voidSwitches to the next scene in registration order, wrapping at the end.voidSwitches to the previous scene in registration order, wrapping at the beginning.voidregisterScene(Scene scene) Registers a scene by instance identity.booleanPerforms one complete dispose/setup cycle for the active scene.voidsetCurrentSceneIndex(int index) Selects and activates the scene at the supplied registration index.
-
Constructor Details
-
SceneManager
public SceneManager()Creates an empty, detached scene manager.
-
-
Method Details
-
registerScene
Registers a scene by instance identity.The first registration becomes the selected scene. It is set up immediately only when this manager is already attached to a facade; otherwise setup begins when attached.
- Parameters:
scene- scene to register;nulland duplicate instances are ignored
-
activateScene
Activates a scene by instance; registers it first if it is not in the manager yet.- Parameters:
scene- scene instance to activate;nullis ignored
-
containsScene
Returns true when the manager already contains the provided scene instance.- Parameters:
scene- scene to check- Returns:
trueif that exact scene instance is already managed
-
getSceneCount
public int getSceneCount()Returns the total number of registered scenes.- Returns:
- the number of scenes
-
nextScene
public void nextScene()Switches to the next scene in registration order, wrapping at the end. -
previousScene
public void previousScene()Switches to the previous scene in registration order, wrapping at the beginning. -
getCurrentScene
Returns the current scene.- Returns:
- selected scene, or
nullwhen no scene is registered
-
setCurrentSceneIndex
public void setCurrentSceneIndex(int index) Selects and activates the scene at the supplied registration index.- Parameters:
index- zero-based registration index; invalid values are ignored
-
reloadCurrentScene
public boolean reloadCurrentScene()Performs one complete dispose/setup cycle for the active scene.This method does not defer work. From scene code, prefer
SceneServices.requestReload(), which schedules the cycle at a safe frame boundary.- Returns:
truewhen an attached, active scene was reloaded
-
clearScenes
public void clearScenes()Disposes the active scene, clears all registrations, and resets the manager.Inactive scenes have already been disposed when they were deactivated. Scenes that were only registered and never activated have not entered their setup/dispose lifecycle.
-