本文整理匯總了Golang中github.com/JoelOtter/termloop.Screen.RenderCell方法的典型用法代碼示例。如果您正苦於以下問題:Golang Screen.RenderCell方法的具體用法?Golang Screen.RenderCell怎麽用?Golang Screen.RenderCell使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/JoelOtter/termloop.Screen
的用法示例。
在下文中一共展示了Screen.RenderCell方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Draw
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])
}
}
}
示例2: Draw
// 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])
}
}
}
示例3: Draw
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})
}
}
}
}