Split the platform out of Core: new Host library + HeadlessHost
CI / build-test (push) Successful in 1m24s
CI / build-test (push) Successful in 1m24s
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>
This commit is contained in:
co-authored by
Claude Fable 5
parent
79d406a9f4
commit
2ac074004a
@@ -15,6 +15,14 @@ public class SceneTransitionTests
|
||||
protected override void OnUnload() => UnloadCount++;
|
||||
}
|
||||
|
||||
// Тайминг-машина живёт в ядре и не зависит от визуала перехода —
|
||||
// тестируем на голой заглушке с длительностями, как у Fade.
|
||||
private sealed class TimedTransition(float outDuration, float inDuration)
|
||||
: Transition(outDuration, inDuration);
|
||||
|
||||
private static Transition Fade(float duration) =>
|
||||
new TimedTransition(duration / 2f, duration / 2f);
|
||||
|
||||
private static void Tick(EngineContext context, float seconds)
|
||||
{
|
||||
context.Clock.Advance(seconds);
|
||||
@@ -31,7 +39,7 @@ public class SceneTransitionTests
|
||||
Tick(context, 0.016f);
|
||||
|
||||
// Fade(1.0) → фаза закрытия 0.5 c, фаза открытия 0.5 c.
|
||||
context.Scenes.Switch(second, Transition.Fade(1f));
|
||||
context.Scenes.Switch(second, Fade(1f));
|
||||
Tick(context, 0.2f);
|
||||
|
||||
Assert.True(context.Scenes.IsTransitioning);
|
||||
@@ -61,7 +69,7 @@ public class SceneTransitionTests
|
||||
Tick(context, 0.016f);
|
||||
context.Clock.TimeScale = 0f; // игра на паузе
|
||||
|
||||
context.Scenes.Switch(second, Transition.Fade(0.2f));
|
||||
context.Scenes.Switch(second, Fade(0.2f));
|
||||
Tick(context, 0.15f);
|
||||
Tick(context, 0.15f);
|
||||
|
||||
@@ -79,7 +87,7 @@ public class SceneTransitionTests
|
||||
context.Scenes.Switch(first);
|
||||
Tick(context, 0.016f);
|
||||
|
||||
context.Scenes.Switch(second, Transition.Fade(1f));
|
||||
context.Scenes.Switch(second, Fade(1f));
|
||||
Tick(context, 0.1f);
|
||||
context.Scenes.Switch(third); // передумали, пока экран закрывается
|
||||
|
||||
@@ -99,12 +107,12 @@ public class SceneTransitionTests
|
||||
context.Scenes.Switch(first);
|
||||
Tick(context, 0.016f);
|
||||
|
||||
context.Scenes.Switch(second, Transition.Fade(1f)); // 0.5 c закрытие + 0.5 c открытие
|
||||
context.Scenes.Switch(second, Fade(1f)); // 0.5 c закрытие + 0.5 c открытие
|
||||
Tick(context, 0.6f); // закрыто, своп на second, началось открытие
|
||||
Assert.Same(second, context.Scenes.Current);
|
||||
|
||||
Tick(context, 0.25f); // открытие наполовину (coverage ~0.5)
|
||||
context.Scenes.Switch(third, Transition.Fade(1f)); // передумали во время открытия
|
||||
context.Scenes.Switch(third, Fade(1f)); // передумали во время открытия
|
||||
|
||||
Tick(context, 0.05f); // экран снова закрывается — свопа ещё нет
|
||||
Assert.Same(second, context.Scenes.Current);
|
||||
@@ -124,7 +132,7 @@ public class SceneTransitionTests
|
||||
context.Scenes.Switch(first);
|
||||
Tick(context, 0.016f);
|
||||
|
||||
context.Scenes.Switch(second, Transition.Fade(0f));
|
||||
context.Scenes.Switch(second, Fade(0f));
|
||||
Tick(context, 0.016f);
|
||||
Tick(context, 0.016f);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user