Checkpoint

This commit is contained in:
maze authored and maze committed 2026-10-29 17:29:41 +01:00
1 parent 85a9ec684c
commit c5d6137fab
160 files changed
+76293 -387

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
package draw
import (
"image/color"
"image/draw"
"math"
)
func Progress(dst Image, c color.Color, x, y, w int, progress float64) {
Rectangle(dst, c, x, y, w, 8)
if fill := int(math.Round(float64(w) * progress)); fill > 0 {
FilledRectangle(dst, c, x+1, y+1, fill, 6)
}
}
func Sprite(dst draw.Image, c color.Color, x, y int, sprite []uint8) {
w, h, data := sprite[0], sprite[1], sprite[2:]
for dy := 0; dy < int(h); dy++ {
for dx := 0; dx < int(w); dx++ {
byteOffset := int(dy/8)*int(w) + dx
bitOffset := dy % 8
if data[byteOffset]&(1<<bitOffset) != 0 {
dst.Set(x+dx, y+dy, c)
}
}
}
}