mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-23 04:15:28 +00:00
android: fix deadzone calculation
This commit is contained in:
parent
13b29c3f49
commit
e5bdb7011b
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue