Checkpoint

This commit is contained in:
maze authored and maze committed 2026-10-29 17:29:41 +01:00
1 parent b8a493b93d
commit 85a9ec684c
54 files changed
+6855 -526

No files matched your search

+20 -20
View File
@@ -1,47 +1,47 @@
package visual
import (
"image"
"math/rand"
"time"
"go.maze.io/harmon/hardware"
"go.maze.io/harmon/hardware/display"
"go.maze.io/harmon/internal/pixel"
)
type Offline struct {
since time.Time
l, r, c hardware.Display
x, y int
w, h int
dx, dy bool
}
func NewOffline(left, right, center hardware.Display) *Offline {
size := left.Size()
return &Offline{
since: time.Now(),
l: left,
r: right,
c: center,
w: size.X - 3,
h: size.Y - 3,
x: rand.Int() % (size.X - 3),
y: rand.Int() % (size.Y - 3),
}
}
func (v *Offline) Render() error {
i := pixel.NewVerticalLSB(v.l.Bounds())
display.DrawText(i, 0, 32, "Offline!")
// Left shows text
v.l.Clear()
display.DrawText(v.l, 1, 1, display.Font8x16, "Player offline!")
display.DrawText(v.l, 1, 3, display.Font7x13, "retrying...")
v.l.Refresh()
// Right shows time + date
v.r.Clear()
display.DrawText(v.r, 1, 1, display.Font8x16, time.Now().Format("01-02-06"))
display.DrawText(v.r, 1, 3, display.Font8x16, time.Now().Format("15:04:05"))
v.r.Refresh()
if err := v.l.Draw(i.Rect, i, image.Point{}); err != nil {
return err
}
if err := v.r.Draw(i.Rect, i, image.Point{}); err != nil {
return err
}
//v.render(v.c)
return nil
}
func (v *Offline) render(d hardware.Display) {
if d == nil {
return
}
display.DrawText(d, 0, 32, "Offline!")
d.Refresh()
}