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:
+6
-4
@@ -12,6 +12,7 @@ import (
|
||||
// messages scroll up out of view as the buffer fills.
|
||||
type ChatLog struct {
|
||||
Name string
|
||||
When Condition
|
||||
Bounds Rectangle
|
||||
LineHeight int
|
||||
Padding int
|
||||
@@ -19,9 +20,10 @@ type ChatLog struct {
|
||||
ShowBorder bool
|
||||
}
|
||||
|
||||
func (c *ChatLog) GetName() string { return c.Name }
|
||||
func (c *ChatLog) Layer() Layer { return LayerHUD }
|
||||
func (c *ChatLog) Tick(ctx *UICtx) {}
|
||||
func (c *ChatLog) GetName() string { return c.Name }
|
||||
func (c *ChatLog) VisibleWhen() Condition { return c.When }
|
||||
func (c *ChatLog) Layer() Layer { return LayerHUD }
|
||||
func (c *ChatLog) Tick(ctx *UICtx) {}
|
||||
|
||||
func (c *ChatLog) Draw(dst *ebiten.Image, ctx *UICtx) {
|
||||
g := ctx.Game
|
||||
@@ -71,7 +73,7 @@ func (c *ChatLog) Draw(dst *ebiten.Image, ctx *UICtx) {
|
||||
if m.Kind == LogResponse && m.Speaker != "" {
|
||||
txt = m.Speaker + ": " + m.Text
|
||||
}
|
||||
for _, w := range wrapText(txt, wrapW) {
|
||||
for _, w := range WrapText(txt, wrapW) {
|
||||
rendered = append(rendered, line{text: w, col: col})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user