Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: ControllerInputService

[23:7] extends: EngineService

Wraps FXGL's ControllerInputService, the engine service that enumerates plugged-in game controllers (Xbox / PlayStation / generic SDL2-compatible) and exposes their state (button press/release, trigger value, stick position). Controllers must be plugged in before the engine starts; hot plug/unplug is not supported in FXGL 21.1. The service is reached via fxgl.getControllerInputService once the engine is running. Native library loading happens automatically on Linux, macOS, and Windows desktop. On platforms without native bindings the service silently returns an empty controller list.

Methods

  • ControllerInputService ()

    Empty default constructor; populated by adopt.

  • adopt (object Ajo)

    Wraps an existing ControllerInputService AussomJavaObject.

    • @p Ajo is an AussomJavaObject around a ControllerInputService.
    • @r A new wrapper.
  • getGameControllers ()

    Returns the list of plugged-in controllers as a Java ObservableList of GameController objects.

    • @r An AussomJavaObject around an ObservableList.
  • getControllerCount ()

    Returns the number of plugged-in controllers.

    • @r An int.