func main() { flag.Parse() termbox.Init() go fire() go ticker(timeoutc) // wait for any event for { ev := termbox.PollEvent() if ev.Ch == 'q' { break } } termbox.Close() return }
func main() { flag.Parse() if *d == 0 { *d = 1 } termbox.Init() defer termbox.Close() go func() { var c, bc coord var change bool var color termbox.Attribute for { change = !change if change { c.dir = rand.Intn(17) color = termbox.Attribute(c.dir) c.dir = c.dir % 8 bc.dir = rand.Intn(9) } w, h := termbox.Size() bc.step(w, h) c.step(w, h) termbox.SetCell(bc.x, bc.y, ' ', termbox.ColorDefault, termbox.ColorDefault) termbox.SetCell(c.x, c.y, ch(), color, termbox.ColorDefault) termbox.Flush() time.Sleep(*d) } }() for { ev := termbox.PollEvent() if ev.Ch == 'q' { return } } }