123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- package main
- import (
- "fmt"
- "red-green/door"
- )
- func main() {
- fmt.Println("Starting testdoor.go")
- d := door.Door{}
- d.Init()
- reset := door.Reset
- bold := door.Color(1, 37, 40)
- bolder := door.ColorText("BLI BOLD YEL ON BLUE")
- d.Write("Welcome to " + bolder + "door32.sys" + reset + door.CRNL + "..." + door.CRNL)
- key := d.WaitKey(120, 0)
- message := fmt.Sprintf("Key %s%d / %x%s"+door.CRNL, bold, key, key, reset)
- d.Write(message)
- b := door.Box{20, 1}
- d.Write(b.Top() + door.CRNL)
- // or %-20s
- message = fmt.Sprintf("%20s", "SHAZAM!")
- d.Write(b.Row(message) + door.CRNL)
- d.Write(b.Middle() + door.CRNL)
- d.Write(b.Row(fmt.Sprintf("%-20s", "Meow?")) + door.CRNL)
- d.Write(b.Bottom() + door.CRNL)
- left := d.TimeLeft()
- message = fmt.Sprintf("You have %0.2f minutes / %0.2f seconds remaining..."+door.CRNL, left.Minutes(), left.Seconds())
- d.Write(message)
- inputColor := door.ColorText("BRI WHI ON BLUE")
- d.Write("What is your name: " + inputColor)
- name := d.Input(25)
- d.Write(door.Reset + door.CRNL)
- message = fmt.Sprintf("Returning %s to the BBS..."+door.CRNL, name)
- d.Write(message)
- d.WaitKey(3, 0)
- left = d.TimeLeft()
- message = fmt.Sprintf("You had %0.2f minutes / %0.2f seconds remaining!"+door.CRNL, left.Minutes(), left.Seconds())
- d.Write(message)
- fmt.Println("Ending testdoor.go")
- }
|