gask-old/screen.go
Brian Buller ff8a0ec0b7 Archive/Unarchive
Several other improvements
2019-02-21 10:47:08 -06:00

71 lines
1.3 KiB
Go

package main
import (
termbox "github.com/nsf/termbox-go"
)
type Screen interface {
handleKeyEvent(termbox.Event) int
initialize(Bundle) error
drawScreen()
}
const (
ScreenMain = iota
ScreenTask
ScreenAbout
ScreenExit
DefaultBg = termbox.ColorBlack
DefaultFg = termbox.ColorWhite
TitleFg = termbox.ColorWhite
TitleBg = termbox.ColorBlue
CursorFg = termbox.ColorBlack
CursorBg = termbox.ColorGreen
)
func (a *AppState) BuildScreens() {
mainScreen := MainScreen{}
aboutScreen := AboutScreen{}
taskScreen := TaskScreen{}
a.screens = append(a.screens, &mainScreen)
a.screens = append(a.screens, &taskScreen)
a.screens = append(a.screens, &aboutScreen)
}
func (a *AppState) drawBackground(bg termbox.Attribute) {
termbox.Clear(0, bg)
}
func (a *AppState) layoutAndDrawScreen(s Screen) {
a.drawBackground(DefaultBg)
s.drawScreen()
termbox.Flush()
}
func readUserInput(e chan termbox.Event) {
for {
e <- termbox.PollEvent()
}
}
func refreshList(e chan termbox.Event) {
/*
for {
time.Sleep(5 * time.Minute)
app.LoadTasklist()
app.LoadDoneList()
e <- termbox.Event{Type: termbox.EventNone}
}
*/
}
/*
* ViewPort helps keep track of what's being displayed on the screen
*/
type ViewPort struct {
bytesPerRow int
numberOfRows int
firstRow int
}