Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: VirtualController

[23:7] extends: FxObj

Wraps an AussomVirtualController (subclass of FXGL's abstract VirtualController) so Aussom code can build a custom on-screen Y / B / A / X button group. Register the onCreateView callback to supply per-button JavaFX Node wrappers; FXGL handles the press/release wiring. Example: vc = new VirtualController(fxgl.getInput()); vc.onCreateView(::buildButton); gameScene.addUINode(vc.createView()); public buildButton(btnName) { return new Circle(40.0); }

Methods

  • VirtualController (InputAjo)

    Creates a new VirtualController bridge.

    • @p InputAjo is an Input wrapper or AussomJavaObject (typically fxgl.getInput()).
  • adopt (object Ajo)

    Wraps an existing AussomVirtualController AussomJavaObject.

  • onCreateView (callback Cb)

    Registers the createView callback (called per button). The callback receives the VirtualButton name (e.g. "Y", "B", "A", "X") and must return a JavaFX Node wrapper.

    • @p Cb is a callback (btnName) -> Node.
    • @r this object
  • createView ()

    Builds the four-button JavaFX Group view (Y / B / A / X arranged around a center). Add the result to a Scene.

    • @r An AussomJavaObject wrapping the Group.
  • pressVirtual (string BtnName)

    Mocks a virtual press for the given button name.

    • @p BtnName is the VirtualButton enum name.
  • releaseVirtual (string BtnName)

    Mocks a virtual release for the given button name.

    • @p BtnName is the VirtualButton enum name.
  • createViewUp ()

    Returns the up-button view Node AJO produced by the bridge.

  • createViewRight ()

    Returns the right-button view Node AJO produced by the bridge.

  • createViewDown ()

    Returns the down-button view Node AJO produced by the bridge.

  • createViewLeft ()

    Returns the left-button view Node AJO produced by the bridge.