mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-24 18:02:02 +01:00
internal/ui: bug fix: DeviceScaleFactor was not concurrent-safe before the main loop
Updates #1575 Closes #2042
This commit is contained in:
parent
2d912a2387
commit
07d6419dc6
@ -86,6 +86,7 @@ type userInterfaceImpl struct {
|
||||
// These values are not changed after initialized.
|
||||
// TODO: the fullscreen size should be updated when the initial window position is changed?
|
||||
initMonitor *glfw.Monitor
|
||||
initDeviceScaleFactor float64
|
||||
initFullscreenWidthInDIP int
|
||||
initFullscreenHeightInDIP int
|
||||
|
||||
@ -175,6 +176,7 @@ func initialize() error {
|
||||
}
|
||||
|
||||
theUI.initMonitor = m
|
||||
theUI.initDeviceScaleFactor = theUI.deviceScaleFactor(m)
|
||||
// GetVideoMode must be called from the main thread, then call this here and record
|
||||
// initFullscreen{Width,Height}InDIP.
|
||||
v := m.GetVideoMode()
|
||||
@ -612,7 +614,7 @@ func (u *userInterfaceImpl) SetCursorShape(shape CursorShape) {
|
||||
|
||||
func (u *userInterfaceImpl) DeviceScaleFactor() float64 {
|
||||
if !u.isRunning() {
|
||||
return u.deviceScaleFactor(u.currentMonitor())
|
||||
return u.initDeviceScaleFactor
|
||||
}
|
||||
|
||||
f := 0.0
|
||||
|
Loading…
Reference in New Issue
Block a user