Class KeyboardPlayerInputComponent

java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.input.InputComponent
com.deco2800.game.components.player.KeyboardPlayerInputComponent
All Implemented Interfaces:
com.badlogic.gdx.input.GestureDetector.GestureListener, com.badlogic.gdx.InputProcessor

public class KeyboardPlayerInputComponent extends InputComponent
Input handler for the player for keyboard and touch (mouse) input. This input handler only uses keyboard input.
  • Field Details

  • Constructor Details

    • KeyboardPlayerInputComponent

      public KeyboardPlayerInputComponent()
  • Method Details

    • keyDown

      public boolean keyDown(int keycode)
      Triggers player events on specific keycodes.
      Specified by:
      keyDown in interface com.badlogic.gdx.InputProcessor
      Overrides:
      keyDown in class InputComponent
      Returns:
      whether the input was processed
      See Also:
      • InputProcessor.keyDown(int)
    • keyUp

      public boolean keyUp(int keycode)
      Triggers player events on specific keycodes.
      Specified by:
      keyUp in interface com.badlogic.gdx.InputProcessor
      Overrides:
      keyUp in class InputComponent
      Returns:
      whether the input was processed
      See Also:
      • InputProcessor.keyUp(int)
    • touchDown

      public boolean touchDown(int screenX, int screenY, int pointer, int button)
      Specified by:
      touchDown in interface com.badlogic.gdx.InputProcessor
      Overrides:
      touchDown in class InputComponent
      See Also:
      • InputProcessor.touchDown(int, int, int, int)
    • mouseMoved

      public boolean mouseMoved(int screenX, int screenY)
      Specified by:
      mouseMoved in interface com.badlogic.gdx.InputProcessor
      Overrides:
      mouseMoved in class InputComponent
      See Also:
      • InputProcessor.mouseMoved(int, int)
    • touchUp

      public boolean touchUp(int screenX, int screenY, int pointer, int button)
      Specified by:
      touchUp in interface com.badlogic.gdx.InputProcessor
      Overrides:
      touchUp in class InputComponent
      See Also:
      • InputProcessor.touchUp(int, int, int, int)