From b4a4b87b56955153c7477b5f4a0538e37ddd77be Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 10 Oct 2018 03:10:16 +0900 Subject: [PATCH] ui: Bug fix: ScreenSizeInFullscreen returned wrong scaled values Fixes #708 --- internal/ui/ui_glfw.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/internal/ui/ui_glfw.go b/internal/ui/ui_glfw.go index c34bd40a2..ccd531608 100644 --- a/internal/ui/ui_glfw.go +++ b/internal/ui/ui_glfw.go @@ -233,16 +233,20 @@ func (u *userInterface) runOnMainThread(f func() error) error { } func ScreenSizeInFullscreen() (int, int) { + u := currentUI var v *glfw.VidMode - if currentUI.isRunning() { - _ = currentUI.runOnMainThread(func() error { - v = currentUI.currentMonitor().GetVideoMode() + s := 0.0 + if u.isRunning() { + _ = u.runOnMainThread(func() error { + v = u.currentMonitor().GetVideoMode() + s = glfwScale() return nil }) } else { v = currentUI.currentMonitor().GetVideoMode() + s = glfwScale() } - return v.Width, v.Height + return int(float64(v.Width) / s), int(float64(v.Height) / s) } func SetScreenSize(width, height int) bool {