apps/hello: comment the unusual program structure

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-03-31 14:51:21 +02:00
parent 8b2f6dbf13
commit 1d91eb8557
+6
View File
@@ -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 {