diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-02-17 16:35:36 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2018-02-17 16:35:36 -0500 |
commit | 60b351b78c930110716b0c9db2227e13704f826d (patch) | |
tree | 3d5d6f69fe416cfd4032c7d672168c965999ec4d /ui/helpers.go | |
parent | 1892d73161a006182d7ef467e2bfc03c11587cb6 (diff) |
Polish up grid and add new rendering loop
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 - } -} |