mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
ebiten: Rename HasGamepadStandardLayoutMapping -> IsStandardGamepadLayoutAvailable
Updates #1557
This commit is contained in:
parent
51f83b1527
commit
f192971080
@ -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"
|
||||
|
8
input.go
8
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.
|
||||
|
@ -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)
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user