123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- package main
- import (
- "fmt"
- "log"
- "red-green/door"
- "strings"
- "time"
- )
- func main() {
- var d door.Door = door.Door{}
- d.Init("yt2000")
- var message string
- var err error
- var key int
- _ = err
- d.Write(door.Clrscr + "\x1b[?1000h")
- d.Write(door.Reset + door.CRNL)
-
- for _, line := range ANSIYtopen() {
- if door.Unicode {
- for _, c := range line {
- d.Write(string(c))
-
- key = d.WaitKey(0, 5*1000)
- if key != -1 {
- d.Write(door.Reset + door.CRNL)
- goto abort
- }
- }
- } else {
-
- var buff []byte = make([]byte, 1)
- for _, c := range []byte(line) {
- buff[0] = c
- d.Write(string(buff))
-
- key = d.WaitKey(0, 5*1000)
- if key != -1 {
- d.Write(door.Reset + door.CRNL)
- goto abort
- }
- }
- }
-
- }
- d.Write(door.Reset + door.CRNL)
- d.WaitKey(2, 0)
- abort:
- d.Write(door.Clrscr)
- var YtFont door.ColorFont = FontCyberWar()
- var yt []string
- var output []string
- var l int
-
- if door.Width < 138 {
- yt = []string{"Yankee", "Trader", "2022"}
- } else {
- yt = []string{"Yankee Trader", "2022"}
- }
- for _, msg := range yt {
- output, l = YtFont.Output(msg)
- var center string
- if l < door.Width {
- center = strings.Repeat(" ", (door.Width-l)/2)
- } else {
- log.Println("[", msg, "]:", l, "Width:", door.Width)
- }
- for _, line := range output {
- d.Write(center + line + door.Reset + door.CRNL)
- }
- d.Write(door.CRNL)
- }
- d.Write(door.CRNL)
- d.Key()
- message = fmt.Sprintf("Returning to the %s BBS..."+door.CRNL, d.Config.BBSID)
- d.Write(message)
- d.WaitKey(1, 0)
- var left time.Duration = d.TimeLeft()
- message = fmt.Sprintf("You had %0.2f minutes remaining!"+door.CRNL, left.Minutes())
- d.Write(message)
- }
|