github.com/as/shiny@v0.8.2/driver/windriver/windriver.go (about)

     1  // Copyright 2015 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // +build windows
     6  
     7  package windriver
     8  
     9  import (
    10  	"github.com/as/shiny/driver/internal/errscreen"
    11  	"github.com/as/shiny/driver/win32"
    12  	"github.com/as/shiny/screen"
    13  )
    14  
    15  // Main is called by the program's main function to run the graphical
    16  // application.
    17  //
    18  // It calls f on the Screen, possibly in a separate goroutine, as some OS-
    19  // specific libraries require being on 'the main thread'. It returns when f
    20  // returns.
    21  func Main(f func(screen.Screen)) {
    22  	if err := win32.Main(func() { f(theScreen) }); err != nil {
    23  		f(errscreen.Stub(err))
    24  	}
    25  }