瀏覽代碼

Added more fonts. Check output length.

If greater then door.Width, try again with less characters.
Steve Thielemann 3 年之前
父節點
當前提交
f22c060122
共有 2 個文件被更改,包括 63 次插入0 次删除
  1. 1 0
      Makefile
  2. 62 0
      testdoor/testdoor.go

+ 1 - 0
Makefile

@@ -13,6 +13,7 @@ testdoor/fonts.go: font-out
 	echo "package main" > testdoor/fonts.go
 	./font-out -f "Amazon Cyan,Medieval,Anarchy Blue" -tdf TDFONTS.TDF 
 	./font-out -f Unchained,Asylum,ArmageonRed,BrainDmgBlu -tdf TDFONTS2.TDF
+	./font-out -f Boner,Descent,Remorse,Dungeon -tdf tdf/TDFSets/TDFONTS9.TDF
 	cat *_font.go >> testdoor/fonts.go    
 	rm *_font.go
 

+ 62 - 0
testdoor/testdoor.go

@@ -171,6 +171,68 @@ func font_demo(d *door.Door) {
 	}
 	d.Write(door.CRNL)
 
+	boner := FontBoner()
+	output, l = boner.Output("Welcome!")
+	centering = strings.Repeat(" ", (door.Width-l)/2)
+
+	for _, o := range output {
+		if door.Unicode {
+			d.Write(centering + CP437Bytes_to_Unicode(o) + door.Reset + door.CRNL)
+		} else {
+			d.Write(centering + string(o) + door.Reset + door.CRNL)
+		}
+	}
+	d.Write(door.CRNL)
+	press_a_key(d)
+
+	descent := FontDescent()
+	output, l = descent.Output("Meanwhile...")
+	if l > door.Width {
+		output, l = descent.Output("BUGZ !?!")
+	}
+	centering = strings.Repeat(" ", (door.Width-l)/2)
+
+	for _, o := range output {
+		if door.Unicode {
+			d.Write(centering + CP437Bytes_to_Unicode(o) + door.Reset + door.CRNL)
+		} else {
+			d.Write(centering + string(o) + door.Reset + door.CRNL)
+		}
+	}
+	d.Write(door.CRNL)
+
+	remorse := FontRemorse()
+	output, l = remorse.Output("Enjoy the fonts")
+	if l > door.Width {
+		output, l = remorse.Output("Amazing")
+	}
+	centering = strings.Repeat(" ", (door.Width-l)/2)
+
+	for _, o := range output {
+		if door.Unicode {
+			d.Write(centering + CP437Bytes_to_Unicode(o) + door.Reset + door.CRNL)
+		} else {
+			d.Write(centering + string(o) + door.Reset + door.CRNL)
+		}
+	}
+	d.Write(door.CRNL)
+
+	dungeon := FontDungeon()
+	output, l = dungeon.Output("Until NEXT time")
+	if l > door.Width {
+		output, l = dungeon.Output("Beware")
+	}
+	centering = strings.Repeat(" ", (door.Width-l)/2)
+
+	for _, o := range output {
+		if door.Unicode {
+			d.Write(centering + CP437Bytes_to_Unicode(o) + door.Reset + door.CRNL)
+		} else {
+			d.Write(centering + string(o) + door.Reset + door.CRNL)
+		}
+	}
+	d.Write(door.CRNL)
+
 }
 
 func input_demo(d *door.Door) {