Files
inkwell/core.dsl.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

59 lines
1.6 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package inkwell
import (
"github.com/hajimehoshi/ebiten/v2"
)
// Run validates the game, then enters the ebiten main loop. The window is
// sized to Game.WindowScale times the internal resolution, 4× by default.
func Run(g *Game) error {
// The domain may have swapped a manager in since NewGame, so the parts
// that hold a registry directly are wired here, not at construction.
g.Audio.attach(g.AssetManager)
if err := g.Validate(); err != nil {
return err
}
// If the domain didn't register any widgets, fall back to the SCUMM
// preset so the game is still playable.
if g.WidgetManager.Len() == 0 {
RegisterDefaultUI(g)
}
// Initial scene goes in directly (no transition) so OnEnter / OnStart
// run cleanly as one composed sequence on the first script tick.
s := g.SceneManager.MustGet(g.startID)
g.currentScene = g.startID
g.State.NoteVisit(g.startID)
g.placeActors(g.startID)
g.resetTriggers()
if s.Music != "" {
g.Audio.PlayMusic(s.Music)
}
var seq []Action
if s.OnEnter != nil {
seq = append(seq, s.OnEnter)
}
if g.onStart != "" {
seq = append(seq, RunScript(g.onStart))
}
if g.onFinale != "" {
seq = append(seq, RunScript(g.onFinale))
}
if len(seq) > 0 {
g.queueAction(Seq(seq...), "init")
}
scale := g.WindowScale
if scale <= 0 {
scale = 4
}
ebiten.SetWindowSize(g.Width*scale, g.Height*scale)
ebiten.SetWindowTitle(g.Title)
ebiten.SetWindowResizingMode(ebiten.WindowResizingModeEnabled)
return ebiten.RunGame(&engine{g: g})
}
// (Game.Run is provided here for convenience; some callers prefer it.)
func (g *Game) Run() error { return Run(g) }