internal/uidriver/glfw: refactoring

This commit is contained in:
Hajime Hoshi 2022-02-05 21:52:06 +09:00
parent bf1cb035eb
commit e6e0c6d850
2 changed files with 3 additions and 23 deletions

View File

@ -24,13 +24,6 @@ import (
gamepadpkg "github.com/hajimehoshi/ebiten/v2/internal/gamepad"
)
type nativeGamepads struct{}
// updateGamepads must be called on the main thread.
func (i *Input) updateGamepads() error {
return gamepadpkg.Update()
}
func (i *Input) AppendGamepadIDs(gamepadIDs []driver.GamepadID) []driver.GamepadID {
return gamepadpkg.AppendGamepadIDs(gamepadIDs)
}

View File

@ -23,21 +23,10 @@ import (
"unicode"
"github.com/hajimehoshi/ebiten/v2/internal/driver"
"github.com/hajimehoshi/ebiten/v2/internal/gamepad"
"github.com/hajimehoshi/ebiten/v2/internal/glfw"
)
type gamepad struct {
valid bool
guid string
name string
axisNum int
axes [16]float64
buttonNum int
buttonPressed [256]bool
hatsNum int
hats [16]int
}
type Input struct {
keyPressed map[glfw.Key]bool
mouseButtonPressed map[glfw.MouseButton]bool
@ -46,12 +35,9 @@ type Input struct {
scrollY float64
cursorX int
cursorY int
gamepads [16]gamepad
touches map[driver.TouchID]pos // TODO: Implement this (#417)
runeBuffer []rune
ui *UserInterface
nativeGamepads
}
type pos struct {
@ -218,5 +204,6 @@ func (i *Input) update(window *glfw.Window, context driver.UIContext) error {
i.cursorX, i.cursorY = int(cx), int(cy)
}
return i.updateGamepads()
gamepad.Update()
return nil
}