From bc898ce1eeb39137a68a02fc6b874fa2bfd2205e Mon Sep 17 00:00:00 2001 From: theGeekPirate Date: Fri, 27 Oct 2017 13:27:51 -0700 Subject: [PATCH] Add SetCursorVisible() Back --- pixelgl/window.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pixelgl/window.go b/pixelgl/window.go index ae0a086..62c4bb7 100644 --- a/pixelgl/window.go +++ b/pixelgl/window.go @@ -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