Added applyCursorVisibility()

This commit is contained in:
theGeekPirate 2017-10-27 14:13:22 -07:00 committed by GitHub
parent 3f65b2c0c8
commit bca31f0d7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 10 deletions
pixelgl

View File

@ -324,13 +324,17 @@ func (w *Window) SetCursorVisible(visible bool) {
if !w.cursorDisabled {
w.cursorVisible = visible
mainthread.Call(func() {
if visible {
w.applyCursorVisibility()
})
}
}
func (w *Window) applyCursorVisibility() {
if w.cursorVisible {
w.window.SetInputMode(glfw.CursorMode, glfw.CursorNormal)
} else {
w.window.SetInputMode(glfw.CursorMode, glfw.CursorHidden)
}
})
}
}
// CursorVisible returns the visibility status of the mouse cursor.
@ -346,11 +350,7 @@ func (w *Window) SetCursorDisabled(disabled bool) {
w.cursorVisible = false
w.window.SetInputMode(glfw.CursorMode, glfw.CursorDisabled)
} else {
if w.cursorVisible {
w.window.SetInputMode(glfw.CursorMode, glfw.CursorNormal)
} else {
w.window.SetInputMode(glfw.CursorMode, glfw.CursorHidden)
}
w.applyCursorVisibility()
}
})
}