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
@@ -0,0 +1,46 @@
|
||||
using Friflo.Engine.ECS.Systems;
|
||||
using MrGameEng.Core;
|
||||
|
||||
namespace MrGameEng.Input;
|
||||
|
||||
/// <summary>Polls the <see cref="InputManager"/> once per frame. Registered first in the update phase.</summary>
|
||||
public sealed class InputSystem : BaseSystem
|
||||
{
|
||||
private readonly InputManager _input;
|
||||
|
||||
/// <summary>Creates the system for <paramref name="input"/>.</summary>
|
||||
public InputSystem(InputManager input) => _input = input;
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnUpdateGroup() => _input.Update();
|
||||
}
|
||||
|
||||
/// <summary>Wires the input module into a <see cref="Scene"/>.</summary>
|
||||
public static class SceneInputExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the shared <see cref="InputManager"/> service (creating it on first use) and
|
||||
/// inserts <see cref="InputSystem"/> at the start of the scene's update phase.
|
||||
/// Call from <c>OnLoad</c> before adding gameplay systems.
|
||||
/// </summary>
|
||||
public static InputManager UseInput(this Scene scene)
|
||||
{
|
||||
var services = scene.Context.Services;
|
||||
var input = services.GetOrDefault<InputManager>();
|
||||
if (input is null)
|
||||
{
|
||||
var capture = services.GetOrDefault<InputCapture>();
|
||||
if (capture is null)
|
||||
{
|
||||
capture = new InputCapture();
|
||||
services.Add(capture);
|
||||
}
|
||||
|
||||
input = new InputManager(capture);
|
||||
services.Add(input);
|
||||
}
|
||||
|
||||
scene.UpdateSystems.Insert(0, new InputSystem(input));
|
||||
return input;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user