Package com.jme3.input.android
Class AndroidJoyInput
java.lang.Object
com.jme3.input.android.AndroidJoyInput
- Direct Known Subclasses:
- AndroidJoyInput14
Main class that manages various joystick devices.  Joysticks can be many forms
 including a simulated joystick to communicate the device orientation as well
 as physical gamepads. 
This class manages all the joysticks and feeds the inputs from each back to jME's InputManager. This handler also supports the joystick.rumble(rumbleAmount) method. In this case, when joystick.rumble(rumbleAmount) is called, the Android device will vibrate if the device has a built-in vibrate motor. Because Android does not allow for the user to define the intensity of the vibration, the rumble amount (ie strength) is converted into vibration pulses The stronger the strength amount, the shorter the delay between pulses. If amount is 1, then the vibration stays on the whole time. If amount is 0.5, the vibration will a pulse of equal parts vibration and delay. To turn off vibration, set rumble amount to 0. MainActivity needs the following line to enable Joysticks on Android platforms joystickEventsEnabled = true; This is done to allow for battery conservation when sensor data or gamepads are not required by the application.
This class manages all the joysticks and feeds the inputs from each back to jME's InputManager. This handler also supports the joystick.rumble(rumbleAmount) method. In this case, when joystick.rumble(rumbleAmount) is called, the Android device will vibrate if the device has a built-in vibrate motor. Because Android does not allow for the user to define the intensity of the vibration, the rumble amount (ie strength) is converted into vibration pulses The stronger the strength amount, the shorter the delay between pulses. If amount is 1, then the vibration stays on the whole time. If amount is 0.5, the vibration will a pulse of equal parts vibration and delay. To turn off vibration, set rumble amount to 0. MainActivity needs the following line to enable Joysticks on Android platforms joystickEventsEnabled = true; This is done to allow for battery conservation when sensor data or gamepads are not required by the application.
 To use the joystick rumble feature, the following line needs to be
 added to the Android Manifest File
     <uses-permission android:name="android.permission.VIBRATE"/>
 - 
Field SummaryFieldsFields inherited from interface com.jme3.input.JoyInputAXIS_POV_X, AXIS_POV_Y
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddEvent(InputEvent event) voiddestroy()Ceases listening to events from the device.longvoidInitializes the native side to listen into events from the device.booleanJoystick[]loadJoysticks(InputManager inputManager) Loads a list of joysticks from the system.voidloadSettings(AppSettings settings) voidPauses the joystick device listeners to save battery life if they are not needed.voidResumes the joystick device listeners.voidsetInputListener(RawInputListener listener) Sets the input listener to receive events from this device.voidsetJoyRumble(int joyId, float amount) Causes the joystick atjoyIdindex to rumble with the given amount.voidsetView(android.opengl.GLSurfaceView view) voidupdate()Queries the device for input.
- 
Field Details- 
disableSensorspublic static boolean disableSensors
- 
inputHandler
- 
joystickList
 
- 
- 
Constructor Details- 
AndroidJoyInput
 
- 
- 
Method Details- 
setViewpublic void setView(android.opengl.GLSurfaceView view) 
- 
loadSettings
- 
addEvent
- 
pauseJoystickspublic void pauseJoysticks()Pauses the joystick device listeners to save battery life if they are not needed. Used to pause when the activity pauses
- 
resumeJoystickspublic void resumeJoysticks()Resumes the joystick device listeners. Used to resume when the activity comes to the top of the stack
- 
initializepublic void initialize()Description copied from interface:InputInitializes the native side to listen into events from the device.- Specified by:
- initializein interface- Input
 
- 
isInitializedpublic boolean isInitialized()- Specified by:
- isInitializedin interface- Input
- Returns:
- True if the device has been initialized and not destroyed.
- See Also:
 
- 
destroypublic void destroy()Description copied from interface:InputCeases listening to events from the device.
- 
setInputListenerDescription copied from interface:InputSets the input listener to receive events from this device. The appropriate events should be dispatched through the callbacks in RawInputListener.- Specified by:
- setInputListenerin interface- Input
- Parameters:
- listener- the desired listener
 
- 
getInputTimeNanospublic long getInputTimeNanos()- Specified by:
- getInputTimeNanosin interface- Input
- Returns:
- The current absolute time as nanoseconds. This time is expected to be relative to the time given in InputEvents time property.
 
- 
setJoyRumblepublic void setJoyRumble(int joyId, float amount) Description copied from interface:JoyInputCauses the joystick atjoyIdindex to rumble with the given amount.- Specified by:
- setJoyRumblein interface- JoyInput
- Parameters:
- joyId- The joystick index
- amount- Rumble amount. Should be between 0 and 1.
 
- 
loadJoysticksDescription copied from interface:JoyInputLoads a list of joysticks from the system.- Specified by:
- loadJoysticksin interface- JoyInput
- Parameters:
- inputManager- The input manager requesting to load joysticks
- Returns:
- A list of joysticks that are installed.
 
- 
updatepublic void update()Description copied from interface:InputQueries the device for input. All events should be sent to the RawInputListener set with setInputListener.
 
-