2019-02-02 04:39:34 +00:00
|
|
|
package console
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
ui "github.com/sqshq/termui"
|
|
|
|
"log"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2019-02-16 15:53:10 +00:00
|
|
|
RenderRate = 100 * time.Millisecond
|
2019-02-02 14:30:30 +00:00
|
|
|
Title = "sampler"
|
2019-02-02 04:39:34 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Console struct{}
|
|
|
|
|
|
|
|
func (self *Console) Init() {
|
|
|
|
|
|
|
|
fmt.Printf("\033]0;%s\007", Title)
|
|
|
|
|
|
|
|
if err := ui.Init(); err != nil {
|
|
|
|
log.Fatalf("failed to initialize termui: %v", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (self *Console) Close() {
|
|
|
|
ui.Close()
|
|
|
|
}
|