An utility to create different scenes or screens for different UI layouts, for example a main menu and a option menu.

Do not use Koui.add() in scenes! It will work but it ignores the current scene.

Internally, a scene is just a AnchorPane that is only visible if the scene is active. Only one scene can be active at once.

See also:

Static variables

@:value(null)staticread onlyactiveScene:AnchorPane = null

The anchor pane if the currently active scene.

private@:value(new Map())staticscenes:Map<String, AnchorPane> = new Map()

Static methods

staticaddScene(name:String, onSetup:AnchorPane ‑> Void):Void

Adds a scene. For setup, please use the add() function of the AnchorPane parameter of the onSetup callback.

Parameters:

name

The name of the new scene for later reference

onSetup

A callback that creates the UI for the scene

@:access(koui.events.EventHandler)staticsetScene(name:String):Void

Sets the current scene by its name.