Update README.md to include project description, developer documentation links, and license information.
CI / build-test (push) Successful in 1m6s

This commit is contained in:
Leonid Pershin
2026-06-11 04:03:07 +03:00
parent 31aba3aeee
commit ff2231a8ab
72 changed files with 4113 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
namespace MrGameEng.Core;
/// <summary>
/// Owns the active <see cref="Scene"/>. Scene switches are deferred to the start of the
/// next update so a scene is never unloaded in the middle of its own frame.
/// </summary>
public sealed class SceneManager
{
/// <summary>The active scene, or null before the first switch is applied.</summary>
public Scene? Current { get; private set; }
private readonly EngineContext _context;
private Scene? _pending;
private bool _hasPending;
internal SceneManager(EngineContext context) => _context = context;
/// <summary>
/// Requests a switch to <paramref name="scene"/>. The current scene is unloaded and the new
/// one loaded at the start of the next update tick. Passing null unloads the current scene.
/// </summary>
public void Switch(Scene? scene)
{
_pending = scene;
_hasPending = true;
}
/// <summary>Applies a pending switch, then updates the active scene. Called by the host.</summary>
public void Update(GameClock clock)
{
ApplyPending();
Current?.Update(clock);
}
/// <summary>Draws the active scene. Called by the host.</summary>
public void Draw(GameClock clock) => Current?.Draw(clock);
internal void ApplyPending()
{
if (!_hasPending)
{
return;
}
_hasPending = false;
Current?.Unload();
Current = _pending;
_pending = null;
Current?.Load(_context);
}
}