mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
Bug fix: glfw.MouseButton should be converted to MouseButton
This commit is contained in:
parent
7677d885a2
commit
03cf0a7069
@ -33,12 +33,18 @@ func CursorPosition() (x, y int) {
|
||||
return current.input.cursorPosition()
|
||||
}
|
||||
|
||||
var glfwMouseButtonToMouseButton = map[glfw.MouseButton]MouseButton{
|
||||
glfw.MouseButtonLeft: MouseButtonLeft,
|
||||
glfw.MouseButtonRight: MouseButtonRight,
|
||||
glfw.MouseButtonMiddle: MouseButtonMiddle,
|
||||
}
|
||||
|
||||
func (i *input) update(window *glfw.Window, scale int) {
|
||||
for g, e := range glfwKeyCodeToKey {
|
||||
i.keyPressed[e] = window.GetKey(g) == glfw.Press
|
||||
}
|
||||
for b := 0; b < len(i.mouseButtonPressed); b++ {
|
||||
i.mouseButtonPressed[b] = window.GetMouseButton(glfw.MouseButton(b)) == glfw.Press
|
||||
for g, e := range glfwMouseButtonToMouseButton {
|
||||
i.mouseButtonPressed[e] = window.GetMouseButton(g) == glfw.Press
|
||||
}
|
||||
x, y := window.GetCursorPosition()
|
||||
i.cursorX = int(math.Floor(x)) / scale
|
||||
|
Loading…
Reference in New Issue
Block a user