mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-03 06:24:27 +01:00
examples/gamepad: do not get an SDL ID from a disconnected gamepad
The result of ebiten.GamepadSDLID should not be reliable for a disconnected gamepad.
This commit is contained in:
parent
21fbab8e6b
commit
210036a5a5
@ -54,7 +54,7 @@ func (g *Game) Update() error {
|
|||||||
}
|
}
|
||||||
for id := range g.gamepadIDs {
|
for id := range g.gamepadIDs {
|
||||||
if inpututil.IsGamepadJustDisconnected(id) {
|
if inpututil.IsGamepadJustDisconnected(id) {
|
||||||
log.Printf("gamepad disconnected: id: %d, SDL ID: %s", id, ebiten.GamepadSDLID(id))
|
log.Printf("gamepad disconnected: id: %d", id)
|
||||||
delete(g.gamepadIDs, id)
|
delete(g.gamepadIDs, id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user