mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +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 DirUp, true
|
||||||
}
|
}
|
||||||
return DirDown, true
|
return DirDown, true
|
||||||
} else {
|
}
|
||||||
if dx < 0 {
|
if dx < 0 {
|
||||||
return DirLeft, true
|
return DirLeft, true
|
||||||
}
|
}
|
||||||
return DirRight, true
|
return DirRight, true
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update updates the current input states.
|
// Update updates the current input states.
|
||||||
|
@ -211,9 +211,8 @@ func (c *gamepadConfig) IsButtonPressed(b virtualGamepadButton) bool {
|
|||||||
v := ebiten.GamepadAxisValue(c.gamepadID, a.id)
|
v := ebiten.GamepadAxisValue(c.gamepadID, a.id)
|
||||||
if a.positive {
|
if a.positive {
|
||||||
return axisThreshold <= v && v <= 1.0
|
return axisThreshold <= v && v <= 1.0
|
||||||
} else {
|
|
||||||
return -1.0 <= v && v <= -axisThreshold
|
|
||||||
}
|
}
|
||||||
|
return -1.0 <= v && v <= -axisThreshold
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -254,9 +253,8 @@ func (c *gamepadConfig) ButtonName(b virtualGamepadButton) string {
|
|||||||
if ok {
|
if ok {
|
||||||
if a.positive {
|
if a.positive {
|
||||||
return fmt.Sprintf("Axis %d+", a.id)
|
return fmt.Sprintf("Axis %d+", a.id)
|
||||||
} else {
|
|
||||||
return fmt.Sprintf("Axis %d-", a.id)
|
|
||||||
}
|
}
|
||||||
|
return fmt.Sprintf("Axis %d-", a.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
Loading…
Reference in New Issue
Block a user