mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
ui: glfwScale must be called on the main thread
This commit is contained in:
parent
c758a1f8c6
commit
b5344bc994
@ -394,16 +394,18 @@ func ScreenPadding() (x0, y0, x1, y1 float64) {
|
|||||||
d := devicescale.GetAt(m.GetPos())
|
d := devicescale.GetAt(m.GetPos())
|
||||||
v := m.GetVideoMode()
|
v := m.GetVideoMode()
|
||||||
|
|
||||||
mx := float64(v.Width) * d / glfwScale()
|
|
||||||
my := float64(v.Height) * d / glfwScale()
|
|
||||||
sx := 0.0
|
sx := 0.0
|
||||||
sy := 0.0
|
sy := 0.0
|
||||||
|
gs := 0.0
|
||||||
_ = u.runOnMainThread(func() error {
|
_ = u.runOnMainThread(func() error {
|
||||||
sx = float64(u.width) * u.actualScreenScale()
|
sx = float64(u.width) * u.actualScreenScale()
|
||||||
sy = float64(u.height) * u.actualScreenScale()
|
sy = float64(u.height) * u.actualScreenScale()
|
||||||
|
gs = glfwScale()
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
mx := float64(v.Width) * d / gs
|
||||||
|
my := float64(v.Height) * d / gs
|
||||||
|
|
||||||
ox := (mx - sx) / 2
|
ox := (mx - sx) / 2
|
||||||
oy := (my - sy) / 2
|
oy := (my - sy) / 2
|
||||||
return ox, oy, (mx - sx) - ox, (my - sy) - oy
|
return ox, oy, (mx - sx) - ox, (my - sy) - oy
|
||||||
|
Loading…
Reference in New Issue
Block a user