From c3b4b92fa2233f4b789cdf5ae9433aae1c2f55c8 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 16 Oct 2021 20:09:36 +0900 Subject: [PATCH] internal/uidriver/mobile: Reduce calling make --- internal/uidriver/mobile/input.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/uidriver/mobile/input.go b/internal/uidriver/mobile/input.go index 8e9c9d8a1..cbf56b39c 100644 --- a/internal/uidriver/mobile/input.go +++ b/internal/uidriver/mobile/input.go @@ -205,14 +205,14 @@ func (i *Input) update(keys map[driver.Key]struct{}, runes []rune, touches []Tou i.keys[k] = struct{}{} } - i.runes = make([]rune, len(runes)) - copy(i.runes, runes) + i.runes = i.runes[:0] + i.runes = append(i.runes, runes...) - i.touches = make([]Touch, len(touches)) - copy(i.touches, touches) + i.touches = i.touches[:0] + i.touches = append(i.touches, touches...) - i.gamepads = make([]Gamepad, len(gamepads)) - copy(i.gamepads, gamepads) + i.gamepads = i.gamepads[:0] + i.gamepads = append(i.gamepads, gamepads...) } func (i *Input) resetForFrame() {