2016-01-06 18:24:08 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/nsf/termbox-go"
|
|
|
|
"gogs.bullercodeworks.com/brian/termbox-util"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Screen TODO: Comment
|
|
|
|
type Screen interface {
|
2016-01-07 04:04:42 +00:00
|
|
|
handleKeyPress(event termbox.Event) int
|
2016-01-06 18:24:08 +00:00
|
|
|
performLayout(style style)
|
|
|
|
drawScreen(style style)
|
|
|
|
update()
|
|
|
|
}
|
|
|
|
|
|
|
|
// ViewPort TODO: Comment
|
|
|
|
type ViewPort struct {
|
|
|
|
bytesPerRow int
|
|
|
|
numberOfRows int
|
|
|
|
firstRow int
|
|
|
|
}
|
|
|
|
|
|
|
|
func drawBackground(bg termbox.Attribute) {
|
|
|
|
termbox.Clear(0, bg)
|
|
|
|
}
|
|
|
|
|
|
|
|
func layoutAndDrawScreen(screen Screen, style style) {
|
|
|
|
screen.performLayout(style)
|
|
|
|
drawBackground(style.defaultBg)
|
|
|
|
screen.drawScreen(style)
|
|
|
|
if debugMode {
|
|
|
|
termboxUtil.DrawStringAtPoint(debugText, 0, 0, style.defaultFg, style.defaultBg)
|
|
|
|
}
|
|
|
|
termbox.Flush()
|
|
|
|
}
|