testdoor.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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)
  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. d.Write("Returning you to the BBS..." + door.CRNL)
  29. d.WaitKey(3)
  30. left = d.TimeLeft()
  31. message = fmt.Sprintf("You had %0.2f minutes / %0.2f seconds remaining!"+door.CRNL, left.Minutes(), left.Seconds())
  32. d.Write(message)
  33. fmt.Println("Ending testdoor.go")
  34. }