ui: Unexport SetWindowResizable (#320)

This commit is contained in:
Hajime Hoshi 2019-02-25 02:16:25 +09:00
parent ea7c2f8da3
commit f56c3bd096
3 changed files with 10 additions and 8 deletions

View File

@ -37,7 +37,6 @@ import (
var (
windowDecorated = flag.Bool("windowdecorated", true, "whether the window is decorated")
windowResizable = flag.Bool("windowresizable", false, "whether the window is resizable")
)
func init() {
@ -222,7 +221,6 @@ func main() {
ebiten.SetWindowIcon([]image.Image{createRandomIconImage()})
ebiten.SetWindowDecorated(*windowDecorated)
ebiten.SetWindowResizable(*windowResizable)
if err := ebiten.Run(update, initScreenWidth, initScreenHeight, initScreenScale, "Window Size (Ebiten Demo)"); err != nil && err != terminated {
log.Fatal(err)

View File

@ -286,6 +286,7 @@ func SetScreenSize(width, height int) {
panic("ui: Run is not called yet")
}
_ = mainthread.Run(func() error {
// TODO: What if the window is maximized? (#320)
u.setScreenSize(width, height, u.scale, u.isFullscreen(), u.vsync)
return nil
})
@ -298,6 +299,7 @@ func SetScreenScale(scale float64) bool {
}
r := false
_ = mainthread.Run(func() error {
// TODO: What if the window is maximized? (#320)
r = u.setScreenSize(u.width, u.height, scale, u.isFullscreen(), u.vsync)
return nil
})

14
run.go
View File

@ -342,19 +342,21 @@ func IsWindowDecorated() bool {
return ui.IsWindowDecorated()
}
// SetWindowResizable sets the state if the window is resizable.
// setWindowResizable is unexported until specification is determined (#320)
//
// setWindowResizable sets the state if the window is resizable.
//
// The window is not resizable by default.
//
// When the window is resizable, the image size given via the update function can be changed by resizing.
//
// SetWindowResizable works only on desktops.
// SetWindowResizable does nothing on other platforms.
// setWindowResizable works only on desktops.
// setWindowResizable does nothing on other platforms.
//
// SetWindowResizable panics if SetWindowResizable is called after Run.
// setWindowResizable panics if setWindowResizable is called after Run.
//
// SetWindowResizable is concurrent-safe.
func SetWindowResizable(resizable bool) {
// setWindowResizable is concurrent-safe.
func setWindowResizable(resizable bool) {
ui.SetWindowResizable(resizable)
}