mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 19:28:57 +01:00
internal/gamepaddb: Bug fix: ButtonValue must return [0, 1]
This commit is contained in:
parent
0fdec144ef
commit
226378da88
@ -407,9 +407,9 @@ func ButtonValue(id string, button driver.StandardGamepadButton, state GamepadSt
|
||||
case mappingTypeAxis:
|
||||
v := state.Axis(m.Index)*float64(m.AxisScale) + float64(m.AxisOffset)
|
||||
if v > 1 {
|
||||
return 1
|
||||
v = 1
|
||||
} else if v < -1 {
|
||||
return -1
|
||||
v = -1
|
||||
}
|
||||
// Adjust [-1, 1] to [0, 1]
|
||||
return (v + 1) / 2
|
||||
|
Loading…
Reference in New Issue
Block a user