From 41a3073be318bc033bbbd21ef41d4ce684159770 Mon Sep 17 00:00:00 2001
From: ALex Ogier <alexander.ogier@gmail.com>
Date: Mon, 20 Nov 2017 13:37:22 +1300
Subject: [PATCH] add GetPos function to window

---
 pixelgl/window.go | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/pixelgl/window.go b/pixelgl/window.go
index 26d96f7..cb4dcf3 100644
--- a/pixelgl/window.go
+++ b/pixelgl/window.go
@@ -244,6 +244,18 @@ func (w *Window) SetPos(pos pixel.Vec) {
 		w.window.SetPos(left, top)
 	})
 }
+
+// GetPos gets the position, in screen coordinates, of the upper-left corner
+// of the client area of the window. The position is rounded to integers.
+func (w *Window) GetPos() pixel.Vec {
+	var v pixel.Vec
+	mainthread.Call(func() {
+		x, y := w.window.GetPos()
+		v = pixel.V(float64(x), float64(y))
+	})
+	return v
+}
+
 // Bounds returns the current bounds of the Window.
 func (w *Window) Bounds() pixel.Rect {
 	return w.bounds
-- 
GitLab