mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 13:07:26 +01:00
internal/uidriver: Prepare the slice capacities
This commit is contained in:
parent
68411e9591
commit
10e5e9e633
@ -70,9 +70,9 @@ func (i *Input) GamepadIDs() []driver.GamepadID {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var r []driver.GamepadID
|
|
||||||
i.ui.m.RLock()
|
i.ui.m.RLock()
|
||||||
defer i.ui.m.RUnlock()
|
defer i.ui.m.RUnlock()
|
||||||
|
r := make([]driver.GamepadID, 0, len(i.gamepads))
|
||||||
for id, g := range i.gamepads {
|
for id, g := range i.gamepads {
|
||||||
if g.valid {
|
if g.valid {
|
||||||
r = append(r, driver.GamepadID(id))
|
r = append(r, driver.GamepadID(id))
|
||||||
|
@ -113,7 +113,7 @@ func (i *Input) GamepadIDs() []driver.GamepadID {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var r []driver.GamepadID
|
r := make([]driver.GamepadID, 0, i.gamepads)
|
||||||
for id := range i.gamepads {
|
for id := range i.gamepads {
|
||||||
r = append(r, id)
|
r = append(r, id)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user