28 lines
657 B
Go
28 lines
657 B
Go
package display
|
|
|
|
// StatusTemplate is the fallback kiosk layout: a cleared black canvas with
|
|
// status lines. It is the "no pilot video" state of a display target.
|
|
type StatusTemplate struct {
|
|
lines []string
|
|
}
|
|
|
|
// NewStatusTemplate builds a template that draws the given status lines.
|
|
func NewStatusTemplate(lines ...string) StatusTemplate {
|
|
return StatusTemplate{lines: lines}
|
|
}
|
|
|
|
func (t StatusTemplate) Draw(canvas Canvas) {
|
|
canvas.Clear()
|
|
drawLines(canvas, t.lines)
|
|
canvas.Flush()
|
|
}
|
|
|
|
func drawLines(canvas Canvas, lines []string) {
|
|
_, height := canvas.Size()
|
|
y := height / 2
|
|
for _, line := range lines {
|
|
canvas.Text(32, y, line)
|
|
y += 32
|
|
}
|
|
}
|