internal/gamepaddb: refactoring

This commit is contained in:
Hajime Hoshi 2023-12-24 23:37:31 +09:00
parent 4a2c8212fb
commit 22715cd2d5

View File

@ -410,13 +410,7 @@ func HasStandardAxis(id string, axis StandardAxis) bool {
if mappings == nil { if mappings == nil {
return false return false
} }
return mappings[axis] != nil
mapping := mappings[axis]
if mapping == nil {
return false
}
return true
} }
func AxisValue(id string, axis StandardAxis, state GamepadState) float64 { func AxisValue(id string, axis StandardAxis, state GamepadState) float64 {
@ -467,13 +461,7 @@ func HasStandardButton(id string, button StandardButton) bool {
if mappings == nil { if mappings == nil {
return false return false
} }
return mappings[button] != nil
mapping := mappings[button]
if mapping == nil {
return false
}
return true
} }
func ButtonValue(id string, button StandardButton, state GamepadState) float64 { func ButtonValue(id string, button StandardButton, state GamepadState) float64 {