One component per file; GAME OVER offers CONTINUE

PRD G1 asks for one component per file. Eight files held two or
three; their eleven extra components move to files of their own,
helpers stay where both sides use them, and an archtest now fails
any file that holds two.

PRD 4.4 and the request say an error always offers CONTINUE.
ErrorState's button read RETRY; it now reads CONTINUE, under the
CONTINUE? countdown, on the crash screen and the lost page alike.
This commit is contained in:
ZacharyZhang-NY committed 2026-10-12 16:50:17 -04:00
1 parent edee517e8d
commit 1f3d38110e
25 files changed
+439 -359

No files matched your search

-37
View File
@@ -110,40 +110,3 @@ func Face(g pixel.Canvas, x, y int, name string, sc int) {
g.Sprite(x, y+8*sc, eyes[pick(len(eyes))], 0, pixel.Ink, sc)
g.Sprite(x, y+11*sc, mouths[pick(len(mouths))], 0, pixel.Ink, sc)
}
type AvatarGroupOptions struct {
// Max faces shown before +N; zero means 4.
Max int
Scale int
}
// AvatarGroup overlaps faces and counts the rest in a chip.
func AvatarGroup(c *ui.Context, names []string, o AvatarGroupOptions) *ui.Element {
k, sc := pixel.K(c), scale(o.Scale)
shown := names[:min(len(names), pixel.Or("AvatarGroup Max", o.Max, 4))]
rest := len(names) - len(shown)
more := ""
if rest > 0 {
more = "+" + itoa(rest)
}
step := 12 * sc
w := max(0, len(shown)-1)*step + 16*sc
if more != "" {
w += pixel.MicroWidth(more) + 8
}
return art(c, k, strings.Join(names, ", "), w, 16*sc, func(g pixel.Canvas) {
for i, name := range shown {
x := i * step
Face(g, x, 0, name, sc)
if i > 0 {
g.VLine(x, 0, 16*sc, pixel.Back)
}
}
if more != "" {
x := len(shown)*step + 4*sc
cw := pixel.MicroWidth(more) + 4
g.Frame(x, (16*sc-9)/2, cw, 9, pixel.Notched, pixel.Face)
g.Micro(x+2, (16*sc-9)/2+2, more, pixel.Ink, 1)
}
})
}
+46
View File
@@ -0,0 +1,46 @@
package display
import (
"strings"
"github.com/egoist/mygo/ui"
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/pixel"
)
type AvatarGroupOptions struct {
// Max faces shown before +N; zero means 4.
Max int
Scale int
}
// AvatarGroup overlaps faces and counts the rest in a chip.
func AvatarGroup(c *ui.Context, names []string, o AvatarGroupOptions) *ui.Element {
k, sc := pixel.K(c), scale(o.Scale)
shown := names[:min(len(names), pixel.Or("AvatarGroup Max", o.Max, 4))]
rest := len(names) - len(shown)
more := ""
if rest > 0 {
more = "+" + itoa(rest)
}
step := 12 * sc
w := max(0, len(shown)-1)*step + 16*sc
if more != "" {
w += pixel.MicroWidth(more) + 8
}
return art(c, k, strings.Join(names, ", "), w, 16*sc, func(g pixel.Canvas) {
for i, name := range shown {
x := i * step
Face(g, x, 0, name, sc)
if i > 0 {
g.VLine(x, 0, 16*sc, pixel.Back)
}
}
if more != "" {
x := len(shown)*step + 4*sc
cw := pixel.MicroWidth(more) + 4
g.Frame(x, (16*sc-9)/2, cw, 9, pixel.Notched, pixel.Face)
g.Micro(x+2, (16*sc-9)/2+2, more, pixel.Ink, 1)
}
})
}