testdoor.go 808 B

123456789101112131415161718192021222324252627282930313233
  1. package main
  2. import (
  3. "fmt"
  4. "red-green/door"
  5. )
  6. func main() {
  7. fmt.Println("Starting testdoor.go")
  8. d := door.Door{}
  9. d.Init()
  10. reset := door.Reset
  11. bold := door.Color(1, 37, 40)
  12. bolder := door.ColorText("BLI BOLD YEL ON BLUE")
  13. d.Write("Welcome to " + bolder + "door32.sys" + reset + door.CRNL + "..." + door.CRNL)
  14. key := d.Getch()
  15. message := fmt.Sprintf("Key %s%d / %x%s"+door.CRNL, bold, key, key, reset)
  16. d.Write(message)
  17. b := door.Box{20, 1}
  18. d.Write(b.Top() + door.CRNL)
  19. // or %-20s
  20. message = fmt.Sprintf("%20s", "SHAZAM!")
  21. d.Write(b.Row(message) + door.CRNL)
  22. d.Write(b.Middle() + door.CRNL)
  23. d.Write(b.Row(fmt.Sprintf("%-20s", "Meow?")) + door.CRNL)
  24. d.Write(b.Bottom() + door.CRNL)
  25. d.Write("Returning you to the BBS..." + door.CRNL)
  26. d.SleepKey(3)
  27. fmt.Println("Ending testdoor.go")
  28. }