Package com.jme3.input.android
Class AndroidSensorJoyInput
- java.lang.Object
-
- com.jme3.input.android.AndroidSensorJoyInput
-
- All Implemented Interfaces:
android.hardware.SensorEventListener
public class AndroidSensorJoyInput extends java.lang.Object implements android.hardware.SensorEventListenerAndroidSensorJoyInput converts the Android Sensor system into Joystick events. A single joystick is configured and includes data for all configured sensors as separate axes of the joystick. Each axis is named according to the static strings in SensorJoystickAxis. Refer to the strings defined in SensorJoystickAxis for a list of supported sensors and their axis data. Each sensor type defined in SensorJoystickAxis will be attempted to be configured. If the device does not support a particular sensor, the axis will return null if joystick.getAxis(String name) is called. The joystick.getXAxis and getYAxis methods of the joystick are configured to return the device orientation values in the device's X and Y directions.- Author:
- iwgeric
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classAndroidSensorJoyInput.AndroidSensorJoystickclassAndroidSensorJoyInput.AndroidSensorJoystickAxis
-
Constructor Summary
Constructors Constructor Description AndroidSensorJoyInput(AndroidJoyInput joyInput)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()com.jme3.input.JoystickloadJoystick(int joyId, com.jme3.input.InputManager inputManager)voidonAccuracyChanged(android.hardware.Sensor sensor, int i)voidonSensorChanged(android.hardware.SensorEvent se)voidpauseSensors()Pauses the sensors to save battery life if the sensors are not needed.voidresumeSensors()Resumes the sensors.voidsetView(android.opengl.GLSurfaceView view)voidupdate()
-
-
-
Constructor Detail
-
AndroidSensorJoyInput
public AndroidSensorJoyInput(AndroidJoyInput joyInput)
-
-
Method Detail
-
setView
public void setView(android.opengl.GLSurfaceView view)
-
pauseSensors
public void pauseSensors()
Pauses the sensors to save battery life if the sensors are not needed. Used to pause sensors when the activity pauses
-
resumeSensors
public void resumeSensors()
Resumes the sensors. Used to resume sensors when the activity comes to the top of the stack
-
loadJoystick
public com.jme3.input.Joystick loadJoystick(int joyId, com.jme3.input.InputManager inputManager)
-
update
public void update()
-
destroy
public void destroy()
-
onSensorChanged
public void onSensorChanged(android.hardware.SensorEvent se)
- Specified by:
onSensorChangedin interfaceandroid.hardware.SensorEventListener
-
onAccuracyChanged
public void onAccuracyChanged(android.hardware.Sensor sensor, int i)- Specified by:
onAccuracyChangedin interfaceandroid.hardware.SensorEventListener
-
-