Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: VirtualDpad

[21:7] extends: FxObj

Wraps an AussomVirtualDpad (subclass of FXGL's abstract VirtualDpad) so Aussom code can build a custom on-screen UP / DOWN / LEFT / RIGHT button group. Register the onCreateView callback to supply per-button JavaFX Node wrappers; FXGL handles the press/release wiring. Example: vd = new VirtualDpad(fxgl.getInput()); vd.onCreateView(::buildArrow); gameScene.addUINode(vd.createView());

Methods

  • VirtualDpad (InputAjo)

    Creates a new VirtualDpad bridge.

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

    Wraps an existing AussomVirtualDpad AussomJavaObject.

  • onCreateView (callback Cb)

    Registers the createView callback (called per button). The callback receives the VirtualButton name (UP, DOWN, LEFT, RIGHT) 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 (UP / DOWN / LEFT / RIGHT arranged around a center).

    • @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 arrow Node AJO produced by the bridge.

  • createViewRight ()

    Returns the right arrow Node AJO produced by the bridge.

  • createViewDown ()

    Returns the down arrow Node AJO produced by the bridge.

  • createViewLeft ()

    Returns the left arrow Node AJO produced by the bridge.