mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
internal/uidriver/glfw: refactoring
This commit is contained in:
parent
bf1cb035eb
commit
e6e0c6d850
@ -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)
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user