Add game components 246-268; data.DrawSlot, Canvas.TextVeil
Health, mana and experience bars, quarter hearts, lives, a spinning coin counter, score board, stage timer, minimap with fog, compass, hotbar, paper-doll equipment, skill tree, skill buttons with cooldown wipes, status effects, a boss bar, damage numbers, quest log and tracker, party frames, character sheet, level-up screen and shop. data exports DrawSlot so every slot looks alike; pixel adds TextVeil for dissolving text. Messages the font cannot draw are fixed and TestMessagesHaveGlyphs holds every message to the font.
This commit is contained in:
42 files changed
+3260
-26
No files matched your search
@@ -40,3 +40,21 @@ func checkLevel(level int) {
|
||||
panic(fmt.Sprintf("pixel: dither level %d outside 0–16", level))
|
||||
}
|
||||
}
|
||||
|
||||
// TextVeil draws s, keeping glyph dots below the dither level.
|
||||
func (g Canvas) TextVeil(x, y int, s string, ink Slot, level, scale int) {
|
||||
checkLevel(level)
|
||||
checkScale(scale)
|
||||
for _, r := range s {
|
||||
gl := glyphOf(r)
|
||||
gx := x + gl.x*scale
|
||||
for j := range gl.h * scale {
|
||||
yy := y + gl.top()*scale + j
|
||||
row := bayer[(g.gy+yy)&3]
|
||||
runs(gl.w*scale, func(i int) bool {
|
||||
return gl.on(i/scale, j/scale) && row[(g.gx+gx+i)&3] < level
|
||||
}, func(a, b int) { g.Rect(gx+a, yy, b-a, 1, ink) })
|
||||
}
|
||||
x += gl.adv * scale
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user