System managing scenes display and lifecycle. Use it to structure your app in different scenes.

Static variables

@:value(new SceneSystem())@lazystaticshared:SceneSystem = new SceneSystem()

Shared scene system

Variables

@:value([])read onlyall:ReadOnlyArray<Scene> = []

@:value(false)keepAssetsForNextMain:Bool = false

If true, when assigning a new main scene, assets of the previous main scene will be kept instead of being destroyed and can be reused by the new main scene without having to reload these

@:value(true)bindMainToScreenSize:Bool = true

If true, main scene will be bound to screen size automatically

@:value(true)fadeOutWhenNextMainCanFadeIn:Bool = true

If true, when assigning a new main scene, previous main scene will wait until the next scene is properly loaded and can fade-in before starting its own fade-out transition.

@:value(null)main:Scene = null

The main scene to display on screen.

@:value(true)autoDestroyFilter:Bool = true

If set to true (default), any filter assigned to the system will be destroyed if replaced by another filter, set to null, or if the system is destroyed.

@:value(true)autoScaleFilter:Bool = true

If set to true (default), a filter assigned to the system will be auto-scaled to fit screen size.

@:value(null)filter:Filter = null

Assign a filter to the scene system, that will be used to render root scenes

@:value(new Map())read onlyrootScenes:ReadOnlyMap<String, Scene> = new Map()

Methods

@:value({ keepAssets : false, bindToScreenSize : true })set(name:String, scene:Scene, bindToScreenSize:Bool = true, keepAssets:Bool = false):Void

Assign secondary scenes to display them directly on screen.

Parameters:

name

The slot name of the scene

scene

The scene to assign

bindToScreenSize

(optional) Set to false if you don't want the scene to follow screen size

keepAssets

(optional) Set to true if you want this scene to keep the same assets instance as the previous scene on the same slot.

get(name:String):Scene

Retrieve a secondary scene from the given slot name

Parameters:

name

The slot name of the scene to retrieve

Returns:

A Scene instance or null if nothing was found

@:value({ keepAssets : false })inlinesetCurrentScene(scene:Scene, keepAssets:Bool = false):Void

Deprecated: "Deprecated: use `app.scenes.main = yourScene;` instead"

Inherited Events

Defined by System

@:dox(show)beginEarlyUpdate(delta:Float):Void

@:dox(show)endEarlyUpdate(delta:Float):Void

@:dox(show)beginLateUpdate(delta:Float):Void

@:dox(show)endLateUpdate(delta:Float):Void

@:dox(show)dispose(entity:Entity):Void

@:dox(show)destroy(entity:Entity):Void

Inherited Variables

Defined by System

@:value(null)name:String = null

System name. Useful to retrieve a system afterwards

@:value(true)autoUpdate:Bool = true

When set to true (default). This system will be updated automatically. If false, you'll need to call earlyUpdate() and lateUpdate() manually.

@:value(0)earlyUpdateOrder:Float = 0

Order of earlyUpdate execution. Given two systems, a system with a lower earlyUpdateOrder value will have it's earlyUpdate() method called before another system's earlyUpdate() method with a higher order value.

@:value(0)lateUpdateOrder:Float = 0

Order of lateUpdate execution. Given two systems, a system with a lower lateUpdateOrder value will have it's lateUpdate() method called before another system's lateUpdate() method with a higher order value.

Defined by Entity

read onlyhasData:Bool

@:value(null)id:String = null

read onlydestroyed:Bool

read onlydisposed:Bool

@:value(null)read onlyautoruns:Array<Autorun> = null

@editablecomponents:ReadOnlyMap<String, Component>

Public components mapping. Contain components created separately with component() or macro-based components as well.

scriptContent:ScriptContent

Available with script plugin

script:Script

Available with script plugin

Inherited Methods

Defined by System

Defined by Entity

dispose():Void

Schedules destroy, at the end of the current frame.

unbindEvents():Void

Remove all events handlers from this entity.

autorun(run:() ‑> Void, ?afterRun:() ‑> Void):Autorun

Creates a new Autorun instance with the given callback associated with the current entity.

Parameters:

run

The run callback

Returns:

The autorun instance

tween(?easing:Easing, duration:Float, fromValue:Float, toValue:Float, update:(Float, Float) ‑> Void):Tween

component<C>(?name:String, ?component:Null<C>):C