Merge pull request #69 from PlainSight/add-getpos-to-window

Add GetPos function to window
This commit is contained in:
Michal Štrba 2017-11-20 02:15:20 +01:00 committed by GitHub
commit 08308279ca
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)
})
}
// 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