diff --git a/clients/android/app/src/main/kotlin/io/unom/punktfunk/GamepadNav.kt b/clients/android/app/src/main/kotlin/io/unom/punktfunk/GamepadNav.kt index a9e8994b..dd98af48 100644 --- a/clients/android/app/src/main/kotlin/io/unom/punktfunk/GamepadNav.kt +++ b/clients/android/app/src/main/kotlin/io/unom/punktfunk/GamepadNav.kt @@ -241,7 +241,10 @@ private fun resolveDir(s: NavInputState): NavDir? { if (s.hatY >= 0.5f) return NavDir.DOWN if (s.hatX <= -0.5f) return NavDir.LEFT if (s.hatX >= 0.5f) return NavDir.RIGHT - return if (abs(s.stickY) >= abs(s.stickX)) { + // Horizontal wins an exact |x| == |y| diagonal tie (Y must be strictly greater to take the + // vertical branch), matching the SDL core and Apple nav so a perfect 45° push resolves the + // same on every client. + return if (abs(s.stickY) > abs(s.stickX)) { when { s.stickY <= -STICK_HIGH -> NavDir.UP s.stickY >= STICK_HIGH -> NavDir.DOWN diff --git a/clients/apple/Sources/PunktfunkKit/Gamepad/GamepadMenuInput.swift b/clients/apple/Sources/PunktfunkKit/Gamepad/GamepadMenuInput.swift index fb6d21e6..d162ebeb 100644 --- a/clients/apple/Sources/PunktfunkKit/Gamepad/GamepadMenuInput.swift +++ b/clients/apple/Sources/PunktfunkKit/Gamepad/GamepadMenuInput.swift @@ -140,7 +140,9 @@ public final class GamepadMenuInput { let stick = gamepad.leftThumbstick let x = stick.xAxis.value let y = stick.yAxis.value - if abs(x) > abs(y), abs(x) > deadzone { + // Horizontal wins an exact |x| == |y| diagonal tie (>=), matching the SDL core and Android + // nav so a perfect 45° push resolves to the same direction on every client. + if abs(x) >= abs(y), abs(x) > deadzone { return x > 0 ? .right : .left } else if abs(y) > deadzone { return y > 0 ? .up : .down