// clear the screen
func (s *TermboxScreen) Clear() {
- termbox.Clear(termbox.ColorWhite, termbox.ColorBlack)
+ termbox.Clear(termbox.ColorDefault, termbox.ColorDefault)
}
// close the screen
s.fg = termbox.ColorDefault
s.bg = termbox.ColorDefault
- s.SetSize( termbox.Size() )
+ s.SetSize(termbox.Size())
}
// print the characters but don't print them outside the screen
s.Flush()
}
+// Clear EOL
+func (s *TermboxScreen) ClearLine(x int, y int) {
+ for i := x; i < s.width; i++ {
+ termbox.SetCell(i, y, ' ', termbox.ColorDefault, termbox.ColorDefault)
+ }
+ s.Flush()
+}
+
// set the screen size
func (s *TermboxScreen) SetSize(width, height int) {
// if we get bigger then clear out the bottom line
func (s *TermboxScreen) Size() (int, int) {
return s.width, s.height
}
+
+// create a channel for termbox.Events and run a poller to send
+// these events to the channel. Return the channel.
+func (s TermboxScreen) TermBoxChan() chan termbox.Event {
+ termboxChan := make(chan termbox.Event)
+ go func() {
+ for {
+ termboxChan <- termbox.PollEvent()
+ }
+ }()
+ return termboxChan
+}