mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
Minor style fixes (early returns) (#1792)
This commit is contained in:
parent
e5c051a437
commit
ffe9a6f72d
@ -114,12 +114,11 @@ func vecToDir(dx, dy int) (Dir, bool) {
|
||||
return DirUp, true
|
||||
}
|
||||
return DirDown, true
|
||||
} else {
|
||||
if dx < 0 {
|
||||
return DirLeft, true
|
||||
}
|
||||
return DirRight, true
|
||||
}
|
||||
if dx < 0 {
|
||||
return DirLeft, true
|
||||
}
|
||||
return DirRight, true
|
||||
}
|
||||
|
||||
// Update updates the current input states.
|
||||
|
@ -211,9 +211,8 @@ func (c *gamepadConfig) IsButtonPressed(b virtualGamepadButton) bool {
|
||||
v := ebiten.GamepadAxisValue(c.gamepadID, a.id)
|
||||
if a.positive {
|
||||
return axisThreshold <= v && v <= 1.0
|
||||
} else {
|
||||
return -1.0 <= v && v <= -axisThreshold
|
||||
}
|
||||
return -1.0 <= v && v <= -axisThreshold
|
||||
}
|
||||
return false
|
||||
}
|
||||
@ -254,9 +253,8 @@ func (c *gamepadConfig) ButtonName(b virtualGamepadButton) string {
|
||||
if ok {
|
||||
if a.positive {
|
||||
return fmt.Sprintf("Axis %d+", a.id)
|
||||
} else {
|
||||
return fmt.Sprintf("Axis %d-", a.id)
|
||||
}
|
||||
return fmt.Sprintf("Axis %d-", a.id)
|
||||
}
|
||||
|
||||
return ""
|
||||
|
Loading…
Reference in New Issue
Block a user