ci/woodpecker/push/woodpecker Pipeline was successful
Every change here started life as a workaround in a game and is really the same finding: a fact about an entity had nowhere to live, so the domain built machinery around the gap. Character.Label / Character.Voice — a tape is a character that speaks into the log, not a second spelling of Say. VoiceOf and CharacterLabel read them; Say obeys them. Game.Do — a real action queue, in order, so a widget can start an action. queueAction no longer drops what arrives while the runner is busy; it queues it. Widget.When + Gated + WidgetVisible — a widget declares when it is on screen. Nothing ticks, draws or blocks a click while its condition is false, so a HUD is hidden for a cutscene without a wrapper per widget. TopBar.NoteVar — the title was already discovered; the note beside it no longer needs a domain widget to push it in. Game.UseWithFail — the pair nobody authored is content, and belongs to the domain, exactly like ExitLook and ExitTake. Game.Player / Game.Walkboxes — a scene that names no cast and no floor means "the usual", instead of a defaults pass rewriting every scene. Game.WindowScale — Run's 4× is now a default, not a decision. SceneNav — the dev widget every game was writing. Colour text: DrawText paints in the colour it is handed, and GlyphW/H, TextWidth, WrapText and ClipText are the library's, not each game's. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package inkwell
|
|
|
|
import (
|
|
"github.com/hajimehoshi/ebiten/v2"
|
|
"github.com/hajimehoshi/ebiten/v2/vector"
|
|
)
|
|
|
|
// EndCard is a fullscreen overlay shown when the ShowEnd action fires.
|
|
// While active it consumes every input so nothing underneath reacts.
|
|
type EndCard struct {
|
|
Name string
|
|
When Condition
|
|
}
|
|
|
|
func (e *EndCard) GetName() string { return e.Name }
|
|
func (e *EndCard) VisibleWhen() Condition { return e.When }
|
|
func (e *EndCard) Layer() Layer { return LayerCurtain }
|
|
|
|
func (e *EndCard) Tick(ctx *UICtx) {
|
|
if ctx.Game.endCard == "" {
|
|
return
|
|
}
|
|
// swallow every click while the end card is up
|
|
if ctx.Game.Input.LeftClicked() {
|
|
ctx.Game.Input.ConsumeLeft()
|
|
}
|
|
if ctx.Game.Input.RightClicked() {
|
|
ctx.Game.Input.ConsumeRight()
|
|
}
|
|
}
|
|
|
|
func (e *EndCard) Draw(dst *ebiten.Image, ctx *UICtx) {
|
|
g := ctx.Game
|
|
if g.endCard == "" {
|
|
return
|
|
}
|
|
th := g.Theme()
|
|
vector.DrawFilledRect(dst, 0, 0, float32(g.Width), float32(g.Height), th.EndCardBG, false)
|
|
w := TextWidth(g.endCard)
|
|
g.DrawText(dst, g.endCard, (g.Width-w)/2, g.Height/2-8, th.EndCardText)
|
|
}
|