widget manager refact

This commit is contained in:
2026-08-30 22:27:51 +02:00
parent 258cbf85c0
commit 3890edc946
26 changed files with 413 additions and 242 deletions
+37
View File
@@ -0,0 +1,37 @@
package inc
import (
inkwell "git.teletypegames.org/engines/inkwell"
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/vector"
)
func init() {
WidgetManager.Register(&hudFrame{
Name: "hudframe",
})
}
type hudFrame struct {
Name string
}
func (h *hudFrame) GetName() string { return h.Name }
func (h *hudFrame) Layer() inkwell.Layer { return inkwell.LayerPanel }
func (h *hudFrame) Tick(ctx *inkwell.UICtx) {}
func (h *hudFrame) Draw(dst *ebiten.Image, ctx *inkwell.UICtx) {
if !World.HUDVisible() {
return
}
th := ctx.Game.Theme()
vector.DrawFilledRect(dst, 0, HUDTop+1, ScreenW, ScreenH-HUDTop-1, th.PanelBG, false)
vector.StrokeLine(dst, 0, HUDTop, ScreenW, HUDTop, 1, th.CharacterPanelBorder, false)
vector.StrokeLine(dst, DividerX, HUDTop+1, DividerX, ScreenH, 1, th.CharacterPanelBorder, false)
}
func (h *hudFrame) BlocksClickAt(p inkwell.Point) bool {
return World.HUDVisible() && p.Y >= HUDTop
}