Package arc.input

Interface InputProcessor

All Known Implementing Classes:
DesktopInput, GestureDetector, InputEventQueue, InputHandler, InputMultiplexer, KeyboardDevice, MobileInput, Scene

public interface InputProcessor
An InputProcessor is used to receive input events from the keyboard and the touch screen (mouse on the desktop). For this it has to be registered with the Input.addProcessor(InputProcessor) method. It will be called each frame before the call to ApplicationListener.update(). Each method returns a boolean in case you want to use this with the InputMultiplexer to chain input processors.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Called when an input device is connected.
    default void
    Called when an input device is disconnected.
    default boolean
    keyDown(KeyCode keycode)
    Called when a key was pressed
    default boolean
    keyTyped(char character)
    Called when a key was typed
    default boolean
    keyUp(KeyCode keycode)
    Called when a key was released
    default boolean
    mouseMoved(int screenX, int screenY)
     
    default boolean
    scrolled(float amountX, float amountY)
    Called when the mouse wheel was scrolled.
    default boolean
    touchDown(int screenX, int screenY, int pointer, KeyCode button)
     
    default boolean
    touchDragged(int screenX, int screenY, int pointer)
    Called when a finger or the mouse was dragged.
    default boolean
    touchUp(int screenX, int screenY, int pointer, KeyCode button)
     
  • Method Details

    • connected

      default void connected(InputDevice device)
      Called when an input device is connected.
    • disconnected

      default void disconnected(InputDevice device)
      Called when an input device is disconnected.
    • keyDown

      default boolean keyDown(KeyCode keycode)
      Called when a key was pressed
      Returns:
      whether the input was processed
    • keyUp

      default boolean keyUp(KeyCode keycode)
      Called when a key was released
      Returns:
      whether the input was processed
    • keyTyped

      default boolean keyTyped(char character)
      Called when a key was typed
      Parameters:
      character - The character
      Returns:
      whether the input was processed
    • touchDown

      default boolean touchDown(int screenX, int screenY, int pointer, KeyCode button)
      Parameters:
      screenX - The x coordinate, origin is in the upper left corner
      screenY - The y coordinate, origin is in the upper left corner
      pointer - the pointer for the event.
      button - the button
      Returns:
      whether the input was processed
    • touchUp

      default boolean touchUp(int screenX, int screenY, int pointer, KeyCode button)
      Parameters:
      pointer - the pointer for the event.
      button - the button
      Returns:
      whether the input was processed
    • touchDragged

      default boolean touchDragged(int screenX, int screenY, int pointer)
      Called when a finger or the mouse was dragged.
      Parameters:
      pointer - the pointer for the event.
      Returns:
      whether the input was processed
    • mouseMoved

      default boolean mouseMoved(int screenX, int screenY)
      Returns:
      whether the input was processed
    • scrolled

      default boolean scrolled(float amountX, float amountY)
      Called when the mouse wheel was scrolled. Will not be called on iOS.
      Parameters:
      amountX - the horizontal scroll amount, negative or positive depending on the direction the wheel was scrolled.
      amountY - the vertical scroll amount, negative or positive depending on the direction the wheel was scrolled.
      Returns:
      whether the input was processed.