From b3a01b28cbfe43ef22168a2f81803dccd4e56864 Mon Sep 17 00:00:00 2001 From: citrons Date: Fri, 30 May 2025 17:47:35 -0500 Subject: simple client --- client/main.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 client/main.go (limited to 'client/main.go') diff --git a/client/main.go b/client/main.go new file mode 100644 index 0000000..1f46a00 --- /dev/null +++ b/client/main.go @@ -0,0 +1,31 @@ +package main + +import ( + "citrons.xyz/talk/tui" + "time" +) + +func main() { + tui.Start() + + app := newApplication("localhost:27508") + go app.RunClient() + + drawTick := time.Tick(time.Second / 60) + redraw := true + for { + select { + case m := <-app.Messages(): + m.Handle(app) + redraw = true + case e := <-tui.Events(): + app.onInput(e) + redraw = true + case <-drawTick: + if redraw { + app.show() + redraw = false + } + } + } +} -- cgit v1.2.3