Example #1
0
// New returns a pointer to a new TermboxGui.
// Its single window and buffer have the contents of f.
func New(f *os.File) gui.Gui {
	g := new(TermboxGui)
	g.fgColor = termbox.ColorDefault
	g.bgColor = termbox.ColorDefault

	// Create a new buffer
	buffer := buffer.New(f)
	g.Buffers = append(g.Buffers, buffer)
	g.CurrBuff = buffer

	// Create a new window
	width, height := g.Size()
	window := window.New(g.CurrBuff, width, height, 0, 0)

	g.Windows = append(g.Windows, window)
	g.CurrWin = window

	return g
}
Example #2
0
func newBuffer(s string) *buffer.Buffer {
	source := bytes.NewBufferString(s)
	return buffer.New(source)
}