AudioPlayer keeps the *AssetManager it is handed, so attaching it during construction quietly pinned it to the manager NewGame happened to make. A domain that assigns its own registry onto the Game — legal, the fields are plain *Manager values — got a working image path and a silent audio one. Run attaches instead, once the Game is final. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,10 @@ import (
|
||||
// Run validates the game, then enters the ebiten main loop. The window is
|
||||
// sized to 4× the internal resolution.
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user