mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
ui: Avoid creating empty slice at GamepadIDs
This commit is contained in:
parent
57dd7db893
commit
7d9b901ab3
@ -31,9 +31,14 @@ func (i *Input) CursorPosition() (x, y int) {
|
||||
return adjustCursorPosition(i.cursorX, i.cursorY)
|
||||
}
|
||||
|
||||
var emptyIDs = []int{}
|
||||
|
||||
func (i *Input) GamepadIDs() []int {
|
||||
i.m.RLock()
|
||||
defer i.m.RUnlock()
|
||||
if len(i.gamepads) == 0 {
|
||||
return emptyIDs
|
||||
}
|
||||
r := []int{}
|
||||
for id, g := range i.gamepads {
|
||||
if g.valid {
|
||||
|
Loading…
Reference in New Issue
Block a user