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