public class AndroidJoyInput extends java.lang.Object implements JoyInput
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"/>
| Modifier and Type | Field and Description |
|---|---|
static boolean |
disableSensors |
protected AndroidInputHandler |
inputHandler |
protected java.util.List<Joystick> |
joystickList |
AXIS_POV_X, AXIS_POV_Y| Constructor and Description |
|---|
AndroidJoyInput(AndroidInputHandler inputHandler) |
| Modifier and Type | Method and Description |
|---|---|
void |
addEvent(InputEvent event) |
void |
destroy()
Ceases listening to events from the device.
|
long |
getInputTimeNanos() |
void |
initialize()
Initializes the native side to listen into events from the device.
|
boolean |
isInitialized() |
Joystick[] |
loadJoysticks(InputManager inputManager)
Loads a list of joysticks from the system.
|
void |
loadSettings(AppSettings settings) |
void |
pauseJoysticks()
Pauses the joystick device listeners to save battery life if they are not needed.
|
void |
resumeJoysticks()
Resumes the joystick device listeners.
|
void |
setInputListener(RawInputListener listener)
Sets the input listener to receive events from this device.
|
void |
setJoyRumble(int joyId,
float amount)
Causes the joystick at
joyId index to rumble with
the given amount. |
void |
setView(android.opengl.GLSurfaceView view) |
void |
update()
Queries the device for input.
|
public static boolean disableSensors
protected AndroidInputHandler inputHandler
protected java.util.List<Joystick> joystickList
public AndroidJoyInput(AndroidInputHandler inputHandler)
public void setView(android.opengl.GLSurfaceView view)
public void loadSettings(AppSettings settings)
public void addEvent(InputEvent event)
public void pauseJoysticks()
public void resumeJoysticks()
public void initialize()
Inputinitialize in interface Inputpublic boolean isInitialized()
isInitialized in interface InputInput.initialize(),
Input.destroy()public void destroy()
Inputpublic void setInputListener(RawInputListener listener)
InputsetInputListener in interface Inputlistener - the desired listenerpublic long getInputTimeNanos()
getInputTimeNanos in interface Inputpublic void setJoyRumble(int joyId,
float amount)
JoyInputjoyId index to rumble with
the given amount.setJoyRumble in interface JoyInputjoyId - The joystick indexamount - Rumble amount. Should be between 0 and 1.public Joystick[] loadJoysticks(InputManager inputManager)
JoyInputloadJoysticks in interface JoyInputinputManager - The input manager requesting to load joystickspublic void update()
Inputupdate in interface InputInput.setInputListener(com.jme3.input.RawInputListener)