From 5c98b446fdba5dfaf3d81752a90c163e2bc6a73b Mon Sep 17 00:00:00 2001 From: mewmew Date: Sat, 24 Mar 2018 19:19:56 +0100 Subject: [PATCH] pixel/pixelgl: export UpdateInput This change mirrors the change done in the master branch (see #78) for users of gl2.1, to provide access to polling of events without rendering the screen. Updates #26. --- pixelgl/input.go | 4 +++- pixelgl/window.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pixelgl/input.go b/pixelgl/input.go index ff98805..2eedb0d 100644 --- a/pixelgl/input.go +++ b/pixelgl/input.go @@ -372,7 +372,9 @@ func (w *Window) initInput() { }) } -func (w *Window) updateInput() { +// UpdateInput polls window events. Call this function to poll window events +// without swapping buffers. Note that the Update method invokes UpdateInput. +func (w *Window) UpdateInput() { mainthread.Call(func() { glfw.PollEvents() }) diff --git a/pixelgl/window.go b/pixelgl/window.go index 76523a5..4ee9cc4 100644 --- a/pixelgl/window.go +++ b/pixelgl/window.go @@ -190,7 +190,7 @@ func (w *Window) Update() { w.end() }) - w.updateInput() + w.UpdateInput() } // SetClosed sets the closed flag of the Window.