testdoor.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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.WaitKey(120, 0)
  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. left := d.TimeLeft()
  26. message = fmt.Sprintf("You have %0.2f minutes / %0.2f seconds remaining..."+door.CRNL, left.Minutes(), left.Seconds())
  27. d.Write(message)
  28. inputColor := door.ColorText("BRI WHI ON BLUE")
  29. d.Write("What is your name: " + inputColor)
  30. name := d.Input(25)
  31. d.Write(door.Reset + door.CRNL)
  32. message = fmt.Sprintf("Returning %s to the BBS..."+door.CRNL, name)
  33. d.Write(message)
  34. d.WaitKey(3, 0)
  35. left = d.TimeLeft()
  36. message = fmt.Sprintf("You had %0.2f minutes / %0.2f seconds remaining!"+door.CRNL, left.Minutes(), left.Seconds())
  37. d.Write(message)
  38. fmt.Println("Ending testdoor.go")
  39. }