func (g *Game) Run() error { go g.EventPoller() go g.Updater() loop: for { g.Draw() select { case <-g.quitq: break loop case <-time.After(time.Millisecond * 10): case ev := <-g.eventq: g.HandleEvent(ev) } } // Inject a wakeup interrupt iev := tcell.NewEventInterrupt(nil) g.screen.PostEvent(iev) g.screen.Fini() // wait for updaters to finish if g.errmsg != "" { return errors.New(g.errmsg) } return nil }
// Interrupt posts an interrupt event. func Interrupt() { screen.PostEvent(tcell.NewEventInterrupt(nil)) }