Add controller touchpad support

This commit is contained in:
Cameron Gutman
2023-06-24 19:09:10 -05:00
parent 5c6eaf2602
commit eed4327d26
2 changed files with 95 additions and 0 deletions

View File

@@ -1454,11 +1454,15 @@ public class Game extends Activity implements SurfaceHolder.Callback,
}
int eventSource = event.getSource();
int deviceSources = event.getDevice() != null ? event.getDevice().getSources() : 0;
if ((eventSource & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
if (controllerHandler.handleMotionEvent(event)) {
return true;
}
}
else if ((deviceSources & InputDevice.SOURCE_CLASS_JOYSTICK) != 0 && controllerHandler.tryHandleTouchpadEvent(event)) {
return true;
}
else if ((eventSource & InputDevice.SOURCE_CLASS_POINTER) != 0 ||
(eventSource & InputDevice.SOURCE_CLASS_POSITION) != 0 ||
eventSource == InputDevice.SOURCE_MOUSE_RELATIVE)