I'm trying to add gamepad support to my game, but I can't find anywhere else to get movement events from the gamepad joystick.
I have something like this, but it never seems to have called or done anything. I am testing XOOM with JellyBean and my gamepad works for menu navigation.
@Override public boolean onGenericMotionEvent(MotionEvent e) { if ((e.getDevice().getSources() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) { float x = e.getX(); float y = e.getY(); mJoy1.set(x, y); mJoy2.set(-1,1); mRenderer.onAxisMoved(mJoy1, mJoy2); return true; } return false; }
How do I switch to reading axis data from a gamepad?
source share