Package gaiasky.input

Class AbstractMouseKbdListener

java.lang.Object
com.badlogic.gdx.InputAdapter
com.badlogic.gdx.input.GestureDetector
gaiasky.input.AbstractMouseKbdListener
All Implemented Interfaces:
com.badlogic.gdx.InputProcessor, IInputListener
Direct Known Subclasses:
GameMouseKbdListener, GuiKbdListener, MainMouseKbdListener, SpacecraftMouseKbdListener

public abstract class AbstractMouseKbdListener extends com.badlogic.gdx.input.GestureDetector implements IInputListener
Abstract mouse and keyboard input listener. Provides tracking of pressed keys.
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.badlogic.gdx.input.GestureDetector

    com.badlogic.gdx.input.GestureDetector.GestureAdapter, com.badlogic.gdx.input.GestureDetector.GestureListener
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final AtomicBoolean
     
    protected ICamera
     
    protected long
     
    protected long
     
    protected long
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractMouseKbdListener(com.badlogic.gdx.input.GestureDetector.GestureListener gl, ICamera camera)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    boolean
    allPressed(int... keys)
    Returns true if all keys are pressed
    boolean
    anyPressed(int... keys)
    Returns true if any of the keys are pressed
    void
     
    float
     
    boolean
     
    boolean
    isKeyPressed(int keycode)
     
    boolean
    keyDown(int keycode)
     
    boolean
    keyUp(int keycode)
     
    protected abstract boolean
    Implement key polling here.
    void
     

    Methods inherited from class com.badlogic.gdx.input.GestureDetector

    cancel, invalidateTapSquare, isLongPressed, isLongPressed, isPanning, reset, setLongPressSeconds, setMaxFlingDelay, setTapCountInterval, setTapRectangleSize, setTapSquareSize, touchDown, touchDown, touchDragged, touchDragged, touchUp, touchUp

    Methods inherited from class com.badlogic.gdx.InputAdapter

    keyTyped, mouseMoved, scrolled

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • active

      protected final AtomicBoolean active
    • iCamera

      protected ICamera iCamera
    • minPollTime

      protected long minPollTime
    • minPollInterval

      protected long minPollInterval
    • lastPollTime

      protected long lastPollTime
  • Constructor Details

    • AbstractMouseKbdListener

      protected AbstractMouseKbdListener(com.badlogic.gdx.input.GestureDetector.GestureListener gl, ICamera camera)
  • Method Details

    • keyDown

      public boolean keyDown(int keycode)
      Specified by:
      keyDown in interface com.badlogic.gdx.InputProcessor
      Overrides:
      keyDown in class com.badlogic.gdx.InputAdapter
    • keyUp

      public boolean keyUp(int keycode)
      Specified by:
      keyUp in interface com.badlogic.gdx.InputProcessor
      Overrides:
      keyUp in class com.badlogic.gdx.InputAdapter
    • isKeyPressed

      public boolean isKeyPressed(int keycode)
    • allPressed

      public boolean allPressed(int... keys)
      Returns true if all keys are pressed
      Parameters:
      keys - The keys to test
      Returns:
      True if all are pressed
    • 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
    • getResponseTime

      public float getResponseTime()
    • update

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

      protected abstract boolean pollKeys()
      Implement key polling here.
      Returns:
      True if an action was successfully executed.
    • isActive

      public boolean isActive()
    • activate

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

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