File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
android/gradle_project/allegro/src/main/java/org/liballeg/android Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -542,11 +542,14 @@ String getOsVersion()
542
542
private boolean isJoystick (int id ) {
543
543
InputDevice input = InputDevice .getDevice (id );
544
544
int sources = input .getSources ();
545
- if ((sources & InputDevice .SOURCE_JOYSTICK ) == InputDevice .SOURCE_JOYSTICK ) {
546
- return true ;
547
- }
548
- return false ;
545
+
546
+ // the device is a game controller if it has gamepad buttons, control sticks, or both
547
+ boolean hasAnalogSticks = ((sources & InputDevice .SOURCE_JOYSTICK ) == InputDevice .SOURCE_JOYSTICK );
548
+ boolean hasGamepadButtons = ((sources & InputDevice .SOURCE_GAMEPAD ) == InputDevice .SOURCE_GAMEPAD );
549
+
550
+ return hasGamepadButtons || hasAnalogSticks ;
549
551
}
552
+
550
553
public void reconfigureJoysticks () {
551
554
joysticks .clear ();
552
555
You can’t perform that action at this time.
0 commit comments