mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 02:42:02 +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) {
|
func SetFullscreen(fullscreen bool) {
|
||||||
u := currentUI
|
u := currentUI
|
||||||
if !u.isRunning() {
|
if !u.isRunning() {
|
||||||
|
u.m.Lock()
|
||||||
u.initFullscreen = fullscreen
|
u.initFullscreen = fullscreen
|
||||||
|
u.m.Unlock()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_ = u.runOnMainThread(func() error {
|
_ = u.runOnMainThread(func() error {
|
||||||
@ -189,7 +191,10 @@ func ScreenScale() float64 {
|
|||||||
func IsFullscreen() bool {
|
func IsFullscreen() bool {
|
||||||
u := currentUI
|
u := currentUI
|
||||||
if !u.isRunning() {
|
if !u.isRunning() {
|
||||||
return false
|
u.m.Lock()
|
||||||
|
v := u.initFullscreen
|
||||||
|
u.m.Unlock()
|
||||||
|
return v
|
||||||
}
|
}
|
||||||
f := false
|
f := false
|
||||||
_ = u.runOnMainThread(func() error {
|
_ = u.runOnMainThread(func() error {
|
||||||
|
Loading…
Reference in New Issue
Block a user