Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Scene

[19:7] extends: State

Wraps FXGL's Scene (com.almasb.fxgl.scene.Scene), the abstract base for every FXGL scene type. A Scene has its own scene-local Input, Timer, and content Pane (contentRoot). FXGLScene, GameScene, LoadingScene, FXGLMenu, and SubScene all extend it. Scene is abstract; Aussom users hold a Scene wrapper via adopt after obtaining one from the running engine (for example fxgl.getSceneService().getCurrentScene in chunk 6). The shared accessors here apply to every concrete scene type.

Methods

  • Scene ()

    Empty default constructor; populated by adopt.

  • adopt (object Ajo)

    Wraps an existing Scene AussomJavaObject.

    • @p Ajo is an AussomJavaObject around an FXGL Scene.
    • @r A new wrapper.
  • getContentRoot ()

    Returns the scene's content root Pane (the parent of every node added through addChild).

    • @r An AussomJavaObject around a javafx.scene.layout.Pane.
  • getInput ()

    Returns the scene-local Input service.

    • @r An AussomJavaObject around an FXGL Input.
  • getTimer ()

    Returns the scene-local Timer service.

    • @r An AussomJavaObject around an FXGL Timer.
  • addChild (object NodeObj)

    Adds a JavaFX Node to this scene's contentRoot.

    • @p NodeObj is a wrapper exposing the node via .obj.
    • @r this object
  • removeChild (object NodeObj)

    Removes a JavaFX Node from this scene's contentRoot.

    • @p NodeObj is a wrapper exposing the node via .obj.
    • @r this object
  • addListener (object ListenerObj)

    Adds an Updatable listener that fires on every scene update tick.

    • @p ListenerObj is an AussomJavaObject around an Updatable.
    • @r this object
  • removeListener (object ListenerObj)

    Removes a previously added Updatable listener.

    • @p ListenerObj is the AussomJavaObject originally passed to addListener.
    • @r this object
  • isSubState ()

    Returns true when this Scene is a SubScene.

    • @r A bool.
  • isAllowConcurrency ()

    Returns true when concurrent SubScenes are allowed on top of this Scene.

    • @r A bool.
  • getRoot ()

    Returns the scene's content-root Pane AJO.

  • bindSize (object WidthProp, object HeightProp, object ScaleRatioXProp, object ScaleRatioYProp)

    Binds the scene size and scale to the supplied window-size DoubleProperties. Used by the engine to keep the scene laid out as the window resizes; rarely called directly.

    • @p WidthProp is a DoubleProperty AJO.
    • @p HeightProp is a DoubleProperty AJO.
    • @p ScaleRatioXProp is a DoubleProperty AJO.
    • @p ScaleRatioYProp is a DoubleProperty AJO.
  • onCreate ()

    Lifecycle hook: invoked when the scene is created.

  • onDestroy ()

    Lifecycle hook: invoked when the scene is destroyed.