public class DefaultAndroidInput extends java.lang.Object implements AndroidInput
| Modifier and Type | Field and Description |
|---|---|
boolean |
accelerometerAvailable |
protected float[] |
accelerometerValues |
boolean |
gyroscopeAvailable |
protected float[] |
gyroscopeValues |
protected float[] |
magneticFieldValues |
protected com.badlogic.gdx.Input.Orientation |
nativeOrientation |
static int |
NUM_TOUCHES |
protected float[] |
rotationVectorValues |
static int |
SUPPORTED_KEYS |
protected AndroidTouchHandler |
touchHandler |
protected android.os.Vibrator |
vibrator |
| Constructor and Description |
|---|
DefaultAndroidInput(com.badlogic.gdx.Application activity,
android.content.Context context,
java.lang.Object view,
AndroidApplicationConfiguration config) |
| Modifier and Type | Method and Description |
|---|---|
void |
addGenericMotionListener(android.view.View.OnGenericMotionListener listener)
Add a custom
View.OnGenericMotionListener |
void |
addKeyListener(android.view.View.OnKeyListener listener)
Add a custom
View.OnKeyListener |
void |
cancelVibrate() |
float |
getAccelerometerX() |
float |
getAccelerometerY() |
float |
getAccelerometerZ() |
static int |
getAndroidInputType(com.badlogic.gdx.Input.OnscreenKeyboardType type) |
float |
getAzimuth() |
long |
getCurrentEventTime() |
int |
getDeltaX() |
int |
getDeltaX(int pointer) |
int |
getDeltaY() |
int |
getDeltaY(int pointer) |
int |
getFreePointerIndex() |
float |
getGyroscopeX() |
float |
getGyroscopeY() |
float |
getGyroscopeZ() |
com.badlogic.gdx.InputProcessor |
getInputProcessor() |
int |
getMaxPointers() |
com.badlogic.gdx.Input.Orientation |
getNativeOrientation() |
float |
getPitch() |
float |
getPressure() |
float |
getPressure(int pointer) |
float |
getRoll() |
int |
getRotation() |
void |
getRotationMatrix(float[] matrix)
Returns the rotation matrix describing the devices rotation as per SensorManager#getRotationMatrix(float[], float[], float[], float[]).
|
void |
getTextInput(com.badlogic.gdx.Input.TextInputListener listener,
java.lang.String title,
java.lang.String text,
java.lang.String hint) |
void |
getTextInput(com.badlogic.gdx.Input.TextInputListener listener,
java.lang.String title,
java.lang.String text,
java.lang.String hint,
com.badlogic.gdx.Input.OnscreenKeyboardType keyboardType) |
int |
getX() |
int |
getX(int pointer) |
int |
getY() |
int |
getY(int pointer) |
boolean |
isButtonJustPressed(int button) |
boolean |
isButtonPressed(int button) |
boolean |
isCatchBackKey() |
boolean |
isCatchKey(int keycode) |
boolean |
isCatchMenuKey() |
boolean |
isCursorCatched() |
boolean |
isKeyJustPressed(int key) |
boolean |
isKeyPressed(int key) |
boolean |
isPeripheralAvailable(com.badlogic.gdx.Input.Peripheral peripheral) |
boolean |
isTouched() |
boolean |
isTouched(int pointer) |
boolean |
justTouched() |
int |
lookUpPointerIndex(int pointerId) |
void |
onDreamingStarted()
Called when an
AndroidDaydream is about to start |
void |
onDreamingStopped()
Called when an
AndroidDaydream is about to stop |
boolean |
onGenericMotion(android.view.View view,
android.view.MotionEvent event) |
boolean |
onKey(android.view.View v,
int keyCode,
android.view.KeyEvent e) |
void |
onPause()
Called when the
AndroidApplication is about to pause |
void |
onResume()
Called when the
AndroidApplication is about to resume |
boolean |
onTouch(android.view.View view,
android.view.MotionEvent event) |
void |
processEvents()
Process all events (touch, key) that have been registered by the listeners so that event processing is synchronous.
|
void |
setCatchBackKey(boolean catchBack) |
void |
setCatchKey(int keycode,
boolean catchKey) |
void |
setCatchMenuKey(boolean catchMenu) |
void |
setCursorCatched(boolean catched) |
void |
setCursorPosition(int x,
int y) |
void |
setInputProcessor(com.badlogic.gdx.InputProcessor processor) |
void |
setKeyboardAvailable(boolean available)
Shows/Hides soft screen keyboard
|
void |
setOnscreenKeyboardVisible(boolean visible) |
void |
setOnscreenKeyboardVisible(boolean visible,
com.badlogic.gdx.Input.OnscreenKeyboardType type) |
void |
vibrate(int milliseconds) |
void |
vibrate(long[] pattern,
int repeat) |
public static final int NUM_TOUCHES
public static final int SUPPORTED_KEYS
public boolean accelerometerAvailable
protected final float[] accelerometerValues
public boolean gyroscopeAvailable
protected final float[] gyroscopeValues
protected final AndroidTouchHandler touchHandler
protected final android.os.Vibrator vibrator
protected final float[] magneticFieldValues
protected final float[] rotationVectorValues
protected final com.badlogic.gdx.Input.Orientation nativeOrientation
public DefaultAndroidInput(com.badlogic.gdx.Application activity,
android.content.Context context,
java.lang.Object view,
AndroidApplicationConfiguration config)
public float getAccelerometerX()
getAccelerometerX in interface com.badlogic.gdx.Inputpublic float getAccelerometerY()
getAccelerometerY in interface com.badlogic.gdx.Inputpublic float getAccelerometerZ()
getAccelerometerZ in interface com.badlogic.gdx.Inputpublic float getGyroscopeX()
getGyroscopeX in interface com.badlogic.gdx.Inputpublic float getGyroscopeY()
getGyroscopeY in interface com.badlogic.gdx.Inputpublic float getGyroscopeZ()
getGyroscopeZ in interface com.badlogic.gdx.Inputpublic void getTextInput(com.badlogic.gdx.Input.TextInputListener listener,
java.lang.String title,
java.lang.String text,
java.lang.String hint)
getTextInput in interface com.badlogic.gdx.Inputpublic void getTextInput(com.badlogic.gdx.Input.TextInputListener listener,
java.lang.String title,
java.lang.String text,
java.lang.String hint,
com.badlogic.gdx.Input.OnscreenKeyboardType keyboardType)
getTextInput in interface com.badlogic.gdx.Inputpublic static int getAndroidInputType(com.badlogic.gdx.Input.OnscreenKeyboardType type)
public int getMaxPointers()
getMaxPointers in interface com.badlogic.gdx.Inputpublic int getX()
getX in interface com.badlogic.gdx.Inputpublic int getY()
getY in interface com.badlogic.gdx.Inputpublic int getX(int pointer)
getX in interface com.badlogic.gdx.Inputpublic int getY(int pointer)
getY in interface com.badlogic.gdx.Inputpublic boolean isTouched(int pointer)
isTouched in interface com.badlogic.gdx.Inputpublic float getPressure()
getPressure in interface com.badlogic.gdx.Inputpublic float getPressure(int pointer)
getPressure in interface com.badlogic.gdx.Inputpublic void setKeyboardAvailable(boolean available)
AndroidInputsetKeyboardAvailable in interface AndroidInputpublic boolean isKeyPressed(int key)
isKeyPressed in interface com.badlogic.gdx.Inputpublic boolean isKeyJustPressed(int key)
isKeyJustPressed in interface com.badlogic.gdx.Inputpublic boolean isTouched()
isTouched in interface com.badlogic.gdx.Inputpublic void setInputProcessor(com.badlogic.gdx.InputProcessor processor)
setInputProcessor in interface com.badlogic.gdx.Inputpublic void processEvents()
AndroidInputprocessEvents in interface AndroidInputpublic boolean onTouch(android.view.View view,
android.view.MotionEvent event)
onTouch in interface android.view.View.OnTouchListenerpublic boolean onKey(android.view.View v,
int keyCode,
android.view.KeyEvent e)
onKey in interface android.view.View.OnKeyListenerpublic void setOnscreenKeyboardVisible(boolean visible)
setOnscreenKeyboardVisible in interface com.badlogic.gdx.Inputpublic void setOnscreenKeyboardVisible(boolean visible,
com.badlogic.gdx.Input.OnscreenKeyboardType type)
setOnscreenKeyboardVisible in interface com.badlogic.gdx.Inputpublic void setCatchBackKey(boolean catchBack)
setCatchBackKey in interface com.badlogic.gdx.Inputpublic boolean isCatchBackKey()
isCatchBackKey in interface com.badlogic.gdx.Inputpublic void setCatchMenuKey(boolean catchMenu)
setCatchMenuKey in interface com.badlogic.gdx.Inputpublic boolean isCatchMenuKey()
isCatchMenuKey in interface com.badlogic.gdx.Inputpublic void setCatchKey(int keycode,
boolean catchKey)
setCatchKey in interface com.badlogic.gdx.Inputpublic boolean isCatchKey(int keycode)
isCatchKey in interface com.badlogic.gdx.Inputpublic void vibrate(int milliseconds)
vibrate in interface com.badlogic.gdx.Inputpublic void vibrate(long[] pattern,
int repeat)
vibrate in interface com.badlogic.gdx.Inputpublic void cancelVibrate()
cancelVibrate in interface com.badlogic.gdx.Inputpublic boolean justTouched()
justTouched in interface com.badlogic.gdx.Inputpublic boolean isButtonPressed(int button)
isButtonPressed in interface com.badlogic.gdx.Inputpublic boolean isButtonJustPressed(int button)
isButtonJustPressed in interface com.badlogic.gdx.Inputpublic void getRotationMatrix(float[] matrix)
getRotationMatrix in interface com.badlogic.gdx.Inputmatrix - public float getAzimuth()
getAzimuth in interface com.badlogic.gdx.Inputpublic float getPitch()
getPitch in interface com.badlogic.gdx.Inputpublic float getRoll()
getRoll in interface com.badlogic.gdx.Inputpublic com.badlogic.gdx.InputProcessor getInputProcessor()
getInputProcessor in interface com.badlogic.gdx.Inputpublic boolean isPeripheralAvailable(com.badlogic.gdx.Input.Peripheral peripheral)
isPeripheralAvailable in interface com.badlogic.gdx.Inputpublic int getFreePointerIndex()
public int lookUpPointerIndex(int pointerId)
public int getRotation()
getRotation in interface com.badlogic.gdx.Inputpublic com.badlogic.gdx.Input.Orientation getNativeOrientation()
getNativeOrientation in interface com.badlogic.gdx.Inputpublic void setCursorCatched(boolean catched)
setCursorCatched in interface com.badlogic.gdx.Inputpublic boolean isCursorCatched()
isCursorCatched in interface com.badlogic.gdx.Inputpublic int getDeltaX()
getDeltaX in interface com.badlogic.gdx.Inputpublic int getDeltaX(int pointer)
getDeltaX in interface com.badlogic.gdx.Inputpublic int getDeltaY()
getDeltaY in interface com.badlogic.gdx.Inputpublic int getDeltaY(int pointer)
getDeltaY in interface com.badlogic.gdx.Inputpublic void setCursorPosition(int x,
int y)
setCursorPosition in interface com.badlogic.gdx.Inputpublic long getCurrentEventTime()
getCurrentEventTime in interface com.badlogic.gdx.Inputpublic void addKeyListener(android.view.View.OnKeyListener listener)
AndroidInputView.OnKeyListeneraddKeyListener in interface AndroidInputpublic boolean onGenericMotion(android.view.View view,
android.view.MotionEvent event)
onGenericMotion in interface android.view.View.OnGenericMotionListenerpublic void addGenericMotionListener(android.view.View.OnGenericMotionListener listener)
AndroidInputView.OnGenericMotionListeneraddGenericMotionListener in interface AndroidInputpublic void onPause()
AndroidInputAndroidApplication is about to pauseonPause in interface AndroidInputpublic void onResume()
AndroidInputAndroidApplication is about to resumeonResume in interface AndroidInputpublic void onDreamingStarted()
AndroidInputAndroidDaydream is about to startonDreamingStarted in interface AndroidInputpublic void onDreamingStopped()
AndroidInputAndroidDaydream is about to stoponDreamingStopped in interface AndroidInput