From 93a24aa6dfc353a1fae1b000ee24cc12bcd4877c Mon Sep 17 00:00:00 2001 From: Jared Date: Wed, 8 Jan 2020 22:24:48 -0700 Subject: [PATCH 1/2] Added DisableCursor --- pixelgl/window.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pixelgl/window.go b/pixelgl/window.go index 10c16ce..a14ad5a 100644 --- a/pixelgl/window.go +++ b/pixelgl/window.go @@ -369,6 +369,14 @@ func (w *Window) SetCursorVisible(visible bool) { }) } +// DisableCursor hides the cursor and provides unlimited virtual cursor movement +func (w *Window) DisableCursor() { + w.cursorVisible = false + mainthread.Call(func() { + w.window.SetInputMode(glfw.CursorMode, glfw.CursorDisabled) + }) +} + // CursorVisible returns the visibility status of the mouse cursor. func (w *Window) CursorVisible() bool { return w.cursorVisible From fc29ad788632d76b51c06cb04cf650d98c79a57a Mon Sep 17 00:00:00 2001 From: Jared Date: Fri, 7 Feb 2020 16:22:39 -0700 Subject: [PATCH 2/2] changed name to SetCursorDisabled --- pixelgl/window.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pixelgl/window.go b/pixelgl/window.go index a14ad5a..df0b783 100644 --- a/pixelgl/window.go +++ b/pixelgl/window.go @@ -369,8 +369,9 @@ func (w *Window) SetCursorVisible(visible bool) { }) } -// DisableCursor hides the cursor and provides unlimited virtual cursor movement -func (w *Window) DisableCursor() { +// SetCursorDisabled hides the cursor and provides unlimited virtual cursor movement +// make cursor visible using SetCursorVisible +func (w *Window) SetCursorDisabled() { w.cursorVisible = false mainthread.Call(func() { w.window.SetInputMode(glfw.CursorMode, glfw.CursorDisabled)