tins2020/dialdigit.go

35 lines
592 B
Go

package tins2020
import (
"opslag.de/schobers/geom"
"opslag.de/schobers/zntg"
"opslag.de/schobers/zntg/ui"
)
type DialDigit struct {
ui.ControlBase
Value string
highlight int
}
func (d *DialDigit) Blink() {
d.highlight = 4
}
func (d *DialDigit) Render(ctx ui.Context) {
color := zntg.MustHexColor(`#FFFFFF`)
if d.highlight > 0 {
color = zntg.MustHexColor(`#15569F`)
}
bounds := d.Bounds()
ctx.Fonts().TextAlign("title", geom.PtF32(bounds.Center().X, bounds.Min.Y), color, d.Value, ui.AlignCenter)
}
func (d *DialDigit) Tick() {
if d.highlight > 0 {
d.highlight--
}
}