mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
internal/gamepad: skip gamepads with more than 32 buttons
This change was removed at ef45058037
accidentally.
Updates #1173
Updates #2039
This commit is contained in:
parent
b5a9ff007c
commit
07a7aca1b3
@ -87,6 +87,13 @@ func (g *gamepads) update() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A gamepad can be detected even though there are not. Apparently, some special devices are
|
||||||
|
// recognized as gamepads by OSes. In this case, the number of the 'buttons' can exceeds the
|
||||||
|
// maximum. Skip such devices as a tentative solution (#1173, #2039).
|
||||||
|
g.remove(func(gamepad *Gamepad) bool {
|
||||||
|
return gamepad.ButtonCount() > ButtonNum
|
||||||
|
})
|
||||||
|
|
||||||
for _, gp := range g.gamepads {
|
for _, gp := range g.gamepads {
|
||||||
if gp == nil {
|
if gp == nil {
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user