ui: Bug fix: fullscreen scale calculation was wrong (#267)

This commit is contained in:
Hajime Hoshi 2017-06-30 02:08:12 +09:00
parent 2996f778b6
commit 1d60c009ed
2 changed files with 7 additions and 4 deletions

View File

@ -293,9 +293,9 @@ func checkSize(width, height int) {
panic("ebiten: height must be more than 0")
}
if width > MaxImageSize {
panic(fmt.Sprintf("ebiten: width must be less than or equal to %d", MaxImageSize))
panic(fmt.Sprintf("ebiten: width (%d) must be less than or equal to %d", width, MaxImageSize))
}
if height > MaxImageSize {
panic(fmt.Sprintf("ebiten: height must be less than or equal to %d", MaxImageSize))
panic(fmt.Sprintf("ebiten: height (%d) must be less than or equal to %d", height, MaxImageSize))
}
}

View File

@ -245,10 +245,13 @@ func (u *userInterface) getScale() float64 {
return u.scale
}
if u.fullscreenScale == 0 {
if u.glfwScale == 0 {
u.glfwScale = glfwScale()
}
m := glfw.GetPrimaryMonitor()
v := m.GetVideoMode()
sw := float64(v.Width) / float64(u.width)
sh := float64(v.Height) / float64(u.height)
sw := float64(v.Width) / u.glfwScale / float64(u.width)
sh := float64(v.Height) / u.glfwScale / float64(u.height)
s := sw
if s > sh {
s = sh