|
|
@@ -4,11 +4,19 @@ import (
|
|
|
"log"
|
|
|
"strings"
|
|
|
"time"
|
|
|
-
|
|
|
+ _ "embed"
|
|
|
+
|
|
|
"github.com/gdamore/tcell/v3"
|
|
|
"github.com/gdamore/tcell/v3/color"
|
|
|
)
|
|
|
|
|
|
+
|
|
|
+//go:embed assets/title/title_idle.txt
|
|
|
+var title_idle string
|
|
|
+
|
|
|
+//go:embed assets/title/title_blinking.txt
|
|
|
+var title_blinking string
|
|
|
+
|
|
|
func drawText(s tcell.Screen, x1, y1, x2, y2 int, style tcell.Style, text string) {
|
|
|
row := y1
|
|
|
col := x1
|
|
|
@@ -30,98 +38,23 @@ func drawText(s tcell.Screen, x1, y1, x2, y2 int, style tcell.Style, text string
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-var title_idle string = `
|
|
|
-
|
|
|
-⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀
|
|
|
-⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀
|
|
|
-⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣿⣿⡆⠀⠀⠀⠀⠀⠀⣸⣿⣿⣿⣿⣿⡆⠀⠀⠀⠀⠀⠀
|
|
|
-⠀⠀⠀⠀⠀⣾⣿⣿⣿⣿⣿⣿⣿⡀⠀⠀⠀⠀⢀⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀
|
|
|
-⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀
|
|
|
-⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣠⣤⣤⣼⣿⣿⣿⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀⠀
|
|
|
-⠀⠀⠀⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀
|
|
|
-⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀
|
|
|
-⠀⠀⠀⠘⣿⣿⣿⣿⠟⠁⠀⠀⠀⠹⣿⣿⣿⣿⣿⠟⠁⠀⠀⠹⣿⣿⡿⠀⠀⠀⠀⠀
|
|
|
-⠀⠀⠀⠀⣿⣿⣿⡇⠀⠀⠀⢼⣿⠀⢿⣿⣿⣿⣿⠀⣾⣷⠀⠀⢿⣿⣷⠀⠀⠀⠀⠀
|
|
|
-⠀⠀⠀⢠⣿⣿⣿⣷⡀⠀⠀⠈⠋⢀⣿⣿⣿⣿⣿⡀⠙⠋⠀⢀⣾⣿⣿⠀⠀⠀⠀⠀
|
|
|
-⢀⣀⣀⣀⣿⣿⣿⣿⣿⣶⣶⣶⣶⣿⣿⣿⣿⣾⣿⣷⣦⣤⣴⣿⣿⣿⣿⣤⠤⢤⣤⡄
|
|
|
-⠈⠉⠉⢉⣙⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⣀⣀⣀⡀⠀
|
|
|
-⠐⠚⠋⠉⢀⣬⡿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣥⣀⡀⠈⠀⠈⠛
|
|
|
-⠀⠀⠴⠚⠉⠀⠀⠀⠉⠛⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⠋⠁⠀⠀⠀⠉⠛⠢⠀⠀
|
|
|
-⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ /$$ /$$ /$$ /$$ /$$
|
|
|
-⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀| $$ | $$ |__/| $$| $$
|
|
|
-⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀| $$ | $$ /$$$$$$ /$$$$$$$ /$$| $$| $$ /$$$$$$
|
|
|
-⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀| $$ / $$/|____ $$| $$__ $$| $$| $$| $$ |____ $$
|
|
|
-⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \ $$ $$/ /$$$$$$$| $$ \ $$| $$| $$| $$ /$$$$$$$
|
|
|
-⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀ \ $$$/ /$$__ $$| $$ | $$| $$| $$| $$ /$$__ $$
|
|
|
-⠀⠀⠀⠀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀ \ $/ | $$$$$$$| $$ | $$| $$| $$| $$| $$$$$$$
|
|
|
-⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀ \_/ \_______/|__/ |__/|__/|__/|__/ \_______/
|
|
|
-
|
|
|
- /$$$$$$ /$$ /$$
|
|
|
- /$$__ $$ | $$ | $$
|
|
|
-| $$ \ $$ /$$$$$$$ /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$ /$$ /$$$$$$ /$$$$$$ /$$$$$$$
|
|
|
-| $$$$$$$$ /$$__ $$| $$ /$$//$$__ $$| $$__ $$|_ $$_/ | $$ | $$ /$$__ $$ /$$__ $$ /$$_____/
|
|
|
-| $$__ $$| $$ | $$ \ $$/$$/| $$$$$$$$| $$ \ $$ | $$ | $$ | $$| $$ \__/| $$$$$$$$| $$$$$$
|
|
|
-| $$ | $$| $$ | $$ \ $$$/ | $$_____/| $$ | $$ | $$ /$$| $$ | $$| $$ | $$_____/ \____ $$
|
|
|
-| $$ | $$| $$$$$$$ \ $/ | $$$$$$$| $$ | $$ | $$$$/| $$$$$$/| $$ | $$$$$$$ /$$$$$$$/
|
|
|
-|__/ |__/ \_______/ \_/ \_______/|__/ |__/ \___/ \______/ |__/ \_______/|_______/
|
|
|
-`
|
|
|
-
|
|
|
-var title_blinking string = `
|
|
|
-
|
|
|
-⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀
|
|
|
-⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀
|
|
|
-⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣿⣿⡆⠀⠀⠀⠀⠀⠀⣸⣿⣿⣿⣿⣿⡆⠀⠀⠀⠀⠀⠀
|
|
|
-⠀⠀⠀⠀⠀⣾⣿⣿⣿⣿⣿⣿⣿⡀⠀⠀⠀⠀⢀⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀
|
|
|
-⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀
|
|
|
-⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣠⣤⣤⣼⣿⣿⣿⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀⠀
|
|
|
-⠀⠀⠀⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀
|
|
|
-⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀
|
|
|
-⠀⠀⠀⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠀⠀⠀⠀⠀⠀
|
|
|
-⠀⠀⠀⠀⣿⣿⣿⣿⣿⣤⣤⣤⣤⣼⣿⣿⣿⣿⣧⣤⣤⣤⣤⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
|
|
-⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀
|
|
|
-⢀⣀⣀⣀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣤⠤⢤⣤⡄
|
|
|
-⠈⠉⠉⢉⣙⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⣀⣀⣀⡀⠀
|
|
|
-⠐⠚⠋⠉⢀⣬⡿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣥⣀⡀⠈⠀⠈⠛
|
|
|
-⠀⠀⠴⠚⠉⠀⠀⠀⠉⠛⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⠋⠁⠀⠀⠀⠉⠛⠢⠀⠀
|
|
|
-⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ /$$ /$$ /$$ /$$ /$$
|
|
|
-⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀| $$ | $$ |__/| $$| $$
|
|
|
-⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀| $$ | $$ /$$$$$$ /$$$$$$$ /$$| $$| $$ /$$$$$$
|
|
|
-⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀| $$ / $$/|____ $$| $$__ $$| $$| $$| $$ |____ $$
|
|
|
-⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀ \ $$ $$/ /$$$$$$$| $$ \ $$| $$| $$| $$ /$$$$$$$
|
|
|
-⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀ \ $$$/ /$$__ $$| $$ | $$| $$| $$| $$ /$$__ $$
|
|
|
-⠀⠀⠀⠀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀ \ $/ | $$$$$$$| $$ | $$| $$| $$| $$| $$$$$$$
|
|
|
-⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀ \_/ \_______/|__/ |__/|__/|__/|__/ \_______/
|
|
|
-
|
|
|
- /$$$$$$ /$$ /$$
|
|
|
- /$$__ $$ | $$ | $$
|
|
|
-| $$ \ $$ /$$$$$$$ /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$ /$$ /$$$$$$ /$$$$$$ /$$$$$$$
|
|
|
-| $$$$$$$$ /$$__ $$| $$ /$$//$$__ $$| $$__ $$|_ $$_/ | $$ | $$ /$$__ $$ /$$__ $$ /$$_____/
|
|
|
-| $$__ $$| $$ | $$ \ $$/$$/| $$$$$$$$| $$ \ $$ | $$ | $$ | $$| $$ \__/| $$$$$$$$| $$$$$$
|
|
|
-| $$ | $$| $$ | $$ \ $$$/ | $$_____/| $$ | $$ | $$ /$$| $$ | $$| $$ | $$_____/ \____ $$
|
|
|
-| $$ | $$| $$$$$$$ \ $/ | $$$$$$$| $$ | $$ | $$$$/| $$$$$$/| $$ | $$$$$$$ /$$$$$$$/
|
|
|
-|__/ |__/ \_______/ \_/ \_______/|__/ |__/ \___/ \______/ |__/ \_______/|_______/
|
|
|
-`
|
|
|
-var cats = [][]string{
|
|
|
- strings.Split(title_idle, "\n"),
|
|
|
- strings.Split(title_blinking, "\n")}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-func drawTitle(s tcell.Screen, x, frame int, style tcell.Style) int{
|
|
|
- lines := cats[frame]
|
|
|
+func drawTitle(s tcell.Screen, x, padding_top, frame int, style tcell.Style, titles [][]string) int{
|
|
|
+ lines := titles[frame]
|
|
|
frame = (frame + 1) % 2
|
|
|
// Draw Title
|
|
|
xmax, ymax := s.Size()
|
|
|
for l:= range lines{
|
|
|
- drawText(s,x, l, xmax, ymax, style, lines[l])
|
|
|
+ drawText(s,x, l+padding_top, xmax, ymax, style, lines[l])
|
|
|
}
|
|
|
return len(lines)
|
|
|
}
|
|
|
|
|
|
-
|
|
|
func main() {
|
|
|
- defStyle := tcell.StyleDefault.Background(color.Reset).Foreground(color.NewHexColor(0xf3e5ab))
|
|
|
+ cats := [][]string{
|
|
|
+ strings.Split(string(title_idle), "\n"),
|
|
|
+ strings.Split(string(title_blinking), "\n")}
|
|
|
+
|
|
|
+ defStyle := tcell.StyleDefault.Background(color.Black).Foreground(color.NewHexColor(0xf3e5ab))
|
|
|
|
|
|
// Initialize screen
|
|
|
s, err := tcell.NewScreen()
|
|
|
@@ -156,7 +89,6 @@ func main() {
|
|
|
// the queue, or else a single-party deadlock might occur.
|
|
|
// s.EventQ() <- tcell.NewEventKey(tcell.KeyRune, rune('a'), 0)
|
|
|
|
|
|
-
|
|
|
curr_menu_item := 0
|
|
|
menu := true
|
|
|
gap_title_menu := 3
|
|
|
@@ -168,7 +100,7 @@ func main() {
|
|
|
// Event loop
|
|
|
for {
|
|
|
s.Clear()
|
|
|
- title_size := drawTitle(s, 10, frame, defStyle)
|
|
|
+ title_size := drawTitle(s, 10, 2, frame, defStyle, cats)
|
|
|
frame = (frame + 1) % 2
|
|
|
xmax,ymax := s.Size()
|
|
|
// Draw Menu
|