Thinking about an intcode debugger
This commit is contained in:
44
2019/intcode-processor/debugger/app_state.go
Normal file
44
2019/intcode-processor/debugger/app_state.go
Normal file
@@ -0,0 +1,44 @@
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user