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:
47 files changed
+3379
-17
No files matched your search
+3
-2
@@ -18,7 +18,8 @@ const (
|
||||
Legendary
|
||||
)
|
||||
|
||||
func (r Rarity) slot() pixel.Slot {
|
||||
// Slot is the rarity's color.
|
||||
func (r Rarity) Slot() pixel.Slot {
|
||||
if r > Legendary {
|
||||
panic(fmt.Sprintf("display: unknown Rarity %d", r))
|
||||
}
|
||||
@@ -64,7 +65,7 @@ type GemOptions struct {
|
||||
// Gem is a cut gem by rarity, sparkling in steps.
|
||||
func Gem(c *ui.Context, r Rarity, o GemOptions) *ui.Element {
|
||||
k, sc := pixel.K(c), scale(o.Scale)
|
||||
ink := r.slot()
|
||||
ink := r.Slot()
|
||||
return art(c, k, r.name(k), (gem.W+3)*sc, (gem.H+2)*sc, func(g pixel.Canvas) {
|
||||
g.Sprite(0, 2*sc, gem, 0, ink, sc)
|
||||
if f := g.Step(4) % 4; f < 2 {
|
||||
|
||||
@@ -86,5 +86,5 @@ func TestExtremesAndNames(t *testing.T) {
|
||||
t.Fatal("unknown rarity did not panic")
|
||||
}
|
||||
}()
|
||||
Rarity(9).slot()
|
||||
Rarity(9).Slot()
|
||||
}
|
||||
@@ -14,7 +14,7 @@ type RarityFrameOptions struct {
|
||||
// RarityFrame borders children by rarity; legendary carries a glint.
|
||||
func RarityFrame(c *ui.Context, r Rarity, o RarityFrameOptions, children func()) *ui.Element {
|
||||
k := pixel.K(c)
|
||||
ink := r.slot()
|
||||
ink := r.Slot()
|
||||
pad := 3 + pixel.Or("RarityFrame Padding", o.Padding, 4)
|
||||
return ui.Column(c).Padding(k.D(pad)).Role(ui.RoleGroup).Label(r.name(k)).Draw(func(p *ui.Painter, r2 ui.Rect) {
|
||||
g := k.Canvas(p, r2)
|
||||
|
||||
Reference in new issue
Block a user