Add game components 269-290; CommandMenu AutoFocus

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.
This commit is contained in:
ZacharyZhang-NY committed 2026-10-12 02:48:20 -04:00
1 parent f48075230f
commit 86a6901333
38 files changed
+2663 -8

No files matched your search

+7 -1
View File
@@ -9,7 +9,9 @@ import (
)
type CommandMenuOptions struct {
Disabled bool
// AutoFocus takes the focus when the menu appears.
AutoFocus bool
Disabled bool
}
type CommandMenuResult struct {
@@ -27,6 +29,10 @@ func CommandMenu(c *ui.Context, text string, items []MenuItem, o CommandMenuOpti
shell, base, st := pixel.Shell(c, func() *ui.Element {
return ui.Box(c).Focusable().Role(ui.RoleList).Label(text).Disabled(o.Disabled)
})
// An off menu never takes the focus.
if o.AutoFocus && !base.IsDisabled() {
base.AutoFocus()
}
cur := ui.Local(base, cursorKey{}, func() int { return 0 })
res := CommandMenuResult{Element: shell, Chosen: -1}
n := len(items)