From effd43bc5671009de80fb3e9cec76b1ec33201cd Mon Sep 17 00:00:00 2001 From: Luke Meyers Date: Sun, 9 Feb 2020 20:59:59 -0800 Subject: [PATCH] Expose pixelgl.Window.SwapBuffers Allow buffers to be swapped without polling input, offering decoupling symmetrical with that provided by UpdateInput. --- pixelgl/window.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pixelgl/window.go b/pixelgl/window.go index 10c16ce..239bd59 100644 --- a/pixelgl/window.go +++ b/pixelgl/window.go @@ -173,6 +173,13 @@ func (w *Window) Destroy() { // Update swaps buffers and polls events. Call this method at the end of each frame. func (w *Window) Update() { + w.SwapBuffers() + w.UpdateInput() +} + +// SwapBuffers swaps buffers. Call this to swap buffers without polling window events. +// Note that Update invokes SwapBuffers. +func (w *Window) SwapBuffers() { mainthread.Call(func() { _, _, oldW, oldH := intBounds(w.bounds) newW, newH := w.window.GetSize() @@ -207,8 +214,6 @@ func (w *Window) Update() { w.window.SwapBuffers() w.end() }) - - w.UpdateInput() } // SetClosed sets the closed flag of the Window.