Fix retained background lifecycle

This commit is contained in:
gamer147
2026-07-12 00:00:45 -04:00
parent fb3a7206ce
commit 96e5306148
13 changed files with 195 additions and 42 deletions

View File

@@ -373,8 +373,7 @@ sealed class GfxTraceHost : IHost
private readonly ResourceMap _res;
private readonly string _scene;
private readonly Dictionary<int, string?> _slotAsset = new(); // slot -> resolved AGF name (or null)
// slot -> dims. Slot 0 is the primary/screen surface (800x600), normally created at engine boot which
// the single-scene harness skips; seed it so the first CG's anchor math stays correct (not 0x0).
// slot -> dimensions of the currently allocated surface. Slot 0 starts as the engine's primary surface.
private readonly Dictionary<int, (int W, int H)> _slotDims = new() { { 0, (800, 600) } };
public List<string> Events { get; } = new();
public GfxTraceHost(ResourceMap res, string scene) { _res = res; _scene = scene; }
@@ -408,6 +407,12 @@ sealed class GfxTraceHost : IHost
_slotDims[slot] = (width, height);
Events.Add($"create-texture slot={slot} {width}x{height}");
}
public void ReleaseSurface(int slot)
{
_slotAsset.Remove(slot);
_slotDims.Remove(slot);
Events.Add($"release-surface slot={slot}");
}
public void ShowText(int offset, string text) { }
public void WaitForInput() { }
public void Sleep(long duration) { }