summaryrefslogtreecommitdiff
path: root/client/main.go
blob: 1f46a00d0a8a9ea4851d782d264890a7bb7ffbac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
			}
		}
	}
}