Add data components 151-175; clear MyGo row highlights

Lists, tables, trees, grids, inventories and records in data/.
Outline and GridView build on ui.List: ui.Outline strokes its arrows
and ui.GridView spaces and tints items. The pixel theme keeps MyGo's
row highlights clear so scrolled rows stay on whole dots; off lists
take a veil against the wheel. Adds Canvas.Silhouette, SwitchOptions
Label and exports Rarity.Slot.
This commit is contained in:
ZacharyZhang-NY committed 2026-10-11 22:29:07 -04:00
1 parent f587d25a5a
commit 03680980da
47 files changed
+3379 -17

No files matched your search

+8
View File
@@ -19,6 +19,14 @@ func TestSpriteLettersMatchSlots(t *testing.T) {
}
}
func TestSilhouetteKeepsShapeInOneSlot(t *testing.T) {
sp := pixel.MustSprite("#a.g")
d := canvas(t, 8, 2, func(g pixel.Canvas) { g.Silhouette(0, 0, sp, 0, pixel.Shade, 2) })
if d.count(0, 0, 4, 2, pixel.Shade) != 8 || d.count(4, 0, 2, 2, pixel.Back) != 4 || d.count(6, 0, 2, 2, pixel.Shade) != 4 {
t.Fatal("Silhouette must fill the shape, scaled, in one slot")
}
}
func TestSpriteFramesMirrorScale(t *testing.T) {
sp := pixel.MustSprite(`
#a.
+4
View File
@@ -16,6 +16,8 @@ var messages = map[Locale]map[string]string{
"retry": "RETRY", "stage_clear": "STAGE CLEAR!", "level_up": "LEVEL UP!", "achievement": "ACHIEVEMENT UNLOCKED",
"combo": "COMBO!", "saving": "SAVING", "saved": "SAVED", "go": "GO!", "wait": "PLEASE WAIT",
"prev": "PREVIOUS", "next": "NEXT", "back": "BACK", "forward": "FORWARD", "history": "HISTORY",
"on": "ON", "off": "OFF", "clear": "CLEAR", "per_page": "PER PAGE", "range": "%d–%d OF %d", "found": "FOUND: %d",
"unknown": "???",
},
Zh: {
"ok": "确定", "cancel": "取消", "yes": "是", "no": "否", "close": "关闭",
@@ -30,6 +32,8 @@ var messages = map[Locale]map[string]string{
"retry": "重试", "stage_clear": "过关!", "level_up": "升级!", "achievement": "成就解锁",
"combo": "连击!", "saving": "存档中", "saved": "已存档", "go": "开始!", "wait": "请稍候",
"prev": "上一页", "next": "下一页", "back": "后退", "forward": "前进", "history": "历史",
"on": "开", "off": "关", "clear": "清除", "per_page": "每页", "range": "%d–%d / 共 %d", "found": "找到:%d",
"unknown": "???",
},
}
+3 -3
View File
@@ -121,14 +121,14 @@ func (s Settings) valid() Settings {
return s
}
// theme keeps MyGo's own drawing inside the palette.
// theme keeps MyGo's drawing in the palette; row highlights clear.
func theme(p *Palette) *ui.Theme {
t := ui.LightTheme()
c := p.Colors
t.Dark = p.Night
t.Background, t.Surface, t.SurfaceHover, t.SurfacePressed = c[Back], c[Face], c[Lit], c[Shade]
t.Background, t.Surface, t.SurfaceHover, t.SurfacePressed = c[Back], c[Face], ui.Transparent, c[Shade]
t.Border, t.Text, t.TextMuted = c[Edge], c[Ink], c[Faint]
t.Accent, t.AccentHover, t.AccentPressed, t.AccentText = c[Accent], c[AccentLit], c[Accent], c[AccentInk]
t.Accent, t.AccentHover, t.AccentPressed, t.AccentText = ui.Transparent, c[AccentLit], c[Accent], c[AccentInk]
t.Danger, t.Warning, t.Success = c[Bad], c[Warn], c[Good]
t.Selection, t.Focus, t.Scrollbar, t.Radius = c[AccentLit], c[Accent], ui.Transparent, 0
return t
+2 -2
View File
@@ -52,12 +52,12 @@ func TestUseBridgesTheme(t *testing.T) {
}{
{"Background", th.Background, p.C(pixel.Back)},
{"Surface", th.Surface, p.C(pixel.Face)},
{"SurfaceHover", th.SurfaceHover, p.C(pixel.Lit)},
{"SurfaceHover", th.SurfaceHover, ui.Transparent},
{"SurfacePressed", th.SurfacePressed, p.C(pixel.Shade)},
{"Border", th.Border, p.C(pixel.Edge)},
{"Text", th.Text, p.C(pixel.Ink)},
{"TextMuted", th.TextMuted, p.C(pixel.Faint)},
{"Accent", th.Accent, p.C(pixel.Accent)},
{"Accent", th.Accent, ui.Transparent},
{"AccentHover", th.AccentHover, p.C(pixel.AccentLit)},
{"AccentPressed", th.AccentPressed, p.C(pixel.Accent)},
{"AccentText", th.AccentText, p.C(pixel.AccentInk)},
+10 -1
View File
@@ -88,6 +88,15 @@ func (s *Sprite) Mirror() *Sprite {
// Sprite draws frame of sp; # takes ink; frames wrap.
func (g Canvas) Sprite(x, y int, sp *Sprite, frame int, ink Slot, scale int) {
g.sprite(x, y, sp, frame, ink, scale, false)
}
// Silhouette draws sp's shape all in one slot.
func (g Canvas) Silhouette(x, y int, sp *Sprite, frame int, s Slot, scale int) {
g.sprite(x, y, sp, frame, s, scale, true)
}
func (g Canvas) sprite(x, y int, sp *Sprite, frame int, ink Slot, scale int, mono bool) {
checkScale(scale)
n := len(sp.frames)
px := sp.frames[(frame%n+n)%n]
@@ -101,7 +110,7 @@ func (g Canvas) Sprite(x, y int, sp *Sprite, frame int, ink Slot, scale int) {
}
if v != cellClear {
s := ink
if v >= 0 {
if v >= 0 && !mono {
s = Slot(v)
}
g.Rect(x+col*scale, y+row*scale, (end-col)*scale, scale, s)