Don't use DPAD devices as joystick input on Android
This commit is contained in:
parent
cbdd27d273
commit
9e88e62fac
1 changed files with 3 additions and 4 deletions
|
@ -92,17 +92,16 @@ public class SDLControllerManager
|
||||||
if ((sources & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK) {
|
if ((sources & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK) {
|
||||||
Log.v(TAG, "Input device " + device.getName() + " is a joystick.");
|
Log.v(TAG, "Input device " + device.getName() + " is a joystick.");
|
||||||
}
|
}
|
||||||
|
/* A lot of things are a DPAD that we don't want to use as a joystick (e.g. gpio input, etc.)
|
||||||
if ((sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD) {
|
if ((sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD) {
|
||||||
Log.v(TAG, "Input device " + device.getName() + " is a dpad.");
|
Log.v(TAG, "Input device " + device.getName() + " is a dpad.");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if ((sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) {
|
if ((sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) {
|
||||||
Log.v(TAG, "Input device " + device.getName() + " is a gamepad.");
|
Log.v(TAG, "Input device " + device.getName() + " is a gamepad.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return (((sources & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK) ||
|
return ((sources & (InputDevice.SOURCE_CLASS_JOYSTICK|InputDevice.SOURCE_GAMEPAD)) != 0);
|
||||||
((sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD) ||
|
|
||||||
((sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue