Add SetCursorVisible() Back

This commit is contained in:
theGeekPirate 2017-10-27 13:27:51 -07:00 committed by GitHub
parent aa01c98322
commit bc898ce1ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -318,6 +318,18 @@ func (w *Window) VSync() bool {
return w.vsync
}
// SetCursorVisible sets the visibility of the mouse cursor inside the Window client area.
func (w *Window) SetCursorVisible(visible bool) {
w.cursorVisible = visible
mainthread.Call(func() {
if visible {
w.window.SetInputMode(glfw.CursorMode, glfw.CursorNormal)
} else {
w.window.SetInputMode(glfw.CursorMode, glfw.CursorHidden)
}
})
}
// SetCursorDisabled both hides the cursor, as well as limits cursor movement to the Window client area.
func (w *Window) SetCursorDisabled(disabled bool) {
w.cursorVisible = !disabled