diff --git a/gamepad.go b/gamepad.go index 4367170f4..e9abd28d8 100644 --- a/gamepad.go +++ b/gamepad.go @@ -16,45 +16,46 @@ package ebiten import ( "github.com/hajimehoshi/ebiten/v2/internal/driver" + "github.com/hajimehoshi/ebiten/v2/internal/gamepad" ) // GamepadButton represents a gamepad button. -type GamepadButton = driver.GamepadButton +type GamepadButton = gamepad.Button // GamepadButtons const ( - GamepadButton0 GamepadButton = driver.GamepadButton0 - GamepadButton1 GamepadButton = driver.GamepadButton1 - GamepadButton2 GamepadButton = driver.GamepadButton2 - GamepadButton3 GamepadButton = driver.GamepadButton3 - GamepadButton4 GamepadButton = driver.GamepadButton4 - GamepadButton5 GamepadButton = driver.GamepadButton5 - GamepadButton6 GamepadButton = driver.GamepadButton6 - GamepadButton7 GamepadButton = driver.GamepadButton7 - GamepadButton8 GamepadButton = driver.GamepadButton8 - GamepadButton9 GamepadButton = driver.GamepadButton9 - GamepadButton10 GamepadButton = driver.GamepadButton10 - GamepadButton11 GamepadButton = driver.GamepadButton11 - GamepadButton12 GamepadButton = driver.GamepadButton12 - GamepadButton13 GamepadButton = driver.GamepadButton13 - GamepadButton14 GamepadButton = driver.GamepadButton14 - GamepadButton15 GamepadButton = driver.GamepadButton15 - GamepadButton16 GamepadButton = driver.GamepadButton16 - GamepadButton17 GamepadButton = driver.GamepadButton17 - GamepadButton18 GamepadButton = driver.GamepadButton18 - GamepadButton19 GamepadButton = driver.GamepadButton19 - GamepadButton20 GamepadButton = driver.GamepadButton20 - GamepadButton21 GamepadButton = driver.GamepadButton21 - GamepadButton22 GamepadButton = driver.GamepadButton22 - GamepadButton23 GamepadButton = driver.GamepadButton23 - GamepadButton24 GamepadButton = driver.GamepadButton24 - GamepadButton25 GamepadButton = driver.GamepadButton25 - GamepadButton26 GamepadButton = driver.GamepadButton26 - GamepadButton27 GamepadButton = driver.GamepadButton27 - GamepadButton28 GamepadButton = driver.GamepadButton28 - GamepadButton29 GamepadButton = driver.GamepadButton29 - GamepadButton30 GamepadButton = driver.GamepadButton30 - GamepadButton31 GamepadButton = driver.GamepadButton31 + GamepadButton0 GamepadButton = gamepad.Button0 + GamepadButton1 GamepadButton = gamepad.Button1 + GamepadButton2 GamepadButton = gamepad.Button2 + GamepadButton3 GamepadButton = gamepad.Button3 + GamepadButton4 GamepadButton = gamepad.Button4 + GamepadButton5 GamepadButton = gamepad.Button5 + GamepadButton6 GamepadButton = gamepad.Button6 + GamepadButton7 GamepadButton = gamepad.Button7 + GamepadButton8 GamepadButton = gamepad.Button8 + GamepadButton9 GamepadButton = gamepad.Button9 + GamepadButton10 GamepadButton = gamepad.Button10 + GamepadButton11 GamepadButton = gamepad.Button11 + GamepadButton12 GamepadButton = gamepad.Button12 + GamepadButton13 GamepadButton = gamepad.Button13 + GamepadButton14 GamepadButton = gamepad.Button14 + GamepadButton15 GamepadButton = gamepad.Button15 + GamepadButton16 GamepadButton = gamepad.Button16 + GamepadButton17 GamepadButton = gamepad.Button17 + GamepadButton18 GamepadButton = gamepad.Button18 + GamepadButton19 GamepadButton = gamepad.Button19 + GamepadButton20 GamepadButton = gamepad.Button20 + GamepadButton21 GamepadButton = gamepad.Button21 + GamepadButton22 GamepadButton = gamepad.Button22 + GamepadButton23 GamepadButton = gamepad.Button23 + GamepadButton24 GamepadButton = gamepad.Button24 + GamepadButton25 GamepadButton = gamepad.Button25 + GamepadButton26 GamepadButton = gamepad.Button26 + GamepadButton27 GamepadButton = gamepad.Button27 + GamepadButton28 GamepadButton = gamepad.Button28 + GamepadButton29 GamepadButton = gamepad.Button29 + GamepadButton30 GamepadButton = gamepad.Button30 + GamepadButton31 GamepadButton = gamepad.Button31 GamepadButtonMax GamepadButton = GamepadButton31 ) diff --git a/internal/driver/gamepadbutton.go b/internal/driver/gamepadbutton.go index a2ad8de88..f308c1812 100644 --- a/internal/driver/gamepadbutton.go +++ b/internal/driver/gamepadbutton.go @@ -14,45 +14,6 @@ package driver -type GamepadButton int - -const ( - GamepadButton0 GamepadButton = iota - GamepadButton1 - GamepadButton2 - GamepadButton3 - GamepadButton4 - GamepadButton5 - GamepadButton6 - GamepadButton7 - GamepadButton8 - GamepadButton9 - GamepadButton10 - GamepadButton11 - GamepadButton12 - GamepadButton13 - GamepadButton14 - GamepadButton15 - GamepadButton16 - GamepadButton17 - GamepadButton18 - GamepadButton19 - GamepadButton20 - GamepadButton21 - GamepadButton22 - GamepadButton23 - GamepadButton24 - GamepadButton25 - GamepadButton26 - GamepadButton27 - GamepadButton28 - GamepadButton29 - GamepadButton30 - GamepadButton31 -) - -const GamepadButtonNum = 32 - type StandardGamepadButton int // https://www.w3.org/TR/gamepad/#remapping diff --git a/internal/gamepad/button.go b/internal/gamepad/button.go new file mode 100644 index 000000000..96a3aa7ce --- /dev/null +++ b/internal/gamepad/button.go @@ -0,0 +1,54 @@ +// Copyright 2022 The Ebiten Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package gamepad + +type Button int + +const ( + Button0 Button = iota + Button1 + Button2 + Button3 + Button4 + Button5 + Button6 + Button7 + Button8 + Button9 + Button10 + Button11 + Button12 + Button13 + Button14 + Button15 + Button16 + Button17 + Button18 + Button19 + Button20 + Button21 + Button22 + Button23 + Button24 + Button25 + Button26 + Button27 + Button28 + Button29 + Button30 + Button31 +) + +const ButtonNum = 32