mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 02:42:02 +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")
|
panic("ebiten: height must be more than 0")
|
||||||
}
|
}
|
||||||
if width > MaxImageSize {
|
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 {
|
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
|
return u.scale
|
||||||
}
|
}
|
||||||
if u.fullscreenScale == 0 {
|
if u.fullscreenScale == 0 {
|
||||||
|
if u.glfwScale == 0 {
|
||||||
|
u.glfwScale = glfwScale()
|
||||||
|
}
|
||||||
m := glfw.GetPrimaryMonitor()
|
m := glfw.GetPrimaryMonitor()
|
||||||
v := m.GetVideoMode()
|
v := m.GetVideoMode()
|
||||||
sw := float64(v.Width) / float64(u.width)
|
sw := float64(v.Width) / u.glfwScale / float64(u.width)
|
||||||
sh := float64(v.Height) / float64(u.height)
|
sh := float64(v.Height) / u.glfwScale / float64(u.height)
|
||||||
s := sw
|
s := sw
|
||||||
if s > sh {
|
if s > sh {
|
||||||
s = sh
|
s = sh
|
||||||
|
Loading…
Reference in New Issue
Block a user