|
@@ -474,12 +474,19 @@ func font_demo(d *door.Door) {
|
|
|
|
|
|
func input_demo(d *door.Door) {
|
|
|
var ticker *time.Ticker = time.NewTicker(time.Second)
|
|
|
+ var StopIt = make(chan bool)
|
|
|
|
|
|
go func() {
|
|
|
- for t := range ticker.C {
|
|
|
- const tf = "January 2, 2006 03:04:05 PM MST"
|
|
|
- output := door.SavePos + door.Goto(5, 2) + door.ColorText("BRI WHI ON CYAN") + t.Format(tf) + door.RestorePos
|
|
|
- d.Write(output)
|
|
|
+ for {
|
|
|
+ select {
|
|
|
+ case <-StopIt:
|
|
|
+ return
|
|
|
+
|
|
|
+ case t := <-ticker.C:
|
|
|
+ const tf = "January 2, 2006 03:04:05 PM MST"
|
|
|
+ output := door.SavePos + door.Goto(5, 2) + door.ColorText("BRI WHI ON CYAN") + t.Format(tf) + door.RestorePos
|
|
|
+ d.Write(output)
|
|
|
+ }
|
|
|
}
|
|
|
}()
|
|
|
|
|
@@ -499,6 +506,7 @@ func input_demo(d *door.Door) {
|
|
|
var color string = d.Input(15)
|
|
|
d.Write(door.Reset + door.CRNL)
|
|
|
ticker.Stop()
|
|
|
+ StopIt <- true
|
|
|
d.Write(fmt.Sprintf("You're %s on the %s quest, and fond of %s."+door.CRNL, name, quest, color))
|
|
|
}
|
|
|
|