Package arc.input

Class InputMultiplexer

java.lang.Object
arc.input.InputMultiplexer
All Implemented Interfaces:
InputProcessor

public class InputMultiplexer extends Object implements InputProcessor
An InputProcessor that delegates to an ordered list of other InputProcessors. Delegation for an event stops if a processor returns true, which indicates that the event was handled.
  • Constructor Details

    • InputMultiplexer

      public InputMultiplexer()
    • InputMultiplexer

      public InputMultiplexer(InputProcessor... processors)
  • Method Details

    • addProcessor

      public void addProcessor(int index, InputProcessor processor)
    • removeProcessor

      public void removeProcessor(int index)
    • addProcessor

      public void addProcessor(InputProcessor processor)
    • removeProcessor

      public void removeProcessor(InputProcessor processor)
    • size

      public int size()
      Returns:
      the number of processors in this multiplexer
    • clear

      public void clear()
    • getProcessors

      public SnapshotSeq<InputProcessor> getProcessors()
    • setProcessors

      public void setProcessors(InputProcessor... processors)
    • setProcessors

      public void setProcessors(Seq<InputProcessor> processors)
    • connected

      public void connected(InputDevice device)
      Description copied from interface: InputProcessor
      Called when an input device is connected.
      Specified by:
      connected in interface InputProcessor
    • disconnected

      public void disconnected(InputDevice device)
      Description copied from interface: InputProcessor
      Called when an input device is disconnected.
      Specified by:
      disconnected in interface InputProcessor
    • keyDown

      public boolean keyDown(KeyCode keycode)
      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 keycode)
      Description copied from interface: InputProcessor
      Called when a key was released
      Specified by:
      keyUp in interface InputProcessor
      Returns:
      whether the input was processed
    • keyTyped

      public boolean keyTyped(char character)
      Description copied from interface: InputProcessor
      Called when a key was typed
      Specified by:
      keyTyped in interface InputProcessor
      Parameters:
      character - The character
      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
    • touchDragged

      public boolean touchDragged(int screenX, int screenY, int pointer)
      Description copied from interface: InputProcessor
      Called when a finger or the mouse was dragged.
      Specified by:
      touchDragged in interface InputProcessor
      pointer - the pointer for the event.
      Returns:
      whether the input was processed
    • mouseMoved

      public boolean mouseMoved(int screenX, int screenY)
      Specified by:
      mouseMoved in interface InputProcessor
      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.