x backend has an event loop

This commit is contained in:
2022-11-09 18:53:14 -05:00
parent 0c5118b59a
commit c93ca17fe5
3 changed files with 110 additions and 59 deletions

View File

@@ -4,7 +4,7 @@ import "os"
import "fmt"
import "time"
import "git.tebibyte.media/sashakoshka/stone"
// import _ "git.tebibyte.media/sashakoshka/stone/backends/x"
import _ "git.tebibyte.media/sashakoshka/stone/backends/x"
func main () {
application := &stone.Application { }
@@ -40,51 +40,3 @@ func main () {
}
}
}
// func run (application *stone.Application) {
// currentTime := time.Time { }
// frameDelay := time.Second / 2
// textBuffer := ""
//
// for {
// typed := application.Typed()
// textBuffer += typed
//
// shouldRender :=
// application.Resized() ||
// time.Since(currentTime) > frameDelay ||
// len(typed) > 0
//
// if shouldRender {
// 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))
//
// application.Dot.X = 0
// application.Dot.Y = 2
// fmt.Fprintln(application, textBuffer)
//
// }
//
// if application.Pressed(stone.MouseButtonLeft) {
// x, y := application.MousePosition()
// application.SetRune(x, y, '#')
// }
//
// if !application.Await(frameDelay) { break }
// }
// }