Browse Source

Merge branch 'master' of ssh://gitredgreen/RedGreen/doorgo

Use Normal, not anyevent.
Steve Thielemann 2 years ago
parent
commit
76496b59f1
2 changed files with 12 additions and 14 deletions
  1. 1 1
      door/box.go
  2. 11 13
      testdoor/testdoor.go

+ 1 - 1
door/box.go

@@ -85,7 +85,7 @@ func (b *Box) Bottom() string {
 
 func AlertBox(text string, style int) []string {
 	var results []string
-	b := Box{Width: len(text), Style: style}
+	b := Box{Width: StringLen(text), Style: style}
 	results = append(results, b.Top())
 	results = append(results, b.Row(text))
 	results = append(results, b.Bottom())

+ 11 - 13
testdoor/testdoor.go

@@ -18,19 +18,8 @@ func pctUpdate(pct *int64) func() int64 {
 	}
 }
 
-// Can I add a function to Door?
-// NO:  cannot define new methods on non-local type door.Door
-
-/*
-func (d *door.Door) PressAKey() {
-	d.Write(door.Reset + door.CRNL + "Press a key to continue...")
-	d.Key()
-	d.Write(door.CRNL)
-}
-*/
-
 func press_keys(d *door.Door) {
-	d.Write(door.Reset + door.CRNL + "Press some keys...")
+	d.Write(door.Reset + door.CRNL + "Press some keys... <ENTER> to exit.")
 	var r rune
 	var ex door.Extended
 	var err error
@@ -690,7 +679,13 @@ func main() {
 	// press_a_key(&d)
 	d.Write(door.CRNL)
 
-	var b []string = door.AlertBox("Warning: golang is in use!", 1)
+	var b []string
+	if door.CP437 {
+		b = door.AlertBox("Warning: golang \xfb is in use!", 1)
+	} else {
+		b = door.AlertBox("Warning: golang \u221a is in use!", 1)
+	}
+
 	d.Write(door.ColorText("BRI WHI ON GREEN"))
 	for _, line := range b {
 		d.Write(line + door.CRNL)
@@ -718,6 +713,8 @@ func main() {
 		}
 		option := mainmenu.GetOption(choice)
 
+		wopr.Stop()
+
 		// fmt.Printf("Choice: %d, Option: %c\n", choice, option)
 
 		switch option {
@@ -759,6 +756,7 @@ func main() {
 			_ = z
 		}
 
+		wopr.Animate(&d)
 	}
 
 	// d.Write("\x1b[?1000l") // disable mouse