com.badlogic.gdx
Class InputMultiplexer

java.lang.Object
  extended by com.badlogic.gdx.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.

Author:
Nathan Sweet

Constructor Summary
InputMultiplexer()
           
InputMultiplexer(InputProcessor... processors)
           
 
Method Summary
 void addProcessor(InputProcessor processor)
           
 void addProcessor(int index, InputProcessor processor)
           
 void clear()
           
 Array<InputProcessor> getProcessors()
           
 boolean keyDown(int keycode)
          Called when a key was pressed
 boolean keyTyped(char character)
          Called when a key was typed
 boolean keyUp(int keycode)
          Called when a key was released
 boolean mouseMoved(int screenX, int screenY)
          Called when the mouse was moved without any buttons being pressed.
 void removeProcessor(InputProcessor processor)
           
 void removeProcessor(int index)
           
 boolean scrolled(int amount)
          Called when the mouse wheel was scrolled.
 void setProcessors(Array<InputProcessor> processors)
           
 int size()
           
 boolean touchDown(int screenX, int screenY, int pointer, int button)
          Called when the screen was touched or a mouse button was pressed.
 boolean touchDragged(int screenX, int screenY, int pointer)
          Called when a finger or the mouse was dragged.
 boolean touchUp(int screenX, int screenY, int pointer, int button)
          Called when a finger was lifted or a mouse button was released.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputMultiplexer

public InputMultiplexer()

InputMultiplexer

public InputMultiplexer(InputProcessor... processors)
Method Detail

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()

setProcessors

public void setProcessors(Array<InputProcessor> processors)

getProcessors

public Array<InputProcessor> getProcessors()

keyDown

public boolean keyDown(int keycode)
Description copied from interface: InputProcessor
Called when a key was pressed

Specified by:
keyDown in interface InputProcessor
Parameters:
keycode - one of the constants in Input.Keys
Returns:
whether the input was processed

keyUp

public boolean keyUp(int keycode)
Description copied from interface: InputProcessor
Called when a key was released

Specified by:
keyUp in interface InputProcessor
Parameters:
keycode - one of the constants in Input.Keys
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,
                         int button)
Description copied from interface: InputProcessor
Called when the screen was touched or a mouse button was pressed. The button parameter will be Input.Buttons.LEFT on Android.

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,
                       int button)
Description copied from interface: InputProcessor
Called when a finger was lifted or a mouse button was released. The button parameter will be Input.Buttons.LEFT on Android.

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)
Description copied from interface: InputProcessor
Called when the mouse was moved without any buttons being pressed. Will not be called on Android.

Specified by:
mouseMoved in interface InputProcessor
Returns:
whether the input was processed

scrolled

public boolean scrolled(int amount)
Description copied from interface: InputProcessor
Called when the mouse wheel was scrolled. Will not be called on Android.

Specified by:
scrolled in interface InputProcessor
Parameters:
amount - the scroll amount, -1 or 1 depending on the direction the wheel was scrolled.
Returns:
whether the input was processed.


Copyright © 2013. All Rights Reserved.