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:
parent
ac3ded6e9a
commit
ae2477dc77
|
@ -18,11 +18,12 @@ func main() {
|
||||||
if err := screen.Init(); err != nil {
|
if err := screen.Init(); err != nil {
|
||||||
log.Fatalf("%v", err)
|
log.Fatalf("%v", err)
|
||||||
}
|
}
|
||||||
|
x, y := 0, 0
|
||||||
|
|
||||||
//defStyle := tcell.StyleDefault.Background
|
//defStyle := tcell.StyleDefault.Background
|
||||||
defStyle := tcell.StyleDefault.Background(tcell.ColorReset).Foreground(tcell.ColorReset)
|
defStyle := tcell.StyleDefault.Background(tcell.ColorReset).Foreground(tcell.ColorReset)
|
||||||
screen.SetStyle(defStyle)
|
screen.SetStyle(defStyle)
|
||||||
go Run(screen, defStyle)
|
go Run(x, y, screen, defStyle)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
switch event := screen.PollEvent().(type) {
|
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 {
|
for {
|
||||||
screen.SetContent(20, 20, 'A', nil, defStyle)
|
screen.SetContent(x, y, 'A', nil, defStyle)
|
||||||
screen.Show()
|
screen.Show()
|
||||||
|
x++
|
||||||
|
y++
|
||||||
time.Sleep(time.Second)
|
time.Sleep(time.Second)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue