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
0e63ab5d78
commit
7a850a15a9
@ -699,6 +699,12 @@ func (u *UserInterface) DeviceScaleFactor() float64 {
|
||||
|
||||
// deviceScaleFactor must be called from the main thread.
|
||||
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()
|
||||
return devicescale.GetAt(mx, my)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user