func (sq *Square) Draw(screen *tl.Screen) { if sq.visible { x, y := sq.getPosition() for i := 0; i < 5; i++ { screen.RenderCell(x+i, y, &sq.canvas[i]) } } }
// Draw draws the Dialog to the Screen s. func (d *Dialog) Draw(s *termloop.Screen) { width, height := d.Size() // Render shadow for x := 1; x < width; x++ { s.RenderCell(d.x+x, d.y+height, &termloop.Cell{Ch: '▒', Fg: d.fg, Bg: termloop.ColorDefault}) } for y := 1; y < height; y++ { s.RenderCell(d.x+width, d.y+y, &termloop.Cell{Ch: '▒', Fg: d.fg, Bg: termloop.ColorDefault}) } s.RenderCell(d.x+width, d.y+height, &termloop.Cell{Ch: '▒', Fg: d.fg, Bg: termloop.ColorDefault}) // Render content for x := 0; x < height; x++ { for y := 0; y < width; y++ { s.RenderCell(d.x+y, d.y+x, &d.canvas[x][y]) } } }
func (w *word) Draw(s *tl.Screen) { for i, ch := range w.str { if w.startedBy == 0 { s.RenderCell(w.x+i, w.y, &tl.Cell{Fg: w.fgTodo, Bg: tl.ColorDefault, Ch: ch}) } else { var bg tl.Attr if w.startedBy == pc { bg = w.bgPlayer } else { bg = w.bgGoroutine } if i < w.completedChars { s.RenderCell(w.x+i, w.y, &tl.Cell{Fg: w.fgComplete, Bg: bg, Ch: ch}) } else { s.RenderCell(w.x+i, w.y, &tl.Cell{Fg: w.fgTodo, Bg: bg, Ch: ch}) } } } }