From 1d91eb855784041355ac7825b271980dd4bbf2b3 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sun, 31 Mar 2019 14:51:21 +0200 Subject: [PATCH] apps/hello: comment the unusual program structure Signed-off-by: Elias Naur --- apps/hello/hello.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/hello/hello.go b/apps/hello/hello.go index faffb3e6..f7742d3e 100644 --- a/apps/hello/hello.go +++ b/apps/hello/hello.go @@ -18,9 +18,13 @@ import ( ) func main() { + // Never called on mobile, blocks forever on + // desktop. app.Main() } +// On iOS and Android main will never be called, so +// setting up the window must run in an init function. func init() { regular, err := sfnt.Parse(goregular.TTF) if err != nil { @@ -29,6 +33,8 @@ func init() { var faces measure.Faces black := &image.Uniform{color.Black} face := faces.For(regular, ui.Dp(50)) + // On iOS and Android app.NewWindow blocks, waiting + // for the platform to create a window. go func() { w, err := app.NewWindow(nil) if err != nil {