Package com.jme3.input.android
Class AndroidTouchInput
java.lang.Object
com.jme3.input.android.AndroidTouchInput
- All Implemented Interfaces:
Input
,TouchInput
- Direct Known Subclasses:
AndroidTouchInput14
AndroidTouchInput is the base class that receives touch inputs from the
Android system and creates the TouchEvents for jME. This class is designed
to handle the base touch events for Android rev 9 (Android 2.3). This is
extended by other classes to add features that were introduced after
Android rev 9.
-
Field Summary
Fields inherited from interface com.jme3.input.TouchInput
ALL, KEYCODE_BACK, KEYCODE_HOME, KEYCODE_MENU, KEYCODE_SEARCH, KEYCODE_VOLUME_DOWN, KEYCODE_VOLUME_UP
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addEvent
(InputEvent event) void
destroy()
Ceases listening to events from the device.generateMouseEvent
(TouchEvent event) protected int
getAction
(android.view.MotionEvent event) android.view.GestureDetector
long
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
void
Initializes the native side to listen into events from the device.float
invertX
(float origX) float
invertY
(float origY) boolean
boolean
boolean
boolean
boolean
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 memvoid
setScaleDetector
(android.view.ScaleGestureDetector scaleDetector) void
setSimulateKeyboard
(boolean simulate) Set if keyboard events should be generatedvoid
setSimulateMouse
(boolean simulate) Set if mouse events should be generatedvoid
update()
Queries the device for input.
-
Field Details
-
numPointers
protected int numPointers -
androidInput
-
-
Constructor Details
-
AndroidTouchInput
-
-
Method Details
-
getGestureDetector
public android.view.GestureDetector getGestureDetector() -
setGestureDetector
public void setGestureDetector(android.view.GestureDetector gestureDetector) -
getScaleDetector
public android.view.ScaleGestureDetector getScaleDetector() -
setScaleDetector
public void setScaleDetector(android.view.ScaleGestureDetector scaleDetector) -
invertX
public float invertX(float origX) -
invertY
public float invertY(float origY) -
getJmeX
public float getJmeX(float origX) -
getJmeY
public float getJmeY(float origY) -
loadSettings
-
getPointerIndex
protected int getPointerIndex(android.view.MotionEvent event) -
getPointerId
protected int getPointerId(android.view.MotionEvent event) -
getAction
protected int getAction(android.view.MotionEvent event) -
onTouch
public boolean onTouch(android.view.MotionEvent event) -
generateMouseEvent
-
onKey
public boolean onKey(android.view.KeyEvent event) -
initialize
public void initialize()Description copied from interface:Input
Initializes the native side to listen into events from the device.- Specified by:
initialize
in interfaceInput
-
destroy
public void destroy()Description copied from interface:Input
Ceases listening to events from the device. -
isInitialized
public boolean isInitialized()- Specified by:
isInitialized
in interfaceInput
- Returns:
- True if the device has been initialized and not destroyed.
- See Also:
-
setInputListener
Description copied from interface:Input
Sets the input listener to receive events from this device. The appropriate events should be dispatched through the callbacks in RawInputListener.- Specified by:
setInputListener
in interfaceInput
- Parameters:
listener
- the desired listener
-
getInputTimeNanos
public long getInputTimeNanos()- Specified by:
getInputTimeNanos
in interfaceInput
- Returns:
- The current absolute time as nanoseconds. This time is expected to be relative to the time given in InputEvents time property.
-
update
public void update()Description copied from interface:Input
Queries the device for input. All events should be sent to the RawInputListener set with setInputListener. -
getFreeTouchEvent
-
addEvent
-
setSimulateMouse
public void setSimulateMouse(boolean simulate) Description copied from interface:TouchInput
Set if mouse events should be generated- Specified by:
setSimulateMouse
in interfaceTouchInput
- Parameters:
simulate
- if mouse events should be generated
-
isSimulateMouse
public boolean isSimulateMouse()- Specified by:
isSimulateMouse
in interfaceTouchInput
- Returns:
- true if mouse event simulation is enabled, false otherwise.
-
isMouseEventsInvertX
public boolean isMouseEventsInvertX() -
isMouseEventsInvertY
public boolean isMouseEventsInvertY() -
setSimulateKeyboard
public void setSimulateKeyboard(boolean simulate) Description copied from interface:TouchInput
Set if keyboard events should be generated- Specified by:
setSimulateKeyboard
in interfaceTouchInput
- Parameters:
simulate
- if keyboard events should be generated
-
isSimulateKeyboard
public boolean isSimulateKeyboard()- Specified by:
isSimulateKeyboard
in interfaceTouchInput
- Returns:
- true if key event simulation is enabled, false otherwise.
-
setOmitHistoricEvents
public void setOmitHistoricEvents(boolean dontSendHistory) Description copied from interface:TouchInput
Set if historic android events should be transmitted, can be used to get better performance and less mem- Specified by:
setOmitHistoricEvents
in interfaceTouchInput
- Parameters:
dontSendHistory
- turn of historic events if true, false else and default- See Also:
-