Package gaiasky.input

Class AbstractGamepadListener

java.lang.Object
gaiasky.input.AbstractGamepadListener
All Implemented Interfaces:
com.badlogic.gdx.controllers.ControllerListener, IObserver, IInputListener
Direct Known Subclasses:
MainGamepadListener, SpacecraftGamepadListener

public abstract class AbstractGamepadListener extends Object implements com.badlogic.gdx.controllers.ControllerListener, IInputListener, IObserver
Contains some utils common to all gamepad listeners.
  • Field Details

    • AXIS_TH

      protected static final double AXIS_TH
      See Also:
    • AXIS_EVT_DELAY

      protected static final long AXIS_EVT_DELAY
      See Also:
    • AXIS_POLL_DELAY

      protected static final long AXIS_POLL_DELAY
      See Also:
    • mappings

      protected IControllerMappings mappings
    • em

      protected final EventManager em
    • pressedKeys

      protected final com.badlogic.gdx.utils.IntSet pressedKeys
    • lastAxisEvtTime

      protected long lastAxisEvtTime
    • lastAxisPollTime

      protected long lastAxisPollTime
  • Constructor Details

    • AbstractGamepadListener

      public AbstractGamepadListener(String mappingsFile)
  • Method Details

    • applyZeroPoint

      protected double applyZeroPoint(double value)
      Zero-point function for the axes.
    • getMappings

      public IControllerMappings getMappings()
    • updateControllerMappings

      public boolean updateControllerMappings(String mappingsFile)
    • addPressedKey

      public void addPressedKey(int keycode)
    • removePressedKey

      public void removePressedKey(int keycode)
    • isKeyPressed

      public boolean isKeyPressed(int keycode)
    • anyPressed

      public boolean anyPressed(int... keys)
      Returns true if any of the keys are pressed
      Parameters:
      keys - The keys to test
      Returns:
      True if any is pressed
    • connected

      public void connected(com.badlogic.gdx.controllers.Controller controller)
      Specified by:
      connected in interface com.badlogic.gdx.controllers.ControllerListener
    • disconnected

      public void disconnected(com.badlogic.gdx.controllers.Controller controller)
      Specified by:
      disconnected in interface com.badlogic.gdx.controllers.ControllerListener
    • update

      public void update()
      Specified by:
      update in interface IInputListener
    • activate

      public void activate()
      Specified by:
      activate in interface IInputListener
    • deactivate

      public void deactivate()
      Specified by:
      deactivate in interface IInputListener
    • notify

      public void notify(Event event, Object source, Object... data)
      Description copied from interface: IObserver
      Event notification call.
      Specified by:
      notify in interface IObserver
      Parameters:
      event - The event type.
      source - The source object, if any.
      data - The data associated with this event.