mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/uidriver/glfw: Bug fix: Return a tentative scale when glfw.GetPrmaryMonitor returns 1
Updates #1878
This commit is contained in:
parent
b4f87f9651
commit
73bf7a0939
@ -697,6 +697,12 @@ func (u *UserInterface) DeviceScaleFactor() float64 {
|
|||||||
|
|
||||||
// deviceScaleFactor must be called from the main thread.
|
// deviceScaleFactor must be called from the main thread.
|
||||||
func (u *UserInterface) deviceScaleFactor(monitor *glfw.Monitor) float64 {
|
func (u *UserInterface) deviceScaleFactor(monitor *glfw.Monitor) float64 {
|
||||||
|
// It is rare, but monitor can be nil when glfw.GetPrimaryMonitor returns nil.
|
||||||
|
// In this case, return 1 as a tentative scale (#1878).
|
||||||
|
if monitor == nil {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
mx, my := monitor.GetPos()
|
mx, my := monitor.GetPos()
|
||||||
return devicescale.GetAt(mx, my)
|
return devicescale.GetAt(mx, my)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user