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:
Hajime Hoshi 2022-01-22 21:27:42 +09:00
parent 21fbab8e6b
commit 210036a5a5

View File

@ -54,7 +54,7 @@ func (g *Game) Update() error {
}
for id := range g.gamepadIDs {
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)
}
}