Class AndroidJoyInput

java.lang.Object
com.jme3.input.android.AndroidJoyInput
All Implemented Interfaces:
com.jme3.input.Input, com.jme3.input.JoyInput
Direct Known Subclasses:
AndroidJoyInput14

public class AndroidJoyInput extends Object implements com.jme3.input.JoyInput
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. 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"/>
Author:
iwgeric
  • Field Details

    • disableSensors

      public static boolean disableSensors
    • inputHandler

      protected AndroidInputHandler inputHandler
    • joystickList

      protected List<com.jme3.input.Joystick> joystickList
  • Constructor Details

  • Method Details

    • setView

      public void setView(android.opengl.GLSurfaceView view)
    • loadSettings

      public void loadSettings(com.jme3.system.AppSettings settings)
    • addEvent

      public void addEvent(com.jme3.input.event.InputEvent event)
    • pauseJoysticks

      public void pauseJoysticks()
      Pauses the joystick device listeners to save battery life if they are not needed. Used to pause when the activity pauses
    • resumeJoysticks

      public void resumeJoysticks()
      Resumes the joystick device listeners. Used to resume when the activity comes to the top of the stack
    • initialize

      public void initialize()
      Specified by:
      initialize in interface com.jme3.input.Input
    • isInitialized

      public boolean isInitialized()
      Specified by:
      isInitialized in interface com.jme3.input.Input
    • destroy

      public void destroy()
      Specified by:
      destroy in interface com.jme3.input.Input
    • setInputListener

      public void setInputListener(com.jme3.input.RawInputListener listener)
      Specified by:
      setInputListener in interface com.jme3.input.Input
    • getInputTimeNanos

      public long getInputTimeNanos()
      Specified by:
      getInputTimeNanos in interface com.jme3.input.Input
    • setJoyRumble

      public void setJoyRumble(int joyId, float amount)
      Specified by:
      setJoyRumble in interface com.jme3.input.JoyInput
    • loadJoysticks

      public com.jme3.input.Joystick[] loadJoysticks(com.jme3.input.InputManager inputManager)
      Specified by:
      loadJoysticks in interface com.jme3.input.JoyInput
    • update

      public void update()
      Specified by:
      update in interface com.jme3.input.Input