Merge pull request #11925 from JosJuice/android-fix-dpad

Android: Fix overlay d-pad
This commit is contained in:
Charles Lombardo 2023-06-13 15:08:09 -04:00 committed by GitHub
commit 89e7e7d669
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -206,7 +206,10 @@ class InputOverlay(context: Context?, attrs: AttributeSet?) : SurfaceView(contex
pressed = true pressed = true
} }
} }
}
when (event.action and MotionEvent.ACTION_MASK) {
MotionEvent.ACTION_DOWN,
MotionEvent.ACTION_POINTER_DOWN,
MotionEvent.ACTION_MOVE -> { MotionEvent.ACTION_MOVE -> {
if (dpad.trackId == event.getPointerId(pointerIndex)) { if (dpad.trackId == event.getPointerId(pointerIndex)) {
val dpadPressed = booleanArrayOf(false, false, false, false) val dpadPressed = booleanArrayOf(false, false, false, false)
@ -221,7 +224,7 @@ class InputOverlay(context: Context?, attrs: AttributeSet?) : SurfaceView(contex
dpadPressed[3] = true dpadPressed[3] = true
// Release the buttons first, then press // Release the buttons first, then press
for (i in 1 until dpadPressed.size) { for (i in dpadPressed.indices) {
if (!dpadPressed[i]) { if (!dpadPressed[i]) {
InputOverrider.setControlState( InputOverrider.setControlState(
controllerIndex, controllerIndex,