// TODO: do this for all build targets, not just linux (x11 and Android)? If // so, should package gl instead of this package call event.RegisterFilter?? // // TODO: does Android need this?? It seems to work without it (Nexus 7, // KitKat). If only x11 needs this, should we move this to x11.go?? func registerGLViewportFilter() { event.RegisterFilter(func(e interface{}) interface{} { if e, ok := e.(config.Event); ok { w := int(e.PixelsPerPt * float32(e.Width)) h := int(e.PixelsPerPt * float32(e.Height)) gl.Viewport(0, 0, w, h) } return e }) }
func init() { event.RegisterFilter(func(e interface{}) interface{} { if e, ok := e.(event.Lifecycle); ok { switch e.Crosses(event.LifecycleStageVisible) { case event.ChangeOn: start() case event.ChangeOff: stop() } } return e }) }
func init() { event.RegisterFilter(func(e interface{}) interface{} { if e, ok := e.(lifecycle.Event); ok { switch e.Crosses(lifecycle.StageVisible) { case lifecycle.CrossOn: start() case lifecycle.CrossOff: stop() } } return e }) }