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>
This commit is contained in:
+18
-4
@@ -25,6 +25,7 @@ func (e *engine) Update() error {
|
||||
|
||||
g.Input.poll()
|
||||
g.transition.update(dt)
|
||||
g.pumpQueue()
|
||||
|
||||
if g.transition.active && g.transition.out {
|
||||
return nil
|
||||
@@ -58,10 +59,14 @@ func (e *engine) Update() error {
|
||||
// race a cutscene that's about to start.
|
||||
g.tickTriggers()
|
||||
|
||||
// Top-down input: the widget drawn last (= registered last) gets the
|
||||
// click first, then the next-to-last, etc. A widget signals "I took it"
|
||||
// Top-down input: the widget on the highest layer gets the click
|
||||
// first, then the one below it, etc. A widget signals "I took it"
|
||||
// via g.Input.ConsumeLeft / ConsumeRight.
|
||||
cctx := g.makeCtx()
|
||||
for _, w := range reversedWidgets(g.WidgetManager) {
|
||||
if !WidgetVisible(cctx, w) {
|
||||
continue
|
||||
}
|
||||
w.Tick(uictx)
|
||||
}
|
||||
|
||||
@@ -135,7 +140,12 @@ func (g *Game) invokeHotspotVerb(h *Hotspot, verb string) {
|
||||
return
|
||||
}
|
||||
}
|
||||
g.FlashLine("Nem ehhez.")
|
||||
if g.UseWithFail != nil {
|
||||
g.LogAction("> " + verbLabel(g, "use") + " " + sel + " ezen: " + targetLabel)
|
||||
g.queueAction(g.UseWithFail(sel, h), "useWith fail")
|
||||
} else {
|
||||
g.FlashLine("Nem ehhez.")
|
||||
}
|
||||
g.Inventory.Select("")
|
||||
return
|
||||
}
|
||||
@@ -190,9 +200,13 @@ func (e *engine) Draw(screen *ebiten.Image) {
|
||||
drawCharacter(screen, g, c)
|
||||
}
|
||||
|
||||
// widgets in registration order
|
||||
// widgets from the bottom layer up
|
||||
uictx := &UICtx{Game: g, DT: 1.0 / 60.0}
|
||||
cctx := g.makeCtx()
|
||||
for _, w := range orderedWidgets(g.WidgetManager) {
|
||||
if !WidgetVisible(cctx, w) {
|
||||
continue
|
||||
}
|
||||
w.Draw(screen, uictx)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user