Class InputService

java.lang.Object
com.deco2800.game.input.InputService
All Implemented Interfaces:
GestureDetector.GestureListener, InputProcessor

public class InputService
extends java.lang.Object
implements InputProcessor, GestureDetector.GestureListener
Provides a global access point for handling user input and creating input handlers. All active input handlers should be registered here.

When an input is received, it is passed to registered input handlers in descending priority order and stops as soon as the input is handled.

  • Constructor Summary

    Constructors 
    Constructor Description
    InputService()  
    InputService​(InputFactory inputFactory)  
  • Method Summary

    Modifier and Type Method Description
    boolean fling​(float velocityX, float velocityY, int button)
    Iterates over registered input handlers in descending priority and stops as soon as the input is processed
    InputFactory getInputFactory()
    Get the input factory to create input handlers
    boolean keyDown​(int keycode)
    Iterates over registered input handlers in descending priority and stops as soon as the input is processed.
    boolean keyTyped​(char character)
    Iterates over registered input handlers in descending priority and stops as soon as the input is processed
    boolean keyUp​(int keycode)
    Iterates over registered input handlers in descending priority and stops as soon as the input is processed
    boolean longPress​(float x, float y)
    Iterates over registered input handlers in descending priority and stops as soon as the input is processed
    boolean mouseMoved​(int screenX, int screenY)
    Iterates over registered input handlers in descending priority and stops as soon as the input is processed
    boolean pan​(float x, float y, float deltaX, float deltaY)
    Iterates over registered input handlers in descending priority and stops as soon as the input is processed
    boolean panStop​(float x, float y, int pointer, int button)
    Iterates over registered input handlers in descending priority and stops as soon as the input is processed
    boolean pinch​(Vector2 initialPointer1, Vector2 initialPointer2, Vector2 pointer1, Vector2 pointer2)
    Iterates over registered input handlers in descending priority and stops as soon as the input is processed
    void pinchStop()
    Iterates over registered input handlers in descending priority and stops as soon as the input is processed
    void register​(InputComponent inputHandler)
    Register an input handler based on its priority and reorder inputHandlers.
    boolean scrolled​(float amountX, float amountY)
    Iterates over registered input handlers in descending priority and stops as soon as the input is processed
    boolean tap​(float x, float y, int count, int button)
    Iterates over registered input handlers in descending priority and stops as soon as the input is processed
    boolean touchDown​(float x, float y, int pointer, int button)
    Iterates over registered input handlers in descending priority and stops as soon as the input is processed
    boolean touchDown​(int screenX, int screenY, int pointer, int button)
    Iterates over registered input handlers in descending priority and stops as soon as the input is processed
    boolean touchDragged​(int screenX, int screenY, int pointer)
    Iterates over registered input handlers in descending priority and stops as soon as the input is processed
    boolean touchUp​(int screenX, int screenY, int pointer, int button)
    Iterates over registered input handlers in descending priority and stops as soon as the input is processed
    void unregister​(InputComponent inputHandler)
    Unregister an input handler
    boolean zoom​(float initialDistance, float distance)
    Iterates over registered input handlers in descending priority and stops as soon as the input is processed

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait