adventofcode/2019/intcode-processor/debugger/app_state.go

45 lines
764 B
Go
Raw Normal View History

2019-12-09 23:07:56 +00:00
package main
import (
"fmt"
"github.com/br0xen/termbox-screen"
termbox "github.com/nsf/termbox-go"
)
const (
DefaultFg = termbox.ColorWhite
DefaultBg = termbox.ColorBlack
TitleFg = termbox.ColorWhite
TitleBg = termbox.ColorBlue
CursorFg = termbox.ColorBlack
CursorBg = termbox.ColorGreen
ScreenIdExit = iota - 1
ScreenIdMain
ScreenIdError
)
type AppState struct {
ui *termboxScreen.Manager
}
func NewApp(parms []string) *AppState {
return &AppState{}
}
func (a *AppState) run(parms []string) int {
var err error
a.ui = termboxScreen.NewManager()
if err = a.ui.AddAndInitializeScreen(NewMainScreen()); err != nil {
a.ui.Close()
fmt.Println(err.Error())
return 1
}
if err := a.ui.Loop(); err != nil {
return 1
}
return 0
}