Input

php\gdx\Input

final class

Methods


__construct()

private

getAccelerometerX()
Результат:double The value of the accelerometer on its x-axis. ranges between [-10,10].
getAccelerometerY()
Результат:double The value of the accelerometer on its y-axis. ranges between [-10,10].
getAccelerometerZ()
Результат:double The value of the accelerometer on its y-axis. ranges between [-10,10].
getX($pointer)

Returns the x coordinate of the last touch on touch screen devices and the current mouse position on desktop for the first pointer in screen coordinates. The screen origin is the top left corner.

Параметры:
  • $pointerint - (optional) the pointer id. Returns the x coordinate in screen coordinates of the given pointer.
Результат:

int

getDeltaX($pointer)
Параметры:
  • $pointerint - (optional) the pointer id.
Результат:

int the different between the current pointer location and the last pointer location on the x-axis.

getY($pointer)

Returns the y coordinate of the last touch on touch screen devices and the current mouse position on desktop for the first pointer in screen coordinates. The screen origin is the top left corner.

Параметры:
  • $pointerint - (optional) the pointer id. Returns the y coordinate in screen coordinates of the given pointer.
Результат:

int

getDeltaY($pointer)
Параметры:
  • $pointerint - (optional) the pointer id.
Результат:

int the different between the current pointer location and the last pointer location on the y-axis.

isTouched($pointer)
Параметры:
  • $pointerint - (optional)
Результат:

bool whether the screen is currently touched.

justTouched()
Результат:bool whether a new touch down event just occurred.
isButtonPressed($button)

Whether a given button is pressed or not. Button constants can be found in {@link Buttons}. On Android only the Button#LEFT constant is meaningful.

Параметры:
  • $buttonint
Результат:

bool

isKeyPressed($key)

Returns whether the key is pressed.

Параметры:
  • $keyint
setOnscreenKeyboardVisible($visible)

Sets the on-screen keyboard visible if available.

Параметры:
  • $visiblebool
vibrate($millis)

Vibrates for the given amount of time. Note that you’ll need the permission <code> <uses-permission android:name=”android.permission.VIBRATE” /></code> in your manifest file in order for this to work.

Параметры:
  • $millisint - the number of milliseconds to vibrate.
cancelVibrate()
getAzimuth()

The azimuth is the angle of the device’s orientation around the z-axis. The positive z-axis points towards the earths center.

Результат:double
getPitch()

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.

Результат:double
getRoll()

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.

Результат:double
getCurrentEventTime()
Результат:int the time of the event currently reported to the InputProcessor.
setCatchBackKey($catchBack)

Sets whether the BACK button on Android should be caught. This will prevent the app from being paused. Will have no effect on the desktop.

Параметры:
  • $catchBackbool
setCatchMenuKey($catchMenu)

Sets whether the MENU button on Android should be caught. This will prevent the onscreen keyboard to show up. Will have no effect on the desktop.

Параметры:
  • $catchMenubool
getRotation()
Результат:int the rotation of the device with respect to its native orientation.
getNativeOrientation()
Результат:string the native orientation of the device.
setCursorCatched($catched)

Only viable on the desktop. Will confine the mouse cursor location to the window and hide the mouse cursor.

Параметры:
  • $catchedbool - whether to catch or not to catch the mouse cursor
isCursorCatched()
Результат:bool whether the mouse cursor is catched.
setCursorPosition($x, $y)

Only viable on the desktop. Will set the mouse cursor location to the given window coordinates (origin top-left corner).

Параметры:
  • $xint
  • $yint
setCursorImage($pixmap, $xHotspot, $yHotspot)

Only viable on the desktop. Will set the mouse cursor image to the image represented by the Pixmap. The Pixmap must be in RGBA8888 format, width & height must be powers-of-two greater than zero (not necessarily equal), and alpha transparency must be single-bit (i.e., 0x00 or 0xFF only). To revert to the default operating system cursor, pass in a null Pixmap; xHotspot & yHotspot are ignored in this case.

Параметры: