An Input implementation that receives touch, key, accelerometer and compass events from a remote Android device. Just
instantiate it and specify the port it should listen on for incoming connections (default 8190). Then store the new RemoteInput
instance in Gdx.input. That's it.
On your Android device you can use the gdx-remote application available on the Google Code page as an APK or in SVN (extensions/gdx-remote). Open it, specify the IP address and the port of the PC your libGDX app is running on and then tap away.
The touch coordinates will be translated to the desktop window's coordinate system, no matter the orientation of the device
| Modifier and Type | Class and Description |
|---|---|
| pack-priv class | |
| pack-priv class | |
| public static interface | |
| pack-priv class |
| Modifier and Type | Field and Description |
|---|---|
| private float[] | |
| private float[] | |
| private boolean | |
| public static int | |
| pack-priv int[] | |
| pack-priv int[] | |
| private float[] | |
| public final String[] | |
| pack-priv boolean[] | |
| pack-priv boolean[] | |
| pack-priv boolean | |
| pack-priv int | |
| pack-priv boolean | |
| pack-priv boolean[] | |
| private RemoteInput. | |
| private static final int | |
| private boolean | |
| private final int | |
| pack-priv InputProcessor | |
| private float | |
| private float | |
| private ServerSocket | |
| pack-priv int[] | |
| pack-priv int[] |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | closeTextInputField(boolean sendReturn)
Overrides default com. Closes the native input field and applies the result to the input wrapper. |
| public float | |
| public float | |
| public float | |
| public float | getAzimuth()
Implements com. The azimuth is the angle of the device's orientation around the z-axis. |
| public long | |
| public int | |
| public int | |
| public int | |
| public int | |
| public float | |
| public float | |
| public float | |
| public InputProcessor | |
| public String[] | |
| public int | |
| public Input. | |
| public float | getPitch()
Implements com. The pitch is the angle of the device's orientation around the x-axis. |
| public float | |
| public float | getPressure(int pointer)
Implements com. Returns the pressure of the given pointer, where 0 is untouched. |
| public float | getRoll()
Implements com. The roll is the angle of the device's orientation around the y-axis. |
| public int | |
| public void | getRotationMatrix(float[] matrix)
Implements com. Returns the rotation matrix describing the devices rotation as per SensorManager#getRotationMatrix(float[], float[], float[], float[]). |
| public void | getTextInput(Input.
Implements com. System dependent method to input a string of text. |
| public void | getTextInput(Input.
Implements com. System dependent method to input a string of text. |
| public int | |
| public int | getX(int pointer)
Implements com. Returns the x coordinate in screen coordinates of the given pointer. |
| public int | |
| public int | getY(int pointer)
Implements com. Returns the y coordinate in screen coordinates of the given pointer. |
| public boolean | isButtonJustPressed(int button)
Implements com. Returns whether a given button has just been pressed. |
| public boolean | isButtonPressed(int button)
Implements com. Whether a given button is pressed or not. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | isKeyJustPressed(int key)
Implements com. Returns whether the key has just been pressed. |
| public boolean | isKeyPressed(int key)
Implements com. Returns whether the key is pressed. |
| public boolean | isPeripheralAvailable(Input.
Implements com. Queries whether a |
| public boolean | |
| public boolean | isTouched(int pointer)
Implements com. Whether the screen is currently touched by the pointer with the given index. |
| public boolean | |
| public void | openTextInputField(NativeInputConfiguration configuration)
Implements com. Sets the on-screen keyboard visible if available. |
| public void | |
| public void | setCatchKey(int keycode, boolean catchKey)
Implements com. Sets whether the given key on Android or GWT should be caught. |
| public void | setCursorCatched(boolean catched)
Implements com. Only viable on the desktop. |
| public void | setCursorPosition(int x, int y)
Implements com. Only viable on the desktop. |
| public void | setInputProcessor(InputProcessor processor)
Implements com. Sets the |
| public void | setKeyboardHeightObserver(Input.
Implements com. This will set a keyboard height callback. |
| public void | setOnscreenKeyboardVisible(boolean visible)
Implements com. Sets the on-screen keyboard visible if available. |
| public void | setOnscreenKeyboardVisible(boolean visible, Input.
Implements com. Sets the on-screen keyboard visible if available. |
| public void | vibrate(int milliseconds)
Implements com. Generates a simple haptic effect of a given duration or a vibration effect on devices without haptic capabilities. |
| public void | vibrate(int milliseconds, boolean fallback)
Implements com. Generates a simple haptic effect of a given duration and default amplitude. |
| public void | vibrate(int milliseconds, int amplitude, boolean fallback)
Implements com. Generates a simple haptic effect of a given duration and amplitude. |
| public void | vibrate(Input.
Implements com. Generates a simple haptic effect of a type. |
| accel | back to summary |
|---|---|
| private float[] accel | |
| compass | back to summary |
|---|---|
| private float[] compass | |
| connected | back to summary |
|---|---|
| private boolean connected | |
| DEFAULT_PORT | back to summary |
|---|---|
| public static int DEFAULT_PORT | |
| deltaX | back to summary |
|---|---|
| pack-priv int[] deltaX | |
| deltaY | back to summary |
|---|---|
| pack-priv int[] deltaY | |
| gyrate | back to summary |
|---|---|
| private float[] gyrate | |
| ips | back to summary |
|---|---|
| public final String[] ips | |
| isTouched | back to summary |
|---|---|
| pack-priv boolean[] isTouched | |
| justPressedKeys | back to summary |
|---|---|
| pack-priv boolean[] justPressedKeys | |
| justTouched | back to summary |
|---|---|
| pack-priv boolean justTouched | |
| keyCount | back to summary |
|---|---|
| pack-priv int keyCount | |
| keyJustPressed | back to summary |
|---|---|
| pack-priv boolean keyJustPressed | |
| keys | back to summary |
|---|---|
| pack-priv boolean[] keys | |
| listener | back to summary |
|---|---|
| private RemoteInput. | |
| MAX_TOUCHES | back to summary |
|---|---|
| private static final int MAX_TOUCHES | |
| multiTouch | back to summary |
|---|---|
| private boolean multiTouch | |
| port | back to summary |
|---|---|
| private final int port | |
| processor | back to summary |
|---|---|
| pack-priv InputProcessor processor | |
| remoteHeight | back to summary |
|---|---|
| private float remoteHeight | |
| remoteWidth | back to summary |
|---|---|
| private float remoteWidth | |
| serverSocket | back to summary |
|---|---|
| private ServerSocket serverSocket | |
| touchX | back to summary |
|---|---|
| pack-priv int[] touchX | |
| touchY | back to summary |
|---|---|
| pack-priv int[] touchY | |
| RemoteInput | back to summary |
|---|---|
| public RemoteInput() | |
| RemoteInput | back to summary |
|---|---|
| public RemoteInput(RemoteInput. | |
| RemoteInput | back to summary |
|---|---|
| public RemoteInput(int port) | |
| RemoteInput | back to summary |
|---|---|
| public RemoteInput(int port, RemoteInput. | |
| closeTextInputField | back to summary |
|---|---|
| public void closeTextInputField(boolean sendReturn) Overrides default com. Doc from com. Closes the native input field and applies the result to the input wrapper.
| |
| getAccelerometerX | back to summary |
|---|---|
| public float getAccelerometerX() Implements com.
| |
| getAccelerometerY | back to summary |
|---|---|
| public float getAccelerometerY() Implements com.
| |
| getAccelerometerZ | back to summary |
|---|---|
| public float getAccelerometerZ() Implements com.
| |
| getAzimuth | back to summary |
|---|---|
| public float getAzimuth() Implements com. Doc from com. The azimuth is the angle of the device's orientation around the z-axis. The positive z-axis points towards the earths center.
| |
| getCurrentEventTime | back to summary |
|---|---|
| public long getCurrentEventTime() Implements com.
| |
| getDeltaX | back to summary |
|---|---|
| public int getDeltaX() Implements com.
| |
| getDeltaX | back to summary |
|---|---|
| public int getDeltaX(int pointer) Implements com.
| |
| getDeltaY | back to summary |
|---|---|
| public int getDeltaY() Implements com.
| |
| getDeltaY | back to summary |
|---|---|
| public int getDeltaY(int pointer) Implements com.
| |
| getGyroscopeX | back to summary |
|---|---|
| public float getGyroscopeX() Implements com.
| |
| getGyroscopeY | back to summary |
|---|---|
| public float getGyroscopeY() Implements com.
| |
| getGyroscopeZ | back to summary |
|---|---|
| public float getGyroscopeZ() Implements com.
| |
| getInputProcessor | back to summary |
|---|---|
| public InputProcessor getInputProcessor() Implements com.
| |
| getIPs | back to summary |
|---|---|
public String[] getIPs()
| |
| getMaxPointers | back to summary |
|---|---|
| public int getMaxPointers() Implements com.
| |
| getNativeOrientation | back to summary |
|---|---|
| public Input. Implements com.
| |
| getPitch | back to summary |
|---|---|
| public float getPitch() Implements com. Doc from com. The pitch is the angle of the device's orientation around the x-axis. The positive x-axis roughly points to the west and is orthogonal to the z- and y-axis.
| |
| getPressure | back to summary |
|---|---|
| public float getPressure() Implements com.
| |
| getPressure | back to summary |
|---|---|
| public float getPressure(int pointer) Implements com. Doc from com. Returns the pressure of the given pointer, where 0 is untouched. On Android it should be up to 1.0, but it can go above
that slightly and its not consistent between devices. On iOS 1.0 is the normal touch and significantly more of hard touch.
Check relevant manufacturer documentation for details. Check availability with
| |
| getRoll | back to summary |
|---|---|
| public float getRoll() Implements com. Doc from com. The roll is the angle of the device's orientation around the y-axis. The positive y-axis points to the magnetic north pole of the earth.
| |
| getRotation | back to summary |
|---|---|
| public int getRotation() Implements com.
| |
| getRotationMatrix | back to summary |
|---|---|
| public void getRotationMatrix(float[] matrix) Implements com. Doc from com. Returns the rotation matrix describing the devices rotation as per SensorManager#getRotationMatrix(float[], float[], float[], float[]). Does not manipulate the matrix if the platform does not have an accelerometer.
| |
| getTextInput | back to summary |
|---|---|
| public void getTextInput(Input. Implements com. Doc from com. System dependent method to input a string of text. A dialog box will be created with the given title and the given text as
a message for the user. Will use the Default keyboard type. Once the dialog has been closed the provided
| |
| getTextInput | back to summary |
|---|---|
| public void getTextInput(Input. Implements com. Doc from com. System dependent method to input a string of text. A dialog box will be created with the given title and the given text as
a message for the user. Once the dialog has been closed the provided
| |
| getX | back to summary |
|---|---|
| public int getX() Implements com.
| |
| getX | back to summary |
|---|---|
| public int getX(int pointer) Implements com. Doc from com. Returns the x coordinate in screen coordinates of the given pointer. Pointers are indexed from 0 to n. The pointer id identifies the order in which the fingers went down on the screen, e.g. 0 is the first finger, 1 is the second and so on. When two fingers are touched down and the first one is lifted the second one keeps its index. If another finger is placed on the touch screen the first free index will be used.
| |
| getY | back to summary |
|---|---|
| public int getY() Implements com.
| |
| getY | back to summary |
|---|---|
| public int getY(int pointer) Implements com. Doc from com. Returns the y coordinate in screen coordinates of the given pointer. Pointers are indexed from 0 to n. The pointer id identifies the order in which the fingers went down on the screen, e.g. 0 is the first finger, 1 is the second and so on. When two fingers are touched down and the first one is lifted the second one keeps its index. If another finger is placed on the touch screen the first free index will be used.
| |
| isButtonJustPressed | back to summary |
|---|---|
| public boolean isButtonJustPressed(int button) Implements com. Doc from com. Returns whether a given button has just been pressed. Button constants can be found in
| |
| isButtonPressed | back to summary |
|---|---|
| public boolean isButtonPressed(int button) Implements com. Doc from com. Whether a given button is pressed or not. Button constants can be found in
| |
| isCatchKey | back to summary |
|---|---|
| public boolean isCatchKey(int keycode) Implements com.
| |
| isConnected | back to summary |
|---|---|
| public boolean isConnected() | |
| isCursorCatched | back to summary |
|---|---|
| public boolean isCursorCatched() Implements com.
| |
| isKeyJustPressed | back to summary |
|---|---|
| public boolean isKeyJustPressed(int key) Implements com. Doc from com. Returns whether the key has just been pressed.
| |
| isKeyPressed | back to summary |
|---|---|
| public boolean isKeyPressed(int key) Implements com. Doc from com. Returns whether the key is pressed.
| |
| isPeripheralAvailable | back to summary |
|---|---|
| public boolean isPeripheralAvailable(Input. Implements com. Doc from com. Queries whether a
| |
| isTouched | back to summary |
|---|---|
| public boolean isTouched() Implements com.
| |
| isTouched | back to summary |
|---|---|
| public boolean isTouched(int pointer) Implements com. Doc from com. Whether the screen is currently touched by the pointer with the given index. Pointers are indexed from 0 to n. The pointer id identifies the order in which the fingers went down on the screen, e.g. 0 is the first finger, 1 is the second and so on. When two fingers are touched down and the first one is lifted the second one keeps its index. If another finger is placed on the touch screen the first free index will be used.
| |
| justTouched | back to summary |
|---|---|
| public boolean justTouched() Implements com.
| |
| openTextInputField | back to summary |
|---|---|
| public void openTextInputField(NativeInputConfiguration configuration) Implements com. Doc from com. Sets the on-screen keyboard visible if available.
| |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation.
| |
| setCatchKey | back to summary |
|---|---|
| public void setCatchKey(int keycode, boolean catchKey) Implements com. Doc from com. Sets whether the given key on Android or GWT should be caught. No effect on other platforms. All keys that are not caught may be handled by other apps or background processes on Android, or may trigger default browser behaviour on GWT. For example, media or volume buttons are handled by background media players if present, or Space key triggers a scroll. All keys you need to control your game should be caught to prevent unintended behaviour.
| |
| setCursorCatched | back to summary |
|---|---|
| public void setCursorCatched(boolean catched) Implements com. Doc from com. Only viable on the desktop. Will confine the mouse cursor location to the window and hide the mouse cursor. X and y coordinates are still reported as if the mouse was not catched.
| |
| setCursorPosition | back to summary |
|---|---|
| public void setCursorPosition(int x, int y) Implements com. Doc from com. Only viable on the desktop. Will set the mouse cursor location to the given window coordinates (origin top-left corner).
| |
| setInputProcessor | back to summary |
|---|---|
| public void setInputProcessor(InputProcessor processor) Implements com. Doc from com. Sets the
| |
| setKeyboardHeightObserver | back to summary |
|---|---|
| public void setKeyboardHeightObserver(Input. Implements com. Doc from com. This will set a keyboard height callback. This will get called, whenever the keyboard height changes. Note When using openTextInputField, it will report the height of the native input field too.
| |
| setOnscreenKeyboardVisible | back to summary |
|---|---|
| public void setOnscreenKeyboardVisible(boolean visible) Implements com. Doc from com. Sets the on-screen keyboard visible if available. Will use the Default keyboard type.
| |
| setOnscreenKeyboardVisible | back to summary |
|---|---|
| public void setOnscreenKeyboardVisible(boolean visible, Input. Implements com. Doc from com. Sets the on-screen keyboard visible if available.
| |
| vibrate | back to summary |
|---|---|
| public void vibrate(int milliseconds) Implements com. Doc from com. Generates a simple haptic effect of a given duration or a vibration effect on devices without haptic capabilities. Note
that on Android backend you'll need the permission
| |
| vibrate | back to summary |
|---|---|
| public void vibrate(int milliseconds, boolean fallback) Implements com. Doc from com. Generates a simple haptic effect of a given duration and default amplitude. Note that on Android backend you'll need the
permission
| |
| vibrate | back to summary |
|---|---|
| public void vibrate(int milliseconds, int amplitude, boolean fallback) Implements com. Doc from com. Generates a simple haptic effect of a given duration and amplitude. Note that on Android backend you'll need the permission
| |
| vibrate | back to summary |
|---|---|
| public void vibrate(Input. Implements com. Doc from com. Generates a simple haptic effect of a type. VibrationTypes are length/amplitude haptic effect presets that depend on each
device and are defined by manufacturers. Should give most consistent results across devices and OSs. Note that on Android
backend you'll need the permission
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv RemoteInput. | |
| pack-priv RemoteInput. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| keyEvent | back to summary |
|---|---|
| pack-priv RemoteInput. | |
| touchEvent | back to summary |
|---|---|
| pack-priv RemoteInput. | |
| EventTrigger | back to summary |
|---|---|
| public EventTrigger(RemoteInput. | |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv char | |
| pack-priv int | |
| pack-priv long | |
| pack-priv int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| KEY_DOWN | back to summary |
|---|---|
| pack-priv static final int KEY_DOWN | |
| KEY_TYPED | back to summary |
|---|---|
| pack-priv static final int KEY_TYPED | |
| KEY_UP | back to summary |
|---|---|
| pack-priv static final int KEY_UP | |
| keyChar | back to summary |
|---|---|
| pack-priv char keyChar | |
| keyCode | back to summary |
|---|---|
| pack-priv int keyCode | |
| timeStamp | back to summary |
|---|---|
| pack-priv long timeStamp | |
| type | back to summary |
|---|---|
| pack-priv int type | |
| KeyEvent | back to summary |
|---|---|
| pack-priv KeyEvent() | |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void |
| onConnected | back to summary |
|---|---|
| public void onConnected() | |
| onDisconnected | back to summary |
|---|---|
| public void onDisconnected() | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv int | |
| pack-priv long | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv int | |
| pack-priv int | |
| pack-priv int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| pointer | back to summary |
|---|---|
| pack-priv int pointer | |
| timeStamp | back to summary |
|---|---|
| pack-priv long timeStamp | |
| TOUCH_DOWN | back to summary |
|---|---|
| pack-priv static final int TOUCH_DOWN | |
| TOUCH_DRAGGED | back to summary |
|---|---|
| pack-priv static final int TOUCH_DRAGGED | |
| TOUCH_UP | back to summary |
|---|---|
| pack-priv static final int TOUCH_UP | |
| type | back to summary |
|---|---|
| pack-priv int type | |
| x | back to summary |
|---|---|
| pack-priv int x | |
| y | back to summary |
|---|---|
| pack-priv int y | |
| TouchEvent | back to summary |
|---|---|
| pack-priv TouchEvent() | |