ui: Adjust fullscreen scale (#267)

This commit is contained in:
Hajime Hoshi 2017-06-30 01:24:37 +09:00
parent 5dbfafb200
commit e7370d8a54

View File

@ -37,6 +37,7 @@ type userInterface struct {
deviceScale float64
glfwScale float64
fullscreen bool
fullscreenScale float64
funcs chan func()
running bool
sizeChanged bool
@ -243,6 +244,20 @@ func (u *userInterface) actualScreenScale() float64 {
if u.deviceScale == 0 {
u.deviceScale = deviceScale()
}
if u.fullscreen {
if u.fullscreenScale == 0 {
m := glfw.GetPrimaryMonitor()
v := m.GetVideoMode()
sw := float64(v.Width) / float64(u.width)
sh := float64(v.Height) / float64(u.height)
s := sw
if s > sh {
s = sh
}
u.fullscreenScale = s
}
return u.fullscreenScale * u.deviceScale
}
return u.scale * u.deviceScale
}