Update examples to use new API

This commit is contained in:
2024-05-27 16:01:50 -04:00
parent a52a703ec1
commit 1142cb7ab6
4 changed files with 327 additions and 154 deletions

View File

@@ -9,7 +9,6 @@ import "image/color"
import "git.tebibyte.media/tomo/tomo"
import "git.tebibyte.media/tomo/nasin"
import "git.tebibyte.media/tomo/objects"
import "git.tebibyte.media/tomo/tomo/theme"
import "git.tebibyte.media/tomo/tomo/canvas"
import "git.tebibyte.media/tomo/objects/layouts"
@@ -46,7 +45,7 @@ func (this *Application) Init () error {
} ()
window.OnClose(tomo.Stop)
window.Show()
window.SetVisible(true)
return nil
}
@@ -69,7 +68,7 @@ func NewClockFace () *ClockFace {
box := &ClockFace {
CanvasBox: tomo.NewCanvasBox(),
}
theme.Apply(box, theme.R("nasin", "ClockFace", ""))
tomo.Apply(box, tomo.R("nasin", "ClockFace", ""))
box.SetDrawer(box)
return box
}
@@ -89,7 +88,7 @@ func (this *ClockFace) Draw (destination canvas.Canvas) {
for hour := 0; hour < 12; hour ++ {
radialLine (
destination,
theme.ColorForeground,
tomo.ColorForeground,
0.8, 0.9, float64(hour) / 6 * math.Pi)
}
@@ -97,9 +96,9 @@ func (this *ClockFace) Draw (destination canvas.Canvas) {
minute := float64(this.time.Minute()) + second / 60
hour := float64(this.time.Hour()) + minute / 60
radialLine(destination, theme.ColorForeground, 0, 0.5, (hour - 3) / 6 * math.Pi)
radialLine(destination, theme.ColorForeground, 0, 0.7, (minute - 15) / 30 * math.Pi)
radialLine(destination, theme.ColorAccent, 0, 0.7, (second - 15) / 30 * math.Pi)
radialLine(destination, tomo.ColorForeground, 0, 0.5, (hour - 3) / 6 * math.Pi)
radialLine(destination, tomo.ColorForeground, 0, 0.7, (minute - 15) / 30 * math.Pi)
radialLine(destination, tomo.ColorAccent, 0, 0.7, (second - 15) / 30 * math.Pi)
}
func radialLine (