Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: VirtualJoystick

[22:7] extends: Parent

Wraps an AussomVirtualJoystick (subclass of FXGL's abstract VirtualJoystick) so Aussom code can build a custom on-screen analog joystick. Register onGetCenter (returns a Point2D wrapper) and onGetMaxDistance (returns a double); add the background and thumb shapes via the standard JavaFX Parent API on this.obj. Example: vj = new VirtualJoystick(fxgl.getInput()); vj.onGetCenter(::center).onGetMaxDistance(::max);

Methods

  • VirtualJoystick (InputAjo)

    Creates a new VirtualJoystick bridge.

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

    Wraps an existing AussomVirtualJoystick AussomJavaObject.

  • onGetCenter (callback Cb)

    Registers the getCenter callback (returns the joystick center as a Point2D wrapper).

    • @p Cb is a callback () -> Point2D.
    • @r this object
  • onGetMaxDistance (callback Cb)

    Registers the getMaxDistance callback (returns max distance from center to joystick edge as a double).

    • @p Cb is a callback () -> double.
    • @r this object
  • getMaxForce ()

    Returns the maxForce scalar applied at the edge.

  • setMaxForce (double Force)

    Sets the maxForce scalar applied at the edge.

    • @p Force is a double.
    • @r this object
  • getVector ()

    Returns the normalized vector from center to pointer.

  • getVectorWithForce ()

    Returns the force-scaled vector from center to pointer.

  • vectorProperty ()

    Returns the read-only Point2D vector property.

  • vectorWithForceProperty ()

    Returns the read-only Point2D vectorWithForce property.

  • getCenter ()

    Returns the joystick's center as a javafx.geometry.Point2D AJO. The bridge dispatches through the on-create-view callback when registered.