mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
ui: Bug fix: SetFullscreen / IsFullscreen should be concurrent safe; IsFullscreen should return the correct value even before Run
This commit is contained in:
parent
807d03eb3b
commit
434d5bb00b
@ -163,7 +163,9 @@ func SetScreenScale(scale float64) bool {
|
||||
func SetFullscreen(fullscreen bool) {
|
||||
u := currentUI
|
||||
if !u.isRunning() {
|
||||
u.m.Lock()
|
||||
u.initFullscreen = fullscreen
|
||||
u.m.Unlock()
|
||||
return
|
||||
}
|
||||
_ = u.runOnMainThread(func() error {
|
||||
@ -189,7 +191,10 @@ func ScreenScale() float64 {
|
||||
func IsFullscreen() bool {
|
||||
u := currentUI
|
||||
if !u.isRunning() {
|
||||
return false
|
||||
u.m.Lock()
|
||||
v := u.initFullscreen
|
||||
u.m.Unlock()
|
||||
return v
|
||||
}
|
||||
f := false
|
||||
_ = u.runOnMainThread(func() error {
|
||||
|
Loading…
Reference in New Issue
Block a user