2018-02-28 03:17:26 +01:00
|
|
|
package ui
|
|
|
|
|
|
|
|
import (
|
2020-11-30 23:07:03 +01:00
|
|
|
"github.com/gdamore/tcell/v2"
|
2018-02-28 03:17:26 +01:00
|
|
|
)
|
|
|
|
|
2021-10-26 22:42:07 +02:00
|
|
|
type Fill struct {
|
|
|
|
Rune rune
|
|
|
|
Style tcell.Style
|
|
|
|
}
|
2018-02-28 03:17:26 +01:00
|
|
|
|
2021-10-26 22:42:07 +02:00
|
|
|
func NewFill(f rune, s tcell.Style) Fill {
|
|
|
|
return Fill{f, s}
|
2018-02-28 03:17:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func (f Fill) Draw(ctx *Context) {
|
|
|
|
for x := 0; x < ctx.Width(); x += 1 {
|
|
|
|
for y := 0; y < ctx.Height(); y += 1 {
|
2021-10-26 22:42:07 +02:00
|
|
|
ctx.SetCell(x, y, f.Rune, f.Style)
|
2018-02-28 03:17:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f Fill) OnInvalidate(callback func(d Drawable)) {
|
|
|
|
// no-op
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f Fill) Invalidate() {
|
|
|
|
// no-op
|
|
|
|
}
|