26 lines
874 B
Go
26 lines
874 B
Go
package display
|
|
|
|
// FallbackTemplate is the no-video kiosk layout: a cleared black canvas with
|
|
// the fallback lines. While decoded video is present the fallback
|
|
// disappears: the canvas stays plain black so the video window keeps
|
|
// rendering priority without stale text around or behind it, and the exact
|
|
// fallback lines return when video ends.
|
|
type FallbackTemplate struct {
|
|
fallback StatusTemplate
|
|
video *VideoPresence
|
|
}
|
|
|
|
// NewFallbackTemplate builds a template that draws the given fallback lines
|
|
// only while the shared presence reports no video.
|
|
func NewFallbackTemplate(video *VideoPresence, lines ...string) FallbackTemplate {
|
|
return FallbackTemplate{fallback: NewStatusTemplate(lines...), video: video}
|
|
}
|
|
|
|
func (t FallbackTemplate) Draw(canvas Canvas) {
|
|
canvas.Clear()
|
|
if !t.video.Active() {
|
|
drawLines(canvas, t.fallback.lines)
|
|
}
|
|
canvas.Flush()
|
|
}
|