Package com.badlogic.gdx.input
Class RemoteSender
- java.lang.Object
-
- com.badlogic.gdx.input.RemoteSender
-
- All Implemented Interfaces:
InputProcessor
public class RemoteSender extends java.lang.Object implements InputProcessor
Sends all inputs from touch, key, accelerometer and compass to aRemoteInputat the given ip/port. Instantiate this and call sendUpdate() periodically.
-
-
Field Summary
Fields Modifier and Type Field Description static intACCELstatic intCOMPASSstatic intGYROstatic intKEY_DOWNstatic intKEY_TYPEDstatic intKEY_UPstatic intSIZEstatic intTOUCH_DOWNstatic intTOUCH_DRAGGEDstatic intTOUCH_UP
-
Constructor Summary
Constructors Constructor Description RemoteSender(java.lang.String ip, int port)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisConnected()booleankeyDown(int keycode)Called when a key was pressedbooleankeyTyped(char character)Called when a key was typedbooleankeyUp(int keycode)Called when a key was releasedbooleanmouseMoved(int x, int y)Called when the mouse was moved without any buttons being pressed.booleanscrolled(float amountX, float amountY)Called when the mouse wheel was scrolled.voidsendUpdate()booleantouchCancelled(int screenX, int screenY, int pointer, int button)Called when the touch gesture is cancelled.booleantouchDown(int x, int y, int pointer, int button)Called when the screen was touched or a mouse button was pressed.booleantouchDragged(int x, int y, int pointer)Called when a finger or the mouse was dragged.booleantouchUp(int x, int y, int pointer, int button)Called when a finger was lifted or a mouse button was released.
-
-
-
Field Detail
-
KEY_DOWN
public static final int KEY_DOWN
- See Also:
- Constant Field Values
-
KEY_UP
public static final int KEY_UP
- See Also:
- Constant Field Values
-
KEY_TYPED
public static final int KEY_TYPED
- See Also:
- Constant Field Values
-
TOUCH_DOWN
public static final int TOUCH_DOWN
- See Also:
- Constant Field Values
-
TOUCH_UP
public static final int TOUCH_UP
- See Also:
- Constant Field Values
-
TOUCH_DRAGGED
public static final int TOUCH_DRAGGED
- See Also:
- Constant Field Values
-
ACCEL
public static final int ACCEL
- See Also:
- Constant Field Values
-
COMPASS
public static final int COMPASS
- See Also:
- Constant Field Values
-
SIZE
public static final int SIZE
- See Also:
- Constant Field Values
-
GYRO
public static final int GYRO
- See Also:
- Constant Field Values
-
-
Method Detail
-
sendUpdate
public void sendUpdate()
-
keyDown
public boolean keyDown(int keycode)
Description copied from interface:InputProcessorCalled when a key was pressed- Specified by:
keyDownin interfaceInputProcessor- Parameters:
keycode- one of the constants inInput.Keys- Returns:
- whether the input was processed
-
keyUp
public boolean keyUp(int keycode)
Description copied from interface:InputProcessorCalled when a key was released- Specified by:
keyUpin interfaceInputProcessor- Parameters:
keycode- one of the constants inInput.Keys- Returns:
- whether the input was processed
-
keyTyped
public boolean keyTyped(char character)
Description copied from interface:InputProcessorCalled when a key was typed- Specified by:
keyTypedin interfaceInputProcessor- Parameters:
character- The character- Returns:
- whether the input was processed
-
touchDown
public boolean touchDown(int x, int y, int pointer, int button)Description copied from interface:InputProcessorCalled when the screen was touched or a mouse button was pressed. The button parameter will beInput.Buttons.LEFTon iOS.- Specified by:
touchDownin interfaceInputProcessor- Parameters:
x- The x coordinate, origin is in the upper left cornery- The y coordinate, origin is in the upper left cornerpointer- the pointer for the event.button- the button- Returns:
- whether the input was processed
-
touchUp
public boolean touchUp(int x, int y, int pointer, int button)Description copied from interface:InputProcessorCalled when a finger was lifted or a mouse button was released. The button parameter will beInput.Buttons.LEFTon iOS.- Specified by:
touchUpin interfaceInputProcessorpointer- the pointer for the event.button- the button- Returns:
- whether the input was processed
-
touchCancelled
public boolean touchCancelled(int screenX, int screenY, int pointer, int button)Description copied from interface:InputProcessorCalled when the touch gesture is cancelled. Reason may be from OS interruption to touch becoming a large surface such as the user cheek). Relevant on Android and iOS only. The button parameter will beInput.Buttons.LEFTon iOS.- Specified by:
touchCancelledin interfaceInputProcessorpointer- the pointer for the event.button- the button- Returns:
- whether the input was processed
-
touchDragged
public boolean touchDragged(int x, int y, int pointer)Description copied from interface:InputProcessorCalled when a finger or the mouse was dragged.- Specified by:
touchDraggedin interfaceInputProcessorpointer- the pointer for the event.- Returns:
- whether the input was processed
-
mouseMoved
public boolean mouseMoved(int x, int y)Description copied from interface:InputProcessorCalled when the mouse was moved without any buttons being pressed. Will not be called on iOS.- Specified by:
mouseMovedin interfaceInputProcessor- Returns:
- whether the input was processed
-
scrolled
public boolean scrolled(float amountX, float amountY)Description copied from interface:InputProcessorCalled when the mouse wheel was scrolled. Will not be called on iOS.- Specified by:
scrolledin interfaceInputProcessor- 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.
-
isConnected
public boolean isConnected()
-
-