more refact

This commit is contained in:
2026-08-30 23:01:48 +02:00
parent 3890edc946
commit 28b1662195
38 changed files with 353 additions and 663 deletions
+6 -37
View File
@@ -2,7 +2,6 @@ package inc
import (
inkwell "git.teletypegames.org/engines/inkwell"
"github.com/hajimehoshi/ebiten/v2"
)
type Widget = inkwell.Widget
@@ -11,7 +10,7 @@ const (
ScreenW = 640
ScreenH = 380
LineH = glyphH + 2
LineH = inkwell.GlyphH + 2
Pad = 6
TopBarH = LineH + 2
@@ -28,38 +27,8 @@ const (
invGap = 4
)
type gate struct {
Name string
Inner Widget
}
func gated(name string, inner Widget) Widget {
return &gate{
Name: name,
Inner: inner,
}
}
func (n *gate) GetName() string { return n.Name }
func (n *gate) Layer() inkwell.Layer { return inkwell.LayerOf(n.Inner) }
func (n *gate) Tick(ctx *inkwell.UICtx) {
if World.HUDVisible() {
n.Inner.Tick(ctx)
}
}
func (n *gate) Draw(dst *ebiten.Image, ctx *inkwell.UICtx) {
if World.HUDVisible() {
n.Inner.Draw(dst, ctx)
}
}
func (n *gate) BlocksClickAt(p inkwell.Point) bool {
if !World.HUDVisible() {
return false
}
b, ok := n.Inner.(interface{ BlocksClickAt(inkwell.Point) bool })
return ok && b.BlocksClickAt(p)
}
var (
whenPlaying = inkwell.VarEq(VarMode, string(ModePlay))
whenCutscene = inkwell.VarEq(VarMode, string(ModeCutscene))
whenUnpaused = inkwell.And(whenPlaying, inkwell.Not(inkwell.VarEq(VarNote, NotePaused)))
)