Clean up tcell exercise

Tcell is a tad bit too low level of an API for me, I'll just stick with
Gocui until I need lower-level control
This commit is contained in:
raul 2024-04-12 08:21:45 +02:00
parent ac3ded6e9a
commit ae2477dc77
1 changed files with 6 additions and 3 deletions

View File

@ -18,11 +18,12 @@ func main() {
if err := screen.Init(); err != nil {
log.Fatalf("%v", err)
}
x, y := 0, 0
//defStyle := tcell.StyleDefault.Background
defStyle := tcell.StyleDefault.Background(tcell.ColorReset).Foreground(tcell.ColorReset)
screen.SetStyle(defStyle)
go Run(screen, defStyle)
go Run(x, y, screen, defStyle)
for {
switch event := screen.PollEvent().(type) {
@ -39,10 +40,12 @@ func main() {
}
func Run(screen tcell.Screen, defStyle tcell.Style) {
func Run(x int, y int, screen tcell.Screen, defStyle tcell.Style) {
for {
screen.SetContent(20, 20, 'A', nil, defStyle)
screen.SetContent(x, y, 'A', nil, defStyle)
screen.Show()
x++
y++
time.Sleep(time.Second)
}
}