From b1c55f395f0d466cf1d05b5c4319d3c8702e3758 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 30 Apr 2018 03:07:02 +0900 Subject: [PATCH] examples/gamepad: Refactoring --- examples/gamepad/main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/gamepad/main.go b/examples/gamepad/main.go index 4b3d71957..52f5530c8 100644 --- a/examples/gamepad/main.go +++ b/examples/gamepad/main.go @@ -33,10 +33,6 @@ const ( ) func update(screen *ebiten.Image) error { - ids := ebiten.GamepadIDs() - axes := map[int][]string{} - pressedButtons := map[int][]string{} - for _, id := range inpututil.JustConnectedGamepadIDs() { log.Printf("gamepad connected: id: %d", id) } @@ -44,6 +40,10 @@ func update(screen *ebiten.Image) error { log.Printf("gamepad disconnected: id: %d", id) } + ids := ebiten.GamepadIDs() + axes := map[int][]string{} + pressedButtons := map[int][]string{} + for _, id := range ids { maxAxis := ebiten.GamepadAxisNum(id) for a := 0; a < maxAxis; a++ {