com.badlogic.gdx.backends.android
Class AndroidInput

java.lang.Object
  extended by com.badlogic.gdx.backends.android.AndroidInput
All Implemented Interfaces:
android.view.View.OnKeyListener, android.view.View.OnTouchListener, Input
Direct Known Subclasses:
AndroidInputThreePlus

public class AndroidInput
extends Object
implements Input, android.view.View.OnKeyListener, android.view.View.OnTouchListener

Author:
jshapcot

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.badlogic.gdx.Input
Input.Buttons, Input.Keys, Input.Orientation, Input.Peripheral, Input.TextInputListener
 
Field Summary
 boolean accelerometerAvailable
           
 
Constructor Summary
AndroidInput(Application activity, android.content.Context context, Object view, AndroidApplicationConfiguration config)
           
 
Method Summary
 void addKeyListener(android.view.View.OnKeyListener listener)
           
 void cancelVibrate()
           
 float getAccelerometerX()
           
 float getAccelerometerY()
           
 float getAccelerometerZ()
           
 float getAzimuth()
           
 long getCurrentEventTime()
           
 int getDeltaX()
           
 int getDeltaX(int pointer)
           
 int getDeltaY()
           
 int getDeltaY(int pointer)
           
 int getFreePointerIndex()
           
 InputProcessor getInputProcessor()
           
 Input.Orientation getNativeOrientation()
           
 float getPitch()
           
 void getPlaceholderTextInput(Input.TextInputListener listener, String title, String placeholder)
           
 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(Input.TextInputListener listener, String title, String text)
           
 int getX()
           
 int getX(int pointer)
           
 int getY()
           
 int getY(int pointer)
           
 boolean isButtonPressed(int button)
           
 boolean isCursorCatched()
           
 boolean isKeyPressed(int key)
           
 boolean isPeripheralAvailable(Input.Peripheral peripheral)
           
 boolean isTouched()
           
 boolean isTouched(int pointer)
           
 boolean justTouched()
           
 int lookUpPointerIndex(int pointerId)
           
 void onDrop(int x, int y)
          Called in AndroidLiveWallpaperService on drop
 boolean onKey(android.view.View v, int keyCode, android.view.KeyEvent e)
           
 void onTap(int x, int y)
          Called in AndroidLiveWallpaperService on tap
 boolean onTouch(android.view.View view, android.view.MotionEvent event)
           
 void setCatchBackKey(boolean catchBack)
           
 void setCatchMenuKey(boolean catchMenu)
           
 void setCursorCatched(boolean catched)
           
 void setCursorImage(Pixmap pixmap, int xHotspot, int yHotspot)
           
 void setCursorPosition(int x, int y)
           
 void setInputProcessor(InputProcessor processor)
           
 void setOnscreenKeyboardVisible(boolean visible)
           
 void vibrate(int milliseconds)
           
 void vibrate(long[] pattern, int repeat)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

accelerometerAvailable

public boolean accelerometerAvailable
Constructor Detail

AndroidInput

public AndroidInput(Application activity,
                    android.content.Context context,
                    Object view,
                    AndroidApplicationConfiguration config)
Method Detail

getAccelerometerX

public float getAccelerometerX()
Specified by:
getAccelerometerX in interface Input

getAccelerometerY

public float getAccelerometerY()
Specified by:
getAccelerometerY in interface Input

getAccelerometerZ

public float getAccelerometerZ()
Specified by:
getAccelerometerZ in interface Input

getTextInput

public void getTextInput(Input.TextInputListener listener,
                         String title,
                         String text)
Specified by:
getTextInput in interface Input

getPlaceholderTextInput

public void getPlaceholderTextInput(Input.TextInputListener listener,
                                    String title,
                                    String placeholder)
Specified by:
getPlaceholderTextInput in interface Input

getX

public int getX()
Specified by:
getX in interface Input

getY

public int getY()
Specified by:
getY in interface Input

getX

public int getX(int pointer)
Specified by:
getX in interface Input

getY

public int getY(int pointer)
Specified by:
getY in interface Input

isTouched

public boolean isTouched(int pointer)
Specified by:
isTouched in interface Input

isKeyPressed

public boolean isKeyPressed(int key)
Specified by:
isKeyPressed in interface Input

isTouched

public boolean isTouched()
Specified by:
isTouched in interface Input

setInputProcessor

public void setInputProcessor(InputProcessor processor)
Specified by:
setInputProcessor in interface Input

onTouch

public boolean onTouch(android.view.View view,
                       android.view.MotionEvent event)
Specified by:
onTouch in interface android.view.View.OnTouchListener

onTap

public void onTap(int x,
                  int y)
Called in AndroidLiveWallpaperService on tap

Parameters:
x -
y -

onDrop

public void onDrop(int x,
                   int y)
Called in AndroidLiveWallpaperService on drop

Parameters:
x -
y -

onKey

public boolean onKey(android.view.View v,
                     int keyCode,
                     android.view.KeyEvent e)
Specified by:
onKey in interface android.view.View.OnKeyListener

setOnscreenKeyboardVisible

public void setOnscreenKeyboardVisible(boolean visible)
Specified by:
setOnscreenKeyboardVisible in interface Input

setCatchBackKey

public void setCatchBackKey(boolean catchBack)
Specified by:
setCatchBackKey in interface Input

setCatchMenuKey

public void setCatchMenuKey(boolean catchMenu)
Specified by:
setCatchMenuKey in interface Input

vibrate

public void vibrate(int milliseconds)
Specified by:
vibrate in interface Input

vibrate

public void vibrate(long[] pattern,
                    int repeat)
Specified by:
vibrate in interface Input

cancelVibrate

public void cancelVibrate()
Specified by:
cancelVibrate in interface Input

justTouched

public boolean justTouched()
Specified by:
justTouched in interface Input

isButtonPressed

public boolean isButtonPressed(int button)
Specified by:
isButtonPressed in interface Input

getRotationMatrix

public void getRotationMatrix(float[] matrix)
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.

Specified by:
getRotationMatrix in interface Input
Parameters:
matrix -

getAzimuth

public float getAzimuth()
Specified by:
getAzimuth in interface Input

getPitch

public float getPitch()
Specified by:
getPitch in interface Input

getRoll

public float getRoll()
Specified by:
getRoll in interface Input

getInputProcessor

public InputProcessor getInputProcessor()
Specified by:
getInputProcessor in interface Input

isPeripheralAvailable

public boolean isPeripheralAvailable(Input.Peripheral peripheral)
Specified by:
isPeripheralAvailable in interface Input

getFreePointerIndex

public int getFreePointerIndex()

lookUpPointerIndex

public int lookUpPointerIndex(int pointerId)

getRotation

public int getRotation()
Specified by:
getRotation in interface Input

getNativeOrientation

public Input.Orientation getNativeOrientation()
Specified by:
getNativeOrientation in interface Input

setCursorCatched

public void setCursorCatched(boolean catched)
Specified by:
setCursorCatched in interface Input

isCursorCatched

public boolean isCursorCatched()
Specified by:
isCursorCatched in interface Input

getDeltaX

public int getDeltaX()
Specified by:
getDeltaX in interface Input

getDeltaX

public int getDeltaX(int pointer)
Specified by:
getDeltaX in interface Input

getDeltaY

public int getDeltaY()
Specified by:
getDeltaY in interface Input

getDeltaY

public int getDeltaY(int pointer)
Specified by:
getDeltaY in interface Input

setCursorPosition

public void setCursorPosition(int x,
                              int y)
Specified by:
setCursorPosition in interface Input

setCursorImage

public void setCursorImage(Pixmap pixmap,
                           int xHotspot,
                           int yHotspot)
Specified by:
setCursorImage in interface Input

getCurrentEventTime

public long getCurrentEventTime()
Specified by:
getCurrentEventTime in interface Input

addKeyListener

public void addKeyListener(android.view.View.OnKeyListener listener)


Copyright © 2013. All Rights Reserved.