package main import ( "strconv" "github.com/gdamore/tcell/v2" ) /* func renderScreen(&screen tcell.Screen, event tcell.Event, score int) { if checkSize(*screen) == false { return } } */ func checkSize(screen tcell.Screen) bool { var retval bool = true x, y := screen.Size() if x < 80 { retval = false } if y < 24 { retval = false } return retval } func updateScore(screen tcell.Screen, style tcell.Style, score int) { var x, y int _, y = screen.Size() x = 5 for _, r := range []rune("[ Score: " + strconv.FormatInt(int64(score), 10) + " ]") { screen.SetContent(x, y-1, r, nil, style) x++ } } func drawBox(s tcell.Screen, x1, y1, x2, y2 int, style tcell.Style) { if y2 < y1 { y1, y2 = y2, y1 } if x2 < x1 { x1, x2 = x2, x1 } // Fill background for row := y1; row <= y2; row++ { for col := x1; col <= x2; col++ { s.SetContent(col, row, ' ', nil, style) } } // Draw borders for col := x1; col <= x2; col++ { s.SetContent(col, y1, '═', nil, style) s.SetContent(col, y2, '═', nil, style) } for row := y1 + 1; row < y2; row++ { s.SetContent(x1, row, '║', nil, style) s.SetContent(x2, row, '║', nil, style) } // Only draw corners if necessary if y1 != y2 && x1 != x2 { s.SetContent(x1, y1, '╔', nil, style) s.SetContent(x2, y1, '╗', nil, style) s.SetContent(x1, y2, '╚', nil, style) s.SetContent(x2, y2, '╝', nil, style) } //drawText(s, x1+1, y1+1, x2-1, y2-1, style, text) updateScore(s, style, 10) }