mobile/ebitenmobileview: bug fix: compile error

This commit is contained in:
Hajime Hoshi 2022-02-05 23:26:44 +09:00
parent 2b902bacd9
commit 19bfc97a5e
2 changed files with 35 additions and 37 deletions

View File

@ -19,8 +19,6 @@ package gamepad
import ( import (
"fmt" "fmt"
"github.com/hajimehoshi/ebiten/v2/internal/driver"
) )
type AndroidHatDirection int type AndroidHatDirection int
@ -42,7 +40,7 @@ func UpdateAndroidGamepadAxis(androidDeviceID int, axis int, value float64) {
theGamepads.updateAndroidGamepadAxis(androidDeviceID, axis, value) theGamepads.updateAndroidGamepadAxis(androidDeviceID, axis, value)
} }
func UpdateAndroidGamepadButton(androidDeviceID int, button driver.GamepadButton, pressed bool) { func UpdateAndroidGamepadButton(androidDeviceID int, button Button, pressed bool) {
theGamepads.updateAndroidGamepadButton(androidDeviceID, button, pressed) theGamepads.updateAndroidGamepadButton(androidDeviceID, button, pressed)
} }
@ -83,7 +81,7 @@ func (g *gamepads) updateAndroidGamepadAxis(androidDeviceID int, axis int, value
gp.updateAndroidGamepadAxis(axis, value) gp.updateAndroidGamepadAxis(axis, value)
} }
func (g *gamepads) updateAndroidGamepadButton(androidDeviceID int, button driver.GamepadButton, pressed bool) { func (g *gamepads) updateAndroidGamepadButton(androidDeviceID int, button Button, pressed bool) {
g.m.Lock() g.m.Lock()
defer g.m.Unlock() defer g.m.Unlock()
@ -119,7 +117,7 @@ func (g *Gamepad) updateAndroidGamepadAxis(axis int, value float64) {
g.axes[axis] = value g.axes[axis] = value
} }
func (g *Gamepad) updateAndroidGamepadButton(button driver.GamepadButton, pressed bool) { func (g *Gamepad) updateAndroidGamepadButton(button Button, pressed bool) {
g.m.Lock() g.m.Lock()
defer g.m.Unlock() defer g.m.Unlock()

View File

@ -73,38 +73,38 @@ const (
// TODO: Can we map these values to the standard gamepad buttons? // TODO: Can we map these values to the standard gamepad buttons?
var androidKeyToGamepadButton = map[int]driver.GamepadButton{ var androidKeyToGamepadButton = map[int]gamepad.Button{
keycodeButtonA: driver.GamepadButton0, keycodeButtonA: gamepad.Button0,
keycodeButtonB: driver.GamepadButton1, keycodeButtonB: gamepad.Button1,
keycodeButtonC: driver.GamepadButton2, keycodeButtonC: gamepad.Button2,
keycodeButtonX: driver.GamepadButton3, keycodeButtonX: gamepad.Button3,
keycodeButtonY: driver.GamepadButton4, keycodeButtonY: gamepad.Button4,
keycodeButtonZ: driver.GamepadButton5, keycodeButtonZ: gamepad.Button5,
keycodeButtonL1: driver.GamepadButton6, keycodeButtonL1: gamepad.Button6,
keycodeButtonR1: driver.GamepadButton7, keycodeButtonR1: gamepad.Button7,
keycodeButtonL2: driver.GamepadButton8, keycodeButtonL2: gamepad.Button8,
keycodeButtonR2: driver.GamepadButton9, keycodeButtonR2: gamepad.Button9,
keycodeButtonThumbl: driver.GamepadButton10, keycodeButtonThumbl: gamepad.Button10,
keycodeButtonThumbr: driver.GamepadButton11, keycodeButtonThumbr: gamepad.Button11,
keycodeButtonStart: driver.GamepadButton12, keycodeButtonStart: gamepad.Button12,
keycodeButtonSelect: driver.GamepadButton13, keycodeButtonSelect: gamepad.Button13,
keycodeButtonMode: driver.GamepadButton14, keycodeButtonMode: gamepad.Button14,
keycodeButton1: driver.GamepadButton15, keycodeButton1: gamepad.Button15,
keycodeButton2: driver.GamepadButton16, keycodeButton2: gamepad.Button16,
keycodeButton3: driver.GamepadButton17, keycodeButton3: gamepad.Button17,
keycodeButton4: driver.GamepadButton18, keycodeButton4: gamepad.Button18,
keycodeButton5: driver.GamepadButton19, keycodeButton5: gamepad.Button19,
keycodeButton6: driver.GamepadButton20, keycodeButton6: gamepad.Button20,
keycodeButton7: driver.GamepadButton21, keycodeButton7: gamepad.Button21,
keycodeButton8: driver.GamepadButton22, keycodeButton8: gamepad.Button22,
keycodeButton9: driver.GamepadButton23, keycodeButton9: gamepad.Button23,
keycodeButton10: driver.GamepadButton24, keycodeButton10: gamepad.Button24,
keycodeButton11: driver.GamepadButton25, keycodeButton11: gamepad.Button25,
keycodeButton12: driver.GamepadButton26, keycodeButton12: gamepad.Button26,
keycodeButton13: driver.GamepadButton27, keycodeButton13: gamepad.Button27,
keycodeButton14: driver.GamepadButton28, keycodeButton14: gamepad.Button28,
keycodeButton15: driver.GamepadButton29, keycodeButton15: gamepad.Button29,
keycodeButton16: driver.GamepadButton30, keycodeButton16: gamepad.Button30,
} }
// Axis constant definitions for joysticks only. // Axis constant definitions for joysticks only.