Press start, title screen, save slots, options menu, game over with CONTINUE, credits roll, ending card, loading tips, letterbox, mission brief, achievements, result screen, crafting grid, loot popup, treasure chest, gacha reel, interact prompt, turn order, battle log, target selector, ATB gauge and stamina bar. Cued effects count runs, so each cue change plays once and reports once. CommandMenu takes AutoFocus when enabled. HealthBar, ManaBar and CountUp keep exact colors, ticks and counts for the largest ints.
38 lines
1.0 KiB
Go
38 lines
1.0 KiB
Go
package game
|
||
|
||
import (
|
||
"fmt"
|
||
|
||
"github.com/egoist/mygo/ui"
|
||
|
||
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/pixel"
|
||
)
|
||
|
||
type EndingCardOptions struct {
|
||
// Width and Height are dots; zeros mean 200 by 80.
|
||
Width, Height int
|
||
// Cue fades it in again each time it changes.
|
||
Cue int
|
||
}
|
||
|
||
// EndingCard dithers THE END in, step by step.
|
||
func EndingCard(c *ui.Context, o EndingCardOptions) *ui.Element {
|
||
k := pixel.K(c)
|
||
w, h := pixel.Or("EndingCard Width", o.Width, 200), pixel.Or("EndingCard Height", o.Height, 80)
|
||
s := k.Msg("the_end")
|
||
if w < 3*pixel.Measure(s) || h < 3*pixel.LineHeight {
|
||
panic(fmt.Sprintf("game: EndingCard %d×%d is too small for %q", w, h, s))
|
||
}
|
||
e := ui.Box(c).Role(ui.RoleText).Label(s).Size(k.D(w), k.D(h))
|
||
level := 16
|
||
// It fades in over 2 s; reduced, at once.
|
||
if !k.Reduce() {
|
||
level = k.Since(c, start(k, e, o.Cue).at, 8, 16)
|
||
}
|
||
return e.Draw(func(p *ui.Painter, r ui.Rect) {
|
||
g := k.Canvas(p, r)
|
||
g.Rect(0, 0, w, h, pixel.Ink)
|
||
g.TextVeil((w-3*pixel.Measure(s))/2, (h-3*pixel.LineHeight)/2, s, pixel.Back, level, 3)
|
||
})
|
||
}
|