mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-13 04:22:05 +01:00
internal/ui: bug fix: the screen size must be initialized first even when the canvas is unfocused
Closes #3034
This commit is contained in:
parent
126af1420f
commit
3a18b32cbd
@ -337,10 +337,6 @@ func (u *UserInterface) updateImpl(force bool) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !u.onceUpdateCalled {
|
|
||||||
u.updateScreenSize()
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: If DeviceScaleFactor changes, call updateScreenSize.
|
// TODO: If DeviceScaleFactor changes, call updateScreenSize.
|
||||||
// Now there is not a good way to detect the change.
|
// Now there is not a good way to detect the change.
|
||||||
// See also https://crbug.com/123694.
|
// See also https://crbug.com/123694.
|
||||||
@ -373,6 +369,11 @@ func (u *UserInterface) needsUpdate() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserInterface) loopGame() error {
|
func (u *UserInterface) loopGame() error {
|
||||||
|
// Initialize the screen size first (#3033).
|
||||||
|
// If ebiten.SetRunnableOnUnfocused(false) and the canvas is not focused,
|
||||||
|
// suspended() returns true and the update routine cannot start.
|
||||||
|
u.updateScreenSize()
|
||||||
|
|
||||||
errCh := make(chan error, 1)
|
errCh := make(chan error, 1)
|
||||||
reqStopAudioCh := make(chan struct{})
|
reqStopAudioCh := make(chan struct{})
|
||||||
resStopAudioCh := make(chan struct{})
|
resStopAudioCh := make(chan struct{})
|
||||||
|
Loading…
Reference in New Issue
Block a user