From ae2477dc77843038a0118dd02a1c540437328f00 Mon Sep 17 00:00:00 2001 From: raul Date: Fri, 12 Apr 2024 08:21:45 +0200 Subject: [PATCH] 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 --- tcell-practice/main.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tcell-practice/main.go b/tcell-practice/main.go index fc61946..7962770 100644 --- a/tcell-practice/main.go +++ b/tcell-practice/main.go @@ -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) } }