diff options
Diffstat (limited to 'ui/helpers.go')
-rw-r--r-- | ui/helpers.go | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/ui/helpers.go b/ui/helpers.go deleted file mode 100644 index f2b2adf..0000000 --- a/ui/helpers.go +++ /dev/null @@ -1,41 +0,0 @@ -package ui - -import ( - "fmt" - - tb "github.com/nsf/termbox-go" -) - -func TPrintf(geo *Geometry, ref tb.Cell, format string, a ...interface{}) { - str := fmt.Sprintf(format, a...) - _geo := *geo - newline := func() { - // TODO: Abort when out of room? - geo.Col = _geo.Col - geo.Row++ - } - for _, ch := range str { - switch ch { - case '\n': - newline() - case '\r': - geo.Col = _geo.Col - default: - tb.SetCell(geo.Col, geo.Row, ch, ref.Fg, ref.Bg) - geo.Col++ - if geo.Col == _geo.Col+geo.Width { - newline() - } - } - } -} - -func TFill(geo Geometry, ref tb.Cell) { - _geo := geo - for ; geo.Row < geo.Height; geo.Row++ { - for ; geo.Col < geo.Width; geo.Col++ { - tb.SetCell(geo.Col, geo.Row, ref.Ch, ref.Fg, ref.Bg) - } - geo.Col = _geo.Col - } -} |