Package com.badlogic.gdx
Class AbstractInput
- java.lang.Object
-
- com.badlogic.gdx.AbstractInput
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.badlogic.gdx.Input
Input.Buttons, Input.Keys, Input.OnscreenKeyboardType, Input.Orientation, Input.Peripheral, Input.TextInputListener, Input.VibrationType
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean[]
justPressedKeys
protected boolean
keyJustPressed
protected int
pressedKeyCount
protected boolean[]
pressedKeys
-
Constructor Summary
Constructors Constructor Description AbstractInput()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isCatchBackKey()
boolean
isCatchKey(int keycode)
boolean
isCatchMenuKey()
boolean
isKeyJustPressed(int key)
Returns whether the key has just been pressed.boolean
isKeyPressed(int key)
Returns whether the key is pressed.void
setCatchBackKey(boolean catchBack)
void
setCatchKey(int keycode, boolean catchKey)
Sets whether the given key on Android or GWT should be caught.void
setCatchMenuKey(boolean catchMenu)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.badlogic.gdx.Input
getAccelerometerX, getAccelerometerY, getAccelerometerZ, getAzimuth, getCurrentEventTime, getDeltaX, getDeltaX, getDeltaY, getDeltaY, getGyroscopeX, getGyroscopeY, getGyroscopeZ, getInputProcessor, getMaxPointers, getNativeOrientation, getPitch, getPressure, getPressure, getRoll, getRotation, getRotationMatrix, getTextInput, getTextInput, getX, getX, getY, getY, isButtonJustPressed, isButtonPressed, isCursorCatched, isPeripheralAvailable, isTouched, isTouched, justTouched, setCursorCatched, setCursorPosition, setInputProcessor, setOnscreenKeyboardVisible, setOnscreenKeyboardVisible, vibrate, vibrate, vibrate, vibrate
-
-
-
-
Method Detail
-
isKeyPressed
public boolean isKeyPressed(int key)
Description copied from interface:Input
Returns whether the key is pressed.- Specified by:
isKeyPressed
in interfaceInput
- Parameters:
key
- The key code as found inInput.Keys
.- Returns:
- true or false.
-
isKeyJustPressed
public boolean isKeyJustPressed(int key)
Description copied from interface:Input
Returns whether the key has just been pressed.- Specified by:
isKeyJustPressed
in interfaceInput
- Parameters:
key
- The key code as found inInput.Keys
.- Returns:
- true or false.
-
isCatchBackKey
public boolean isCatchBackKey()
- Specified by:
isCatchBackKey
in interfaceInput
- Returns:
- whether the back button is currently being caught
-
setCatchBackKey
public void setCatchBackKey(boolean catchBack)
- Specified by:
setCatchBackKey
in interfaceInput
- Parameters:
catchBack
- whether to catch the back button
-
isCatchMenuKey
public boolean isCatchMenuKey()
- Specified by:
isCatchMenuKey
in interfaceInput
- Returns:
- whether the menu button is currently being caught
-
setCatchMenuKey
public void setCatchMenuKey(boolean catchMenu)
- Specified by:
setCatchMenuKey
in interfaceInput
- Parameters:
catchMenu
- whether to catch the menu button
-
setCatchKey
public void setCatchKey(int keycode, boolean catchKey)
Description copied from interface:Input
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.- Specified by:
setCatchKey
in interfaceInput
- Parameters:
keycode
- keycode to catchcatchKey
- whether to catch the given keycode
-
isCatchKey
public boolean isCatchKey(int keycode)
- Specified by:
isCatchKey
in interfaceInput
- Parameters:
keycode
- keycode to check if caught- Returns:
- true if the given keycode is configured to be caught
-
-