Files
mrgameeng/src/MrGameEng.Core/Transition.cs
T
Leonid PershinandClaude Fable 5 2ac074004a
CI / build-test (push) Successful in 1m24s
Split the platform out of Core: new Host library + HeadlessHost
Core now depends only on Friflo.Engine.ECS — no MonoGame, no platform.
The windowed MonoGame host moves to the new MrGameEng.Host library:
GameHost, GameHostOptions, visual scene transitions (OverlayTransition,
Transitions.Fade/Wipe, TransitionRenderer) and the Input feature
(namespace MrGameEng.Input is unchanged). Transition timing stays in
Core (SceneManager exposes ActiveTransition/TransitionCoverage/
TransitionPhase; the host draws the overlay). EngineContext loses its
GraphicsDevice property: hosts publish the device as a service and
graphics code reads it via context.GetGraphicsDevice() in Graphics.

Core gains HeadlessHost: a fixed-timestep loop without a window or GPU
(Tick/RunTicks, Run with wall-clock pacing and lag resync) for dedicated
servers, batch simulation and tests. Graphics and Audio now carry their
own MonoGame.Framework.DesktopGL reference instead of inheriting it
from Core.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 23:04:34 +03:00

36 lines
1.3 KiB
C#

namespace MrGameEng.Core;
/// <summary>Phase of a scene transition.</summary>
public enum TransitionPhase
{
/// <summary>The old scene is being covered (coverage grows 0 → 1).</summary>
Out,
/// <summary>The new scene is being revealed (coverage shrinks 1 → 0).</summary>
In,
}
/// <summary>
/// Timing of a visual transition between scenes. The scene switch itself happens at full
/// coverage, so a slow <c>OnLoad</c> of the next scene is hidden behind the overlay.
/// Progress is tracked by <see cref="SceneManager"/> on unscaled time, so transitions work
/// while gameplay is paused. The core only times the phases — how the overlay looks is
/// defined by the host (the MonoGame host's <c>OverlayTransition</c> and the
/// <c>Transitions</c> factories); headless hosts simply let transitions pass invisibly.
/// </summary>
public abstract class Transition
{
/// <summary>Seconds the covering phase takes.</summary>
public float OutDuration { get; }
/// <summary>Seconds the revealing phase takes.</summary>
public float InDuration { get; }
/// <summary>Creates a transition with explicit phase durations.</summary>
protected Transition(float outDuration, float inDuration)
{
OutDuration = Math.Max(0f, outDuration);
InDuration = Math.Max(0f, inDuration);
}
}