123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- package main
- import (
- "fmt"
- "red-green/door"
- "strings"
- "time"
- )
- func font_demo(d *door.Door) {
- var output []string
- var l int
- var centering string
- var center bool = false
- var now time.Time = time.Now()
-
-
- d.WriteA(door.Clrscr, door.CRNL)
- var fac door.ColorFont = FontAmazonCyan()
- output, l = fac.Output(now.Format("Jan Mon"))
-
-
- if l < door.Width {
- if center {
- centering = strings.Repeat(" ", (door.Width-l)/2)
- } else {
- centering = ""
- }
- for _, o := range output {
- d.WriteA(fmt.Sprintf("%s%s%s", centering, o, door.Reset), door.CRNL)
- }
- d.WriteA(door.CRNL)
- }
- var patch door.ColorMap = fac.Scan(6)
-
- fac.Modify(4, patch)
- output, l = fac.Output(now.Format("Monday"))
- if center {
- centering = strings.Repeat(" ", (door.Width-l)/2)
- } else {
- centering = ""
- }
- for _, o := range output {
- d.WriteA(fmt.Sprintf("%s%s%s", centering, o, door.Reset), door.CRNL)
- }
- d.WriteA(door.CRNL)
- fac.Modify(1, patch)
- output, l = fac.Output(now.Format("January"))
- if center {
- centering = strings.Repeat(" ", (door.Width-l)/2)
- } else {
- centering = ""
- }
- for _, o := range output {
- d.WriteA(fmt.Sprintf("%s%s%s", centering, o, door.Reset), door.CRNL)
- }
- d.WriteA(door.CRNL)
- press_a_key(d)
-
- var fab door.ColorFont = FontSerpent()
- output, l = fab.Output("Date/Time:")
- if l < door.Width {
- if center {
- centering = strings.Repeat(" ", (door.Width-l)/2)
- } else {
- centering = ""
- }
- for _, o := range output {
- d.WriteA(centering, o, door.Reset, door.CRNL)
- }
- d.WriteA(door.CRNL)
- }
- var unchain door.ColorFont = FontUnchained()
- now = time.Now()
- output, l = unchain.Output(now.Format("01/02/2006"))
- if l < door.Width {
- if center {
- centering = strings.Repeat(" ", (door.Width-l)/2)
- } else {
- centering = ""
- }
- for _, o := range output {
- d.WriteA(centering, o, door.Reset, door.CRNL)
- }
- d.WriteA(door.CRNL)
- }
- output, l = unchain.Output(now.Format("3:04:05 PM"))
- if l > door.Width {
- output, l = unchain.Output("Meow")
- }
- center = true
- if l < door.Width {
- if center {
- centering = strings.Repeat(" ", (door.Width-l)/2)
- } else {
- centering = ""
- }
- for _, o := range output {
- d.WriteA(centering, o, door.Reset, door.CRNL)
- }
- d.WriteA(door.CRNL)
- }
- press_a_key(d)
- var asylum door.ColorFont = FontAsylum()
- output, l = asylum.Output("Bugz ROCKS")
- if l > door.Width {
- output, l = asylum.Output("Aslym")
- }
- if l < door.Width {
- if center {
- centering = strings.Repeat(" ", (door.Width-l)/2)
- } else {
- centering = ""
- }
- for _, o := range output {
- d.WriteA(centering, o, door.Reset, door.CRNL)
- }
- d.WriteA(door.CRNL)
- }
- var brain door.ColorFont = FontBrainDmgBlu()
- output, l = brain.Output("I'm so BLUE")
- if l > door.Width {
- output, l = brain.Output("Blue")
- }
- if l < door.Width {
- if center {
- centering = strings.Repeat(" ", (door.Width-l)/2)
- } else {
- centering = ""
- }
- for _, o := range output {
- d.WriteA(centering, o, door.Reset, door.CRNL)
- }
- d.WriteA(door.CRNL)
- }
- var boner door.ColorFont = FontBoner()
- output, l = boner.Output("Welcome!")
- if l < door.Width {
- if center {
- centering = strings.Repeat(" ", (door.Width-l)/2)
- } else {
- centering = ""
- }
- for _, o := range output {
- d.WriteA(centering, o, door.Reset, door.CRNL)
- }
- d.WriteA(door.CRNL)
- }
- press_a_key(d)
- var descent door.ColorFont = FontDescent()
- output, l = descent.Output("Meanwhile...")
- if l > door.Width {
- output, l = descent.Output("BUGZ")
- }
- if l < door.Width {
- if center {
- centering = strings.Repeat(" ", (door.Width-l)/2)
- } else {
- centering = ""
- }
- for _, o := range output {
- d.WriteA(centering, o, door.Reset, door.CRNL)
- }
- d.WriteA(door.CRNL)
- }
- var remorse door.ColorFont = FontRemorse()
- output, l = remorse.Output("Enjoy the fonts")
- if l > door.Width {
- output, l = remorse.Output("Amazing")
- }
- if l < door.Width {
- if center {
- centering = strings.Repeat(" ", (door.Width-l)/2)
- } else {
- centering = ""
- }
- for _, o := range output {
- d.WriteA(centering, o, door.Reset, door.CRNL)
- }
- d.WriteA(door.CRNL)
- }
- var dungeon door.ColorFont = FontDungeon()
- output, l = dungeon.Output("Until NEXT time")
- if l > door.Width {
- output, l = dungeon.Output("Beware")
- }
- if l < door.Width {
- if center {
- centering = strings.Repeat(" ", (door.Width-l)/2)
- } else {
- centering = ""
- }
- for _, o := range output {
- d.WriteA(centering, o, door.Reset, door.CRNL)
- }
- d.WriteA(door.CRNL)
- }
-
- redgreen := FontRedGreen()
- output, l = redgreen.Output("Red-Green")
- center = false
- if l < door.Width {
- press_a_key(d)
-
- if center {
- centering = strings.Repeat(" ", (door.Width-l)/2)
- } else {
- centering = ""
- }
- for _, o := range output {
- d.WriteA(centering, o, door.Reset, door.CRNL)
- }
- d.WriteA(door.CRNL)
-
- output, l = redgreen.Output("Software")
- center = true
- if center {
- centering = strings.Repeat(" ", (door.Width-l)/2)
- } else {
- centering = ""
- }
- for _, o := range output {
- d.WriteA(centering, o, door.Reset, door.CRNL)
- }
- d.WriteA(door.CRNL)
- }
- }
|