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
}
func SetFullscreen(fullscreen bool) bool {
func SetFullscreen(fullscreen bool) {
// This can be called before Run: change the state asyncly.
go func() {
_ = currentUI.runOnMainThread(func() error {
u := currentUI
if !u.isRunning() {
panic("ui: Run is not called yet")
}
r := false
_ = u.runOnMainThread(func() error {
r = u.setScreenSize(u.width, u.height, u.scale, fullscreen)
u.setScreenSize(u.width, u.height, u.scale, fullscreen)
return nil
})
return r
}()
}
func ScreenScale() float64 {