Declare the managers in boot.go, hand them to the engine whole
ci/woodpecker/push/ebitengine Pipeline was successful
ci/woodpecker/push/ebitengine Pipeline was successful
boot.manager.go becomes boot.go and carries all seven managers as one block, so what the game holds reads in one place instead of a line hidden in each category file. The category files keep their entity alias. The hand-off stops copying. Our managers are the same *inkwell.Manager[T] the Game holds, so New assigns them onto it and engine and game share one registry per category. content.manager.go is gone with the copy loop. Themes stay additive — NewGame seeds four presets we would otherwise throw away — and registerScene becomes prepareScene, which now has to run before the hand-off: with no copy pass left, the scene defaults are written back into SceneManager with Set. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+67
@@ -0,0 +1,67 @@
|
||||
package inc
|
||||
|
||||
import (
|
||||
inkwell "git.teletypegames.org/engines/inkwell"
|
||||
)
|
||||
|
||||
var (
|
||||
BackgroundManager = inkwell.NewManager[Background]()
|
||||
CharacterManager = inkwell.NewManager[Character]()
|
||||
DialogManager = inkwell.NewManager[Dialog]()
|
||||
ItemManager = inkwell.NewManager[Item]()
|
||||
SceneManager = inkwell.NewManager[Scene]()
|
||||
ScriptManager = inkwell.NewManager[Script]()
|
||||
ThemeManager = inkwell.NewManager[Theme]()
|
||||
)
|
||||
|
||||
type Opts struct {
|
||||
Scene string
|
||||
Finale bool
|
||||
}
|
||||
|
||||
func New(o Opts) *inkwell.Game {
|
||||
start := o.Scene
|
||||
if start == "" {
|
||||
start = SceneAlley
|
||||
}
|
||||
|
||||
prepareScene()
|
||||
|
||||
g := inkwell.NewGame("Real World", ScreenW, ScreenH)
|
||||
g.MaxLogLines = 64
|
||||
g.SceneRect = inkwell.Rect(0, TopBarH, ScreenW, HUDTop-TopBarH)
|
||||
g.ExitLook = func(e inkwell.Exit) inkwell.Action {
|
||||
return inkwell.Say(Paul, "That way: "+e.Label+".")
|
||||
}
|
||||
g.ExitTake = func(inkwell.Exit) inkwell.Action {
|
||||
return inkwell.Say(Paul, "It's a way out, not a thing.")
|
||||
}
|
||||
|
||||
g.AssetManager = BackgroundManager
|
||||
g.CharacterManager = CharacterManager
|
||||
g.DialogueManager = DialogManager
|
||||
g.ItemManager = ItemManager
|
||||
g.SceneManager = SceneManager
|
||||
g.ScriptManager = ScriptManager
|
||||
ThemeManager.Each(g.ThemeManager.Register)
|
||||
|
||||
World.attach(g)
|
||||
g.UseTheme(RealWorld)
|
||||
registerUI()
|
||||
|
||||
g.StartAt(start)
|
||||
g.OnStart(inkwell.Seq(bootOpening(start, o.Finale)...))
|
||||
return g
|
||||
}
|
||||
|
||||
func bootOpening(start string, finale bool) []inkwell.Action {
|
||||
acts := []inkwell.Action{
|
||||
inkwell.SetFlag(FlagPoliceTip),
|
||||
inkwell.Say(Paul, "Back alley. Just like the clerk said."),
|
||||
TapeSay(Dex, "A government office tipped you off to remove something from a scene. That doesn't strike you as odd?"),
|
||||
}
|
||||
if finale {
|
||||
acts = append(acts, inkwell.RunScript(ScriptFinale))
|
||||
}
|
||||
return acts
|
||||
}
|
||||
Reference in New Issue
Block a user