mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
ui: Bug fix: fullscreen scale calculation was wrong (#267)
This commit is contained in:
parent
2996f778b6
commit
1d60c009ed
4
image.go
4
image.go
@ -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))
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user