From 70bd0b02f34e8e746d3b3936054421390b83f9aa Mon Sep 17 00:00:00 2001 From: Zack Guo Date: Tue, 3 Feb 2015 09:07:31 -0500 Subject: [PATCH] Renderer interface --- box.go | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ point.go | 9 +++++ render.go | 23 +++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 box.go create mode 100644 point.go create mode 100644 render.go diff --git a/box.go b/box.go new file mode 100644 index 0000000..a9274b8 --- /dev/null +++ b/box.go @@ -0,0 +1,98 @@ +package termui + +import tm "github.com/nsf/termbox-go" + +const TOP_RIGHT = '┐' +const VERTICAL_LINE = '│' +const HORIZONTAL_LINE = '─' +const TOP_LEFT = '┌' +const BOTTOM_RIGHT = '┘' +const BOTTOM_LEFT = '└' + +type Box struct { + X int + Y int + Width int + Height int + Border bool + FgColor tm.Attribute + BgColor tm.Attribute +} + +type HLine struct { + X int + Y int + Length int + FgColor tm.Attribute + BgColor tm.Attribute +} + +type VLine struct { + X int + Y int + Length int + FgColor tm.Attribute + BgColor tm.Attribute +} + +func (l HLine) Buffer() []Point{ + pts := make([]Point,l.Length) + for i:=0;i