40 lines
654 B
Go
40 lines
654 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"time"
|
|
|
|
ui "github.com/gizak/termui/v3"
|
|
"github.com/gizak/termui/v3/widgets"
|
|
"morozovad.ddns.net/lnd212/go-roflcopter/roflcopter"
|
|
)
|
|
|
|
var (
|
|
count time.Duration = 15 * time.Second
|
|
str string = ""
|
|
p *widgets.Paragraph
|
|
)
|
|
|
|
const (
|
|
playSound = true
|
|
timer = 15*time.Second
|
|
)
|
|
|
|
func updateScreen() {
|
|
if err := ui.Init(); err != nil {
|
|
log.Fatalf("failed to initialize termui: %v", err)
|
|
}
|
|
defer ui.Close()
|
|
|
|
p.Text = str
|
|
p.SetRect(0, 0, 25, 12)
|
|
ui.Render(p)
|
|
}
|
|
|
|
func main() {
|
|
p = widgets.NewParagraph()
|
|
rofl := roflcopter.NewRoflcopter(timer, &str, playSound, updateScreen)
|
|
rofl.Start()
|
|
time.Sleep(timer)
|
|
}
|