add GetPos function to window

This commit is contained in:
ALex Ogier 2017-11-20 13:37:22 +13:00
parent 5e2a944a48
commit 3c78161418
1 changed files with 12 additions and 0 deletions

View File

@ -244,6 +244,18 @@ func (w *Window) SetPos(pos pixel.Vec) {
w.window.SetPos(left, top) 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. // Bounds returns the current bounds of the Window.
func (w *Window) Bounds() pixel.Rect { func (w *Window) Bounds() pixel.Rect {
return w.bounds return w.bounds