Files
inkwell/ui.hotspot_debug.go
T
mr.zeroandClaude Opus 5 92fc36bdf5
ci/woodpecker/push/woodpecker Pipeline was successful
Nine things a domain kept having to invent
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>
2026-08-30 22:57:16 +02:00

50 lines
1.2 KiB
Go

package inkwell
import (
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/inpututil"
"github.com/hajimehoshi/ebiten/v2/vector"
)
// HotspotDebug overlays a colored outline on every hotspot of the current
// scene. F1 toggles it at runtime; the default is off.
type HotspotDebug struct {
Name string
When Condition
Enabled bool
// ToggleKey, if non-zero, overrides the default F1 toggle.
ToggleKey ebiten.Key
}
func (h *HotspotDebug) GetName() string { return h.Name }
func (h *HotspotDebug) VisibleWhen() Condition { return h.When }
func (h *HotspotDebug) Layer() Layer { return LayerScene }
func (h *HotspotDebug) Tick(ctx *UICtx) {
key := h.ToggleKey
if key == 0 {
key = ebiten.KeyF1
}
if inpututil.IsKeyJustPressed(key) {
h.Enabled = !h.Enabled
}
}
func (h *HotspotDebug) Draw(dst *ebiten.Image, ctx *UICtx) {
if !h.Enabled {
return
}
g := ctx.Game
if g.currentScene == "" {
return
}
col := g.Theme().HotspotOutline
for _, hs := range g.SceneHotspots(g.currentScene) {
b := hs.Area.Bounds()
vector.StrokeRect(dst, float32(b.X), float32(b.Y), float32(b.W), float32(b.H), 1, col, false)
if hs.Label != "" {
g.DrawText(dst, hs.Label, int(b.X)+1, int(b.Y)+1, col)
}
}
}