public class AndroidTouchInput extends java.lang.Object implements TouchInput
Modifier and Type | Field and Description |
---|---|
protected AndroidInputHandler |
androidInput |
protected int |
numPointers |
ALL, KEYCODE_BACK, KEYCODE_HOME, KEYCODE_MENU, KEYCODE_SEARCH, KEYCODE_VOLUME_DOWN, KEYCODE_VOLUME_UP
Constructor and Description |
---|
AndroidTouchInput(AndroidInputHandler androidInput) |
Modifier and Type | Method and Description |
---|---|
void |
addEvent(InputEvent event) |
void |
destroy()
Ceases listening to events from the device.
|
InputEvent |
generateMouseEvent(TouchEvent event) |
protected int |
getAction(android.view.MotionEvent event) |
TouchEvent |
getFreeTouchEvent() |
android.view.GestureDetector |
getGestureDetector() |
long |
getInputTimeNanos() |
float |
getJmeX(float origX) |
float |
getJmeY(float origY) |
protected int |
getPointerId(android.view.MotionEvent event) |
protected int |
getPointerIndex(android.view.MotionEvent event) |
android.view.ScaleGestureDetector |
getScaleDetector() |
void |
initialize()
Initializes the native side to listen into events from the device.
|
float |
invertX(float origX) |
float |
invertY(float origY) |
boolean |
isInitialized() |
boolean |
isMouseEventsInvertX() |
boolean |
isMouseEventsInvertY() |
boolean |
isSimulateKeyboard() |
boolean |
isSimulateMouse() |
void |
loadSettings(AppSettings settings) |
boolean |
onKey(android.view.KeyEvent event) |
boolean |
onTouch(android.view.MotionEvent event) |
void |
setGestureDetector(android.view.GestureDetector gestureDetector) |
void |
setInputListener(RawInputListener listener)
Sets the input listener to receive events from this device.
|
void |
setOmitHistoricEvents(boolean dontSendHistory)
Set if historic android events should be transmitted, can be used to get better performance and less mem
|
void |
setScaleDetector(android.view.ScaleGestureDetector scaleDetector) |
void |
setSimulateKeyboard(boolean simulate)
Set if keyboard events should be generated
|
void |
setSimulateMouse(boolean simulate)
Set if mouse events should be generated
|
void |
update()
Queries the device for input.
|
protected int numPointers
protected AndroidInputHandler androidInput
public AndroidTouchInput(AndroidInputHandler androidInput)
public android.view.GestureDetector getGestureDetector()
public void setGestureDetector(android.view.GestureDetector gestureDetector)
public android.view.ScaleGestureDetector getScaleDetector()
public void setScaleDetector(android.view.ScaleGestureDetector scaleDetector)
public float invertX(float origX)
public float invertY(float origY)
public float getJmeX(float origX)
public float getJmeY(float origY)
public void loadSettings(AppSettings settings)
protected int getPointerIndex(android.view.MotionEvent event)
protected int getPointerId(android.view.MotionEvent event)
protected int getAction(android.view.MotionEvent event)
public boolean onTouch(android.view.MotionEvent event)
public InputEvent generateMouseEvent(TouchEvent event)
public boolean onKey(android.view.KeyEvent event)
public void initialize()
Input
initialize
in interface Input
public void destroy()
Input
public boolean isInitialized()
isInitialized
in interface Input
Input.initialize()
,
Input.destroy()
public void setInputListener(RawInputListener listener)
Input
setInputListener
in interface Input
listener
- the desired listenerpublic long getInputTimeNanos()
getInputTimeNanos
in interface Input
public void update()
Input
update
in interface Input
Input.setInputListener(com.jme3.input.RawInputListener)
public TouchEvent getFreeTouchEvent()
public void addEvent(InputEvent event)
public void setSimulateMouse(boolean simulate)
TouchInput
setSimulateMouse
in interface TouchInput
simulate
- if mouse events should be generatedpublic boolean isSimulateMouse()
isSimulateMouse
in interface TouchInput
public boolean isMouseEventsInvertX()
public boolean isMouseEventsInvertY()
public void setSimulateKeyboard(boolean simulate)
TouchInput
setSimulateKeyboard
in interface TouchInput
simulate
- if keyboard events should be generatedpublic boolean isSimulateKeyboard()
isSimulateKeyboard
in interface TouchInput
public void setOmitHistoricEvents(boolean dontSendHistory)
TouchInput
setOmitHistoricEvents
in interface TouchInput
dontSendHistory
- turn of historic events if true, false else and default