Browse Source

Updated testdoor art (growl.ans) to use //go:embed

Steve Thielemann 2 years ago
parent
commit
801ed575d6
1 changed files with 25 additions and 0 deletions
  1. 25 0
      testdoor/art.go

+ 25 - 0
testdoor/art.go

@@ -0,0 +1,25 @@
+package main
+
+import (
+	_ "embed"
+	"log"
+	"red-green/door"
+	"strings"
+)
+
+//go:embed growl.ans
+var growl string
+
+func ANSIGrowl() []string {
+	data := strings.Split(growl, "\n")
+
+	if !door.Unicode && !door.CP437 {
+		log.Panicf("Call after door.Init() so Unicode/CP437 has been set.")
+	}
+	if door.Unicode {
+		for idx := range data {
+			data[idx] = door.CP437_to_Unicode(data[idx])
+		}
+	}
+	return data
+}