Package arc.input

Class KeyboardDevice

java.lang.Object
arc.input.InputDevice
arc.input.KeyboardDevice
All Implemented Interfaces:
InputProcessor

public class KeyboardDevice extends InputDevice implements InputProcessor
  • Constructor Details

    • KeyboardDevice

      public KeyboardDevice()
  • Method Details

    • postUpdate

      public void postUpdate()
      Description copied from class: InputDevice
      Called at the end of the update loop.
      Overrides:
      postUpdate in class InputDevice
    • isPressed

      public boolean isPressed(KeyCode key)
      Specified by:
      isPressed in class InputDevice
      Returns:
      whether the button is currently pressed.
    • isTapped

      public boolean isTapped(KeyCode key)
      Specified by:
      isTapped in class InputDevice
      Returns:
      whether button was pressed down this frame.
    • isReleased

      public boolean isReleased(KeyCode key)
      Specified by:
      isReleased in class InputDevice
      Returns:
      whether this button was released this frame.
    • getAxis

      public float getAxis(KeyCode keyCode)
      Specified by:
      getAxis in class InputDevice
      Returns:
      an axis tilt value, usually -1 to 1; 0 for non-axes.
    • keyDown

      public boolean keyDown(KeyCode key)
      Description copied from interface: InputProcessor
      Called when a key was pressed
      Specified by:
      keyDown in interface InputProcessor
      Returns:
      whether the input was processed
    • keyUp

      public boolean keyUp(KeyCode key)
      Description copied from interface: InputProcessor
      Called when a key was released
      Specified by:
      keyUp in interface InputProcessor
      Returns:
      whether the input was processed
    • touchDown

      public boolean touchDown(int screenX, int screenY, int pointer, KeyCode button)
      Specified by:
      touchDown in interface InputProcessor
      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

      public boolean touchUp(int screenX, int screenY, int pointer, KeyCode button)
      Specified by:
      touchUp in interface InputProcessor
      pointer - the pointer for the event.
      button - the button
      Returns:
      whether the input was processed
    • scrolled

      public boolean scrolled(float amountX, float amountY)
      Description copied from interface: InputProcessor
      Called when the mouse wheel was scrolled. Will not be called on iOS.
      Specified by:
      scrolled in interface InputProcessor
      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.
    • name

      public String name()
      Specified by:
      name in class InputDevice
    • type

      public InputDevice.DeviceType type()
      Specified by:
      type in class InputDevice