summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2023-05-01 06:34:26 +0200
committerbunnei <bunneidev@gmail.com>2023-06-03 09:05:58 +0200
commite5bdb7011be06b05d166e9375a9b94c971e125ba (patch)
tree926400d8c2b1de5d6e4fe93c97a6a9e0102bfe52 /src
parentandroid: Fix background color when starting emulation (diff)
downloadyuzu-e5bdb7011be06b05d166e9375a9b94c971e125ba.tar
yuzu-e5bdb7011be06b05d166e9375a9b94c971e125ba.tar.gz
yuzu-e5bdb7011be06b05d166e9375a9b94c971e125ba.tar.bz2
yuzu-e5bdb7011be06b05d166e9375a9b94c971e125ba.tar.lz
yuzu-e5bdb7011be06b05d166e9375a9b94c971e125ba.tar.xz
yuzu-e5bdb7011be06b05d166e9375a9b94c971e125ba.tar.zst
yuzu-e5bdb7011be06b05d166e9375a9b94c971e125ba.zip
Diffstat (limited to 'src')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InputHandler.kt16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InputHandler.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InputHandler.kt
index 4303939ef..78b978fb5 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InputHandler.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InputHandler.kt
@@ -76,10 +76,18 @@ class InputHandler {
// Adjust range of joystick
val deadzone = 0.15f
- val deadzoneFactor = 1.0f / r * (r - deadzone) / (1.0f - deadzone)
- var x = xAxis * deadzoneFactor
- var y = yAxis * deadzoneFactor
- r *= deadzoneFactor
+ var x = xAxis
+ var y = yAxis
+
+ if (r > deadzone) {
+ val deadzoneFactor = 1.0f / r * (r - deadzone) / (1.0f - deadzone)
+ x *= deadzoneFactor
+ y *= deadzoneFactor
+ r *= deadzoneFactor
+ } else {
+ x = 0.0f
+ y = 0.0f
+ }
// Normalize joystick
if (r > 1.0f) {