Class GamepadExtension

java.lang.Object
org.openpatch.scratch.gamepad.GamepadExtension
All Implemented Interfaces:
Extension

public final class GamepadExtension extends Object implements Extension
Registers the gamepad extension; found through ServiceLoader, learners never see it. Polls the controllers once per batch of ticks (GLFW polling only, never a callback) and turns the changes between ticks into the GamepadListener calls, at the same point of the tick as key events.
  • Constructor Details

    • GamepadExtension

      public GamepadExtension()
  • Method Details

    • id

      public String id()
      Description copied from interface: Extension
      A short unique id such as "tiled", used in messages.
      Specified by:
      id in interface Extension
    • name

      public String name()
      Description copied from interface: Extension
      A name for people, such as "Tiled maps".
      Specified by:
      name in interface Extension
    • version

      public String version()
      Description copied from interface: Extension
      The extension's own version.
      Specified by:
      version in interface Extension
    • requires

      public String requires()
      First-party extensions are released together with the core.
      Specified by:
      requires in interface Extension
    • install

      public void install(ExtensionContext ctx)
      Description copied from interface: Extension
      Adds the extension's hooks. Called once, on the window thread, before the first stage.
      Specified by:
      install in interface Extension
    • useSource

      public static void useSource(GamepadSource s)
      Replaces where the controllers' state comes from, for tests and parity scripts. The new source is read from the next batch of ticks on; null is not allowed.
      Parameters:
      s - the new source
    • getSource

      public static GamepadSource getSource()
      The current source of the controllers' state.