mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
uidriver/glfw: Bug fix: WindowPos/SetWindowPos should convert pixels
This change also enables these functions even on fullscreen mode. Fixes #1010
This commit is contained in:
parent
f3712a7e62
commit
2e8358529c
@ -1056,10 +1056,13 @@ func (u *UserInterface) SetWindowPosition(x, y int) {
|
||||
return
|
||||
}
|
||||
_ = u.t.Call(func() error {
|
||||
xf := u.toDeviceDependentPixel(float64(x))
|
||||
yf := u.toDeviceDependentPixel(float64(y))
|
||||
if u.isFullscreen() {
|
||||
return nil
|
||||
u.origPosX, u.origPosY = int(xf), int(yf)
|
||||
} else {
|
||||
u.window.SetPos(int(xf), int(yf))
|
||||
}
|
||||
u.window.SetPos(x, y)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@ -1070,11 +1073,15 @@ func (u *UserInterface) WindowPosition() (int, int) {
|
||||
}
|
||||
x, y := 0, 0
|
||||
_ = u.t.Call(func() error {
|
||||
var wx, wy int
|
||||
if u.isFullscreen() {
|
||||
x, y = u.origPosX, u.origPosY
|
||||
return nil
|
||||
wx, wy = u.origPosX, u.origPosY
|
||||
} else {
|
||||
wx, wy = u.window.GetPos()
|
||||
}
|
||||
x, y = u.window.GetPos()
|
||||
xf := u.toDeviceIndependentPixel(float64(wx))
|
||||
yf := u.toDeviceIndependentPixel(float64(wy))
|
||||
x, y = int(xf), int(yf)
|
||||
return nil
|
||||
})
|
||||
return x, y
|
||||
|
Loading…
Reference in New Issue
Block a user