示例#1
0
文件: shiny.go 项目: kardianos/garage
func main(f func(a App)) {
	gldriver.Main(func(s screen.Screen) {
		w, err := s.NewWindow(nil)
		if err != nil {
			log.Fatal(err)
		}
		defer w.Release()

		theApp.glctx = nil
		theApp.worker = nil // handled by shiny

		go func() {
			for range theApp.publish {
				res := w.Publish()
				theApp.publishResult <- PublishResult{
					BackBufferPreserved: res.BackBufferPreserved,
				}
			}
		}()

		go f(theApp)

		for {
			theApp.Send(convertEvent(w.NextEvent()))
		}
	})
}
示例#2
0
func main(f func(screen.Screen)) {
	gldriver.Main(f)
}