ci/woodpecker/push/woodpecker Pipeline was successful
UIManager named the category, not the contents. Every other manager is named after what it registers — ItemManager holds Items, SceneManager holds Scenes — so the one that registers Widgets is the WidgetManager. The alias, the Game field and both manual pages move together. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
20 lines
620 B
Go
20 lines
620 B
Go
package inkwell
|
|
|
|
// WidgetManager registers Widget instances. Same shape as every other manager.
|
|
type WidgetManager = Manager[Widget]
|
|
|
|
// reversedWidgets iterates a manager's contents in reverse registration
|
|
// order — used by the engine for top-down input dispatch (the widget
|
|
// drawn on top gets the click first).
|
|
func reversedWidgets(m *WidgetManager) []Widget {
|
|
all := m.All()
|
|
out := make([]Widget, len(all))
|
|
for i, w := range all {
|
|
out[len(all)-1-i] = w
|
|
}
|
|
return out
|
|
}
|
|
|
|
// orderedWidgets iterates in registration order — bottom-up draw.
|
|
func orderedWidgets(m *WidgetManager) []Widget { return m.All() }
|