diff --git a/examples/gamepad/main.go b/examples/gamepad/main.go index 5ce5ab32a..f59cd23e3 100644 --- a/examples/gamepad/main.go +++ b/examples/gamepad/main.go @@ -83,7 +83,7 @@ func (g *Game) Update() error { } } - if ebiten.HasGamepadStandardLayoutMapping(id) { + if ebiten.IsStandardGamepadLayoutAvailable(id) { for b := ebiten.StandardGamepadButton(0); b <= ebiten.StandardGamepadButtonMax; b++ { // Log button events. if inpututil.IsStandardGamepadButtonJustPressed(id, b) { @@ -214,13 +214,13 @@ func (g *Game) Draw(screen *ebiten.Image) { }) for _, id := range ids { var standard string - if ebiten.HasGamepadStandardLayoutMapping(id) { + if ebiten.IsStandardGamepadLayoutAvailable(id) { standard = " (Standard Layout)" } str += fmt.Sprintf("Gamepad (ID: %d, SDL ID: %s)%s:\n", id, ebiten.GamepadSDLID(id), standard) str += fmt.Sprintf(" Axes: %s\n", strings.Join(g.axes[id], ", ")) str += fmt.Sprintf(" Buttons: %s\n", strings.Join(g.pressedButtons[id], ", ")) - if ebiten.HasGamepadStandardLayoutMapping(id) { + if ebiten.IsStandardGamepadLayoutAvailable(id) { str += "\n" str += standardMap(id) str += "\n" diff --git a/input.go b/input.go index e6ee0ed20..0e1824990 100644 --- a/input.go +++ b/input.go @@ -227,11 +227,11 @@ func IsStandardGamepadButtonPressed(id GamepadID, button StandardGamepadButton) return uiDriver().Input().IsStandardGamepadButtonPressed(id, button) } -// HasGamepadStandardLayoutMapping reports whether the gamepad (id) has the standard gamepad layout. +// IsStandardGamepadLayoutAvailable reports whether the gamepad (id) has the standard gamepad layout. // -// HasGamepadStandardLayoutMapping is concurrent-safe. -func HasGamepadStandardLayoutMapping(id GamepadID) bool { - return uiDriver().Input().HasGamepadStandardLayoutMapping(id) +// IsStandardGamepadLayoutAvailable is concurrent-safe. +func IsStandardGamepadLayoutAvailable(id GamepadID) bool { + return uiDriver().Input().IsStandardGamepadLayoutAvailable(id) } // TouchID represents a touch's identifier. diff --git a/internal/driver/input.go b/internal/driver/input.go index 23ef5572d..42b1524b3 100644 --- a/internal/driver/input.go +++ b/internal/driver/input.go @@ -28,11 +28,11 @@ type Input interface { GamepadAxisValue(id GamepadID, axis int) float64 GamepadAxisNum(id GamepadID) int GamepadButtonNum(id GamepadID) int - HasGamepadStandardLayoutMapping(id GamepadID) bool IsGamepadButtonPressed(id GamepadID, button GamepadButton) bool IsKeyPressed(key Key) bool IsMouseButtonPressed(button MouseButton) bool IsStandardGamepadButtonPressed(id GamepadID, button StandardGamepadButton) bool + IsStandardGamepadLayoutAvailable(id GamepadID) bool StandardGamepadAxisValue(id GamepadID, button StandardGamepadAxis) float64 TouchPosition(id TouchID) (x, y int) Wheel() (xoff, yoff float64) diff --git a/internal/uidriver/glfw/input.go b/internal/uidriver/glfw/input.go index b052c64bb..7c6da6f1e 100644 --- a/internal/uidriver/glfw/input.go +++ b/internal/uidriver/glfw/input.go @@ -363,7 +363,7 @@ func (i *Input) update(window *glfw.Window, context driver.UIContext) { } } -func (i *Input) HasGamepadStandardLayoutMapping(id driver.GamepadID) bool { +func (i *Input) IsStandardGamepadLayoutAvailable(id driver.GamepadID) bool { i.ui.m.Lock() defer i.ui.m.Unlock() diff --git a/internal/uidriver/js/input_js.go b/internal/uidriver/js/input_js.go index aac2abae1..bbaee6090 100644 --- a/internal/uidriver/js/input_js.go +++ b/internal/uidriver/js/input_js.go @@ -487,7 +487,7 @@ func (i *Input) updateForGo2Cpp() { } } -func (i *Input) HasGamepadStandardLayoutMapping(id driver.GamepadID) bool { +func (i *Input) IsStandardGamepadLayoutAvailable(id driver.GamepadID) bool { g, ok := i.gamepads[id] if !ok { return false diff --git a/internal/uidriver/mobile/input.go b/internal/uidriver/mobile/input.go index 3dbc55fb6..6f667e2ab 100644 --- a/internal/uidriver/mobile/input.go +++ b/internal/uidriver/mobile/input.go @@ -132,7 +132,7 @@ func (i *Input) IsGamepadButtonPressed(id driver.GamepadID, button driver.Gamepa return false } -func (i *Input) HasGamepadStandardLayoutMapping(id driver.GamepadID) bool { +func (i *Input) IsStandardGamepadLayoutAvailable(id driver.GamepadID) bool { // TODO: Implement this (#1557) return false }