From 48e37828c877dddeac3feea44a38ca0aa6582348 Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Fri, 27 Oct 2017 20:28:28 +0200 Subject: [PATCH] Added SetPos to pixelgl.Window --- pixelgl/window.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pixelgl/window.go b/pixelgl/window.go index afbd5f7..26d96f7 100644 --- a/pixelgl/window.go +++ b/pixelgl/window.go @@ -233,6 +233,17 @@ func (w *Window) SetBounds(bounds pixel.Rect) { }) } +// SetPos sets the position, in screen coordinates, of the upper-left corner +// of the client area of the window. Position can be fractional, but the actual position +// of the window will be rounded to integers. +// +// If it is a full screen window, this function does nothing. +func (w *Window) SetPos(pos pixel.Vec) { + mainthread.Call(func() { + left, top := int(pos.X), int(pos.Y) + w.window.SetPos(left, top) + }) +} // Bounds returns the current bounds of the Window. func (w *Window) Bounds() pixel.Rect { return w.bounds