Prechádzať zdrojové kódy

Use dynamic text for font demo.

bugz 1 rok pred
rodič
commit
c343d3482e
1 zmenil súbory, kde vykonal 17 pridanie a 11 odobranie
  1. 17 11
      testdoor/testdoor.go

+ 17 - 11
testdoor/testdoor.go

@@ -234,7 +234,7 @@ func display_information(d *door.Door) {
 
 	header = "Detected: "
 	offset = strings.Repeat(" ", len(header))
-	d.Write(headerColor + header)
+	d.Write(door.CRNL + headerColor + header)
 	d.Write(nice_format("Unicode", strconv.FormatBool(door.Unicode)))
 	d.Write(offset + nice_format("CP437", strconv.FormatBool(door.CP437)))
 	d.Write(offset + nice_format("Full CP437", strconv.FormatBool(door.Full_CP437)))
@@ -243,7 +243,9 @@ func display_information(d *door.Door) {
 	d.Write(offset + nice_format("Door Time Left", fmt.Sprintf("%d Hours, %d Minutes, %d Seconds", int(time.Hours()), int(time.Minutes())%60, int(time.Seconds())%60)))
 	time = d.TimeUsed()
 	d.Write(offset + nice_format("Door Time Used", fmt.Sprintf("%d Minutes, %d Seconds", int(time.Minutes()), int(time.Seconds())%60)))
+	press_a_key(d)
 
+	d.Write(door.Clrscr + door.CRNL + door.CRNL + door.CRNL)
 	modules := GetModules()
 	header = "Build:    "
 	offset = strings.Repeat(" ", len(header))
@@ -270,16 +272,19 @@ func font_demo(d *door.Door) {
 	var output []string
 	var l int
 	var centering string
+	var now time.Time = time.Now()
 
 	d.Write(door.Clrscr + door.CRNL) //  + door.CRNL + door.CRNL)
 	var fac door.ColorFont = FontAmazonCyan()
-	output, l = fac.Output("ABCDEFGHIJKL")
-	if l > door.Width {
-		output, l = fac.Output("Cyan")
-	}
-
+	output, l = fac.Output(now.Format("Jan Mon"))
+	/*
+		if l > door.Width {
+			output, l = fac.Output("Jan")
+		}
+	*/
 	if l < door.Width {
-		centering = strings.Repeat(" ", (door.Width-l)/2)
+		centering = ""
+		// centering = strings.Repeat(" ", (door.Width-l)/2)
 
 		for _, o := range output {
 			d.Write(fmt.Sprintf("%s%s%s", centering, o, door.Reset) + door.CRNL)
@@ -292,7 +297,7 @@ func font_demo(d *door.Door) {
 
 	fac.Modify(4, patch)
 
-	output, l = fac.Output("Blue")
+	output, l = fac.Output(now.Format("Monday"))
 	centering = strings.Repeat(" ", (door.Width-l)/2)
 	for _, o := range output {
 		d.Write(fmt.Sprintf("%s%s%s", centering, o, door.Reset) + door.CRNL)
@@ -300,7 +305,7 @@ func font_demo(d *door.Door) {
 	d.Write(door.CRNL)
 
 	fac.Modify(1, patch)
-	output, l = fac.Output("Red")
+	output, l = fac.Output(now.Format("Janunary")) // 3:04:05 PM"))
 	centering = strings.Repeat(" ", (door.Width-l)/2)
 	for _, o := range output {
 		d.Write(fmt.Sprintf("%s%s%s", centering, o, door.Reset) + door.CRNL)
@@ -309,7 +314,8 @@ func font_demo(d *door.Door) {
 	press_a_key(d)
 
 	var fab door.ColorFont = FontAnarchyBlue()
-	output, l = fab.Output("Bugz is Here!")
+	now = time.Now()
+	output, l = fab.Output(now.Format("01/02/2006"))
 	if l > door.Width {
 		output, l = fab.Output("Hello")
 	}
@@ -324,7 +330,7 @@ func font_demo(d *door.Door) {
 	}
 
 	var unchain door.ColorFont = FontUnchained()
-	output, l = unchain.Output("Hi There!")
+	output, l = unchain.Output(now.Format("3:04:05 PM"))
 	if l > door.Width {
 		output, l = unchain.Output("Meow")
 	}