Use termbox-screen library

This commit is contained in:
2019-02-28 07:44:03 -06:00
parent 1c290b6b0b
commit 5d95e080ef
8 changed files with 122 additions and 226 deletions

View File

@@ -4,13 +4,15 @@ import (
"fmt"
"time"
"github.com/br0xen/termbox-screen"
"github.com/br0xen/termbox-util"
termbox "github.com/nsf/termbox-go"
)
const AboutScreenId = 2
// AboutScreen holds all that's going on
type AboutScreen struct {
viewPort ViewPort
message string
messageTimeout time.Duration
messageTime time.Time
@@ -25,7 +27,9 @@ type Command struct {
description string
}
func (screen *AboutScreen) initialize(bundle Bundle) error {
func (screen *AboutScreen) Id() int { return AboutScreenId }
func (screen *AboutScreen) Initialize(bundle termboxScreen.Bundle) error {
screen.titleTemplate = []string{
" __ ",
" _________ _____| | __",
@@ -53,12 +57,13 @@ func (screen *AboutScreen) initialize(bundle Bundle) error {
return nil
}
func (screen *AboutScreen) ResizeScreen() { screen.Initialize(nil) }
func (screen *AboutScreen) handleKeyEvent(event termbox.Event) int {
return ScreenMain
func (screen *AboutScreen) HandleKeyEvent(event termbox.Event) int {
return MainScreenId
}
func (screen *AboutScreen) drawScreen() {
func (screen *AboutScreen) DrawScreen() {
width, height := termbox.Size()
xPos := (width - len(screen.titleTemplate[0])) / 2
yPos := 1