ui/app,apps/gophers,apps/hello: accept nil WindowOptions in NewWindow

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-03-31 13:55:05 +02:00
parent f21b5eb1df
commit 1d67fad0c3
10 changed files with 21 additions and 18 deletions
+8 -1
View File
@@ -64,7 +64,14 @@ var extraArgs string
// ignore or adjust them.
// If the current program is running on iOS and Android,
// NewWindow the window previously created by the platform.
func NewWindow(opts WindowOptions) (*Window, error) {
func NewWindow(opts *WindowOptions) (*Window, error) {
if opts == nil {
opts = &WindowOptions{
Width: ui.Dp(800),
Height: ui.Dp(600),
Title: "Gio program",
}
}
if opts.Width.V <= 0 || opts.Height.V <= 0 {
panic("window width and height must be larger than 0")
}