|
@@ -1,8 +1,9 @@
|
|
|
package main
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
- "github.com/gdamore/tcell/v2"
|
|
|
|
|
"log"
|
|
"log"
|
|
|
|
|
+
|
|
|
|
|
+ "github.com/gdamore/tcell/v2"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
func drawText(s tcell.Screen, x1, y1, x2, y2 int, style tcell.Style, text string) {
|
|
func drawText(s tcell.Screen, x1, y1, x2, y2 int, style tcell.Style, text string) {
|
|
@@ -58,9 +59,8 @@ func drawBox(s tcell.Screen, x1, y1, x2, y2 int, style tcell.Style, text string)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
func main() {
|
|
|
- // info, err := tcell.LookupTerminfo(os.Getenv("TERM"))
|
|
|
|
|
- defStyle := tcell.StyleDefault.Background(tcell.ColorReset).Foreground(tcell.ColorReset)
|
|
|
|
|
- //boxStyle := tcell.StyleDefault.Foreground(tcell.ColorWhite).Background(tcell.ColorPurple)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ defaultStyle := tcell.StyleDefault.Background(tcell.ColorReset).Foreground(tcell.ColorReset)
|
|
|
|
|
|
|
|
var err error
|
|
var err error
|
|
|
|
|
|
|
@@ -77,7 +77,7 @@ func main() {
|
|
|
|
|
|
|
|
screen.Clear()
|
|
screen.Clear()
|
|
|
|
|
|
|
|
- drawBox(screen, 0, 0, x-1, y-1, defStyle, "There should be worms here!")
|
|
|
|
|
|
|
+ drawBox(screen, 0, 0, x-1, y-1, defaultStyle, "There should be worms here!")
|
|
|
|
|
|
|
|
quit := func() {
|
|
quit := func() {
|
|
|
// You have to catch panics in a defer, clean up, and
|
|
// You have to catch panics in a defer, clean up, and
|
|
@@ -97,7 +97,7 @@ func main() {
|
|
|
switch ev := ev.(type) {
|
|
switch ev := ev.(type) {
|
|
|
case *tcell.EventResize:
|
|
case *tcell.EventResize:
|
|
|
x, y := screen.Size()
|
|
x, y := screen.Size()
|
|
|
- drawBox(screen, 0, 0, x-1, y-1, defStyle, "There should be worms here!")
|
|
|
|
|
|
|
+ drawBox(screen, 0, 0, x-1, y-1, defaultStyle, "There should be worms here!")
|
|
|
screen.Sync()
|
|
screen.Sync()
|
|
|
case *tcell.EventKey:
|
|
case *tcell.EventKey:
|
|
|
//fmt.Println("Key: ",ev.Rune())
|
|
//fmt.Println("Key: ",ev.Rune())
|