Browse Source

Fixed Clrscr to reset color. Cleaner update.

Steve Thielemann 3 years ago
parent
commit
802e161320
2 changed files with 19 additions and 13 deletions
  1. 9 9
      door/door.go
  2. 10 4
      testdoor/testdoor.go

+ 9 - 9
door/door.go

@@ -30,15 +30,15 @@ import (
 	"time"
 )
 
-const CRNL = "\r\n"            // BBS Line Ending
-const Clrscr = "\x1b[2J\x1b[H" // Clear screen, home cursor
-var Reset string = Color(0)    // ANSI Color Reset
-var Unicode bool               // Unicode support detected
-var CP437 bool                 // CP437 support detected
-var Full_CP437 bool            // Full CP437 support detected (handles control codes properly)
-var Height int                 // Screen height detected
-var Width int                  // Screen width detected
-var Inactivity int64 = 120     // Inactivity timeout
+const CRNL = "\r\n"                   // BBS Line Ending
+const Clrscr = "\x1b[0m\x1b[2J\x1b[H" // Clear screen, home cursor
+var Reset string = Color(0)           // ANSI Color Reset
+var Unicode bool                      // Unicode support detected
+var CP437 bool                        // CP437 support detected
+var Full_CP437 bool                   // Full CP437 support detected (handles control codes properly)
+var Height int                        // Screen height detected
+var Width int                         // Screen width detected
+var Inactivity int64 = 120            // Inactivity timeout
 
 /*
 door32.sys:

+ 10 - 4
testdoor/testdoor.go

@@ -141,16 +141,22 @@ func progress_bars(d *door.Door) {
 	bar2.UpdateP = pctUpdate(&percentage)
 	bar3.UpdateP = pctUpdate(&percentage)
 
-	d.Write(door.Reset + "Half-Step, Percentage with space and Color Range, Gradient..." + door.CRNL)
+	update_bars := func() {
+		bar.Update()
+		bar2.Update()
+		bar3.Update()
+	}
+
+	d.Write(door.Goto(3, 12) + "Half-Step")
+	d.Write(door.Goto(25, 12) + "% with space and Color Range")
+	d.Write(door.Goto(57, 12) + "Gradient")
 
 	bar_start := door.Goto(3, 15)
 
 	for f := 0; f <= 100; f++ {
 		percentage = int64(f * 100)
 
-		bar.Update()
-		bar2.Update()
-		bar3.Update()
+		update_bars()
 
 		d.Write(bar_start + bar.Output() + "  " + door.Reset + bar2.Output() + door.Reset + "  " + bar3.Output())