mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
ui: Allow SetFullscreen without Run
This commit is contained in:
parent
697c23a807
commit
c94c994bd1
@ -154,17 +154,15 @@ func SetScreenScale(scale float64) bool {
|
|||||||
return r
|
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
|
u := currentUI
|
||||||
if !u.isRunning() {
|
u.setScreenSize(u.width, u.height, u.scale, fullscreen)
|
||||||
panic("ui: Run is not called yet")
|
|
||||||
}
|
|
||||||
r := false
|
|
||||||
_ = u.runOnMainThread(func() error {
|
|
||||||
r = u.setScreenSize(u.width, u.height, u.scale, fullscreen)
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
return r
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
func ScreenScale() float64 {
|
func ScreenScale() float64 {
|
||||||
|
Loading…
Reference in New Issue
Block a user