Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Controller

[20:7] extends: FxObj

Wraps FXGL's GameController class from the controllerinput module (com.almasb.fxgl.controllerinput.GameController, distinct from the lifecycle GameController exposed via fxgl.gameController). Named Controller in Aussom to avoid the collision. A Controller exposes the trigger and stick read-only properties plus the button state map. Aussom users obtain one from ControllerInputService.getGameControllers; direct construction requires native SDL2 setup and is not supported here.

Methods

  • Controller ()

    Empty default constructor; populated by adopt.

  • adopt (object Ajo)

    Wraps an existing GameController AussomJavaObject.

    • @p Ajo is an AussomJavaObject around a controllerinput.GameController.
    • @r A new wrapper.
  • getLeftTrigger ()

    Returns the controller's left-trigger value (0.0 - 1.0).

    • @r A double.
  • getRightTrigger ()

    Returns the controller's right-trigger value (0.0 - 1.0).

    • @r A double.
  • getLeftStick ()

    Returns the controller's left-stick position as an AussomJavaObject around a Point2D.

    • @r An AussomJavaObject around a Point2D.
  • getRightStick ()

    Returns the controller's right-stick position as a Point2D.

    • @r An AussomJavaObject around a Point2D.
  • isPressed (string ButtonName)

    Returns true while the named controller button is held. The name maps onto the FXGL VirtualButton enum -- valid values are "A", "B", "X", "Y", "LB", "RB", "UP", "DOWN", "LEFT", "RIGHT".

    • @p ButtonName is the VirtualButton enum name.
    • @r A bool.
  • addInputHandler (object InputObj)

    Routes this controller's button events into the given Input service so virtual button presses fire the matching UserActions.

    • @p InputObj is an Input wrapper.
    • @r this object
  • removeInputHandler (object InputObj)

    Stops routing this controller's button events into the given Input service.

    • @p InputObj is an Input wrapper.
    • @r this object
  • leftTriggerValueProperty ()

    Returns the underlying ReadOnlyDoubleProperty backing the left trigger so callers can bind UI to it.

    • @r An AussomJavaObject around a ReadOnlyDoubleProperty.
  • rightTriggerValueProperty ()

    Returns the underlying ReadOnlyDoubleProperty backing the right trigger.

    • @r An AussomJavaObject around a ReadOnlyDoubleProperty.
  • leftStickValueProperty ()

    Returns the underlying ReadOnlyObjectProperty backing the left stick.

    • @r An AussomJavaObject around a ReadOnlyObjectProperty.
  • rightStickValueProperty ()

    Returns the underlying ReadOnlyObjectProperty backing the right stick.

    • @r An AussomJavaObject around a ReadOnlyObjectProperty.