ui: Allow SetFullscreen without Run

This commit is contained in:
Hajime Hoshi 2017-07-15 20:29:13 +09:00
parent 697c23a807
commit c94c994bd1

View File

@ -154,17 +154,15 @@ func SetScreenScale(scale float64) bool {
return r return r
} }
func SetFullscreen(fullscreen bool) bool { func SetFullscreen(fullscreen bool) {
u := currentUI // This can be called before Run: change the state asyncly.
if !u.isRunning() { go func() {
panic("ui: Run is not called yet") _ = currentUI.runOnMainThread(func() error {
} u := currentUI
r := false u.setScreenSize(u.width, u.height, u.scale, fullscreen)
_ = u.runOnMainThread(func() error { return nil
r = u.setScreenSize(u.width, u.height, u.scale, fullscreen) })
return nil }()
})
return r
} }
func ScreenScale() float64 { func ScreenScale() float64 {