42 lines
1.0 KiB
Go
42 lines
1.0 KiB
Go
package main
|
|
|
|
import "fmt"
|
|
import "time"
|
|
import "git.tebibyte.media/sashakoshka/stone"
|
|
import _ "git.tebibyte.media/sashakoshka/stone/backends/pixel"
|
|
|
|
func main () {
|
|
application := stone.Application { }
|
|
application.Run(run)
|
|
}
|
|
|
|
func run (application *stone.Application) {
|
|
currentTime := time.Time { }
|
|
frameDelay := time.Second / 2
|
|
|
|
for {
|
|
if application.Resized() || time.Since(currentTime) > frameDelay {
|
|
currentTime = time.Now()
|
|
|
|
application.ResetDot()
|
|
fmt.Fprintln(application, "hellorld!")
|
|
|
|
hour := currentTime.Hour()
|
|
minute := currentTime.Minute()
|
|
second := currentTime.Second()
|
|
|
|
application.SetRune(0, 1, rune(hour / 10 + 48))
|
|
application.SetRune(1, 1, rune(hour % 10 + 48))
|
|
application.SetRune(2, 1, ':')
|
|
application.SetRune(3, 1, rune(minute / 10 + 48))
|
|
application.SetRune(4, 1, rune(minute % 10 + 48))
|
|
application.SetRune(5, 1, ':')
|
|
application.SetRune(6, 1, rune(second / 10 + 48))
|
|
application.SetRune(7, 1, rune(second % 10 + 48))
|
|
|
|
}
|
|
|
|
if !application.Await(frameDelay) { break }
|
|
}
|
|
}
|