mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
examples/blocks: Use IsGamepadButtonJustPressed
This commit is contained in:
parent
ea1444ea7e
commit
52dea245dc
@ -18,6 +18,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/hajimehoshi/ebiten"
|
"github.com/hajimehoshi/ebiten"
|
||||||
|
"github.com/hajimehoshi/ebiten/inpututil"
|
||||||
)
|
)
|
||||||
|
|
||||||
type virtualGamepadButton int
|
type virtualGamepadButton int
|
||||||
@ -104,7 +105,7 @@ func (c *gamepadConfig) Scan(gamepadID int, b virtualGamepadButton) bool {
|
|||||||
if _, ok := c.assignedButtons[eb]; ok {
|
if _, ok := c.assignedButtons[eb]; ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if ebiten.IsGamepadButtonPressed(gamepadID, eb) {
|
if inpututil.IsGamepadButtonJustPressed(gamepadID, eb) {
|
||||||
c.buttons[b] = eb
|
c.buttons[b] = eb
|
||||||
c.assignedButtons[eb] = struct{}{}
|
c.assignedButtons[eb] = struct{}{}
|
||||||
return true
|
return true
|
||||||
|
Loading…
Reference in New Issue
Block a user