Pass keyboard events through application
This commit is contained in:
@@ -14,9 +14,18 @@ func main () {
|
||||
func run (application *stone.Application) {
|
||||
currentTime := time.Time { }
|
||||
frameDelay := time.Second / 2
|
||||
textBuffer := ""
|
||||
|
||||
for {
|
||||
if application.Resized() || time.Since(currentTime) > frameDelay {
|
||||
typed := application.Typed()
|
||||
textBuffer += typed
|
||||
|
||||
shouldRender :=
|
||||
application.Resized() ||
|
||||
time.Since(currentTime) > frameDelay ||
|
||||
len(typed) > 0
|
||||
|
||||
if shouldRender {
|
||||
currentTime = time.Now()
|
||||
|
||||
application.ResetDot()
|
||||
@@ -34,7 +43,10 @@ func run (application *stone.Application) {
|
||||
application.SetRune(5, 1, ':')
|
||||
application.SetRune(6, 1, rune(second / 10 + 48))
|
||||
application.SetRune(7, 1, rune(second % 10 + 48))
|
||||
|
||||
|
||||
application.Dot.X = 0
|
||||
application.Dot.Y = 2
|
||||
fmt.Fprintln(application, textBuffer)
|
||||
}
|
||||
|
||||
if !application.Await(frameDelay) { break }
|
||||
|
||||
Reference in New Issue
Block a user