KernelAPI reference
Class PlatformRequest
Namespace: MicroEngine.Core
Assembly: MicroEngine.dll
Guide: Backends and platforms
What a host asks of a platform: the game’s settings, window options and any subsystem it supplies itself. Every option is explicit and has a documented default; none depends on how the loop advances time (that is the loop’s business only, TimeMode). A backend honours the supplied parts by building its audio device with CreateAudio and its input with CombineInput; Create checks that it did.
public sealed record PlatformRequest : IEquatable<PlatformRequest>Inheritance
Implements
Constructors
PlatformRequest(GameSettings)
What a host asks of a platform: the game’s settings, window options and any subsystem it supplies itself. Every option is explicit and has a documented default; none depends on how the loop advances time (that is the loop’s business only, TimeMode). A backend honours the supplied parts by building its audio device with CreateAudio and its input with CombineInput; Create checks that it did.
public PlatformRequest(GameSettings Settings)Parameters
Settings GameSettings
Properties
Audio
Creates the audio device used instead of the backend’s; the platform owns and disposes it.
public Func<IAudioDevice>? Audio { get; init; }Property Value
AudioOutput
Whether the backend may open a physical audio device: Automatic (the default) and Device open one, Silent opens none.
public AudioOutput AudioOutput { get; init; }Property Value
CaptureScale
Size factor of the PNGs written by SaveScreenshot; by default the presentation’s (CaptureScale: 3 for pixel art, so its pixels are visible, 1 for high-resolution canvases).
public int CaptureScale { get; init; }Property Value
ExtraInput
Input sources read together with the backend’s (an on-screen pad, a network peer, a test).
public IReadOnlyList<IInputSource> ExtraInput { get; init; }Property Value
Hidden
Renders into a hidden window (captures still work). A hidden window never waits for the display.
public bool Hidden { get; init; }Property Value
Identity
The game’s application identity (name, id, icon, orientation); null keeps the backend’s defaults.
public AppIdentity? Identity { get; init; }Property Value
Log
Where the backend reports what it could not do and how it carried on (no audio device, no gamepads, a renderer that did not start). Standard error by default; GameHost passes one that reaches the game’s Log once the game starts, so a game that sends its log elsewhere receives these too.
public ILog Log { get; init; }Property Value
Mute
No sound: the backend opens no audio device.
public bool Mute { get; init; }Property Value
OpensOwnAudio
Whether the backend should open its own audio device: no device was supplied, no mute, and the output is not silent.
public bool OpensOwnAudio { get; }Property Value
Scale
Window scale; null uses Scale.
public int? Scale { get; init; }Property Value
int?
Settings
public GameSettings Settings { get; init; }Property Value
StartGamepadsAfterFirstFrame
Whether the backend starts its gamepad subsystem only after the first frame is presented (false by default: with the platform). Hosts that present a start screen while the game loads set it, so a slow gamepad start-up (about a second on some Windows machines) never keeps the window from appearing; pads already connected are reported when it starts.
public bool StartGamepadsAfterFirstFrame { get; init; }Property Value
WaitForDisplay
Whether the frames of a visible window may wait for the display’s refresh (true by default): VSync as VSync asks, and frames paced to the display (IDisplayPacing). False never waits, whatever the settings say, for checks that run as fast as they can.
public bool WaitForDisplay { get; init; }Property Value
Methods
<Clone>$()
public PlatformRequest <Clone>$()Returns
CombineInput(IInputSource)
The input a backend reports for this request: its own source, read together with ExtraInput when there are any.
public IInputSource CombineInput(IInputSource own)Parameters
own IInputSource
Returns
CreateAudio(Func<IAudioDevice>)
The audio device a backend uses for this request: the one the host supplied (Audio), else the
backend’s own (openOwn) when OpensOwnAudio, else a silent device. The backend
owns and disposes the result.
public IAudioDevice CreateAudio(Func<IAudioDevice> openOwn)Parameters
openOwn Func<IAudioDevice>
Returns
Deconstruct(out GameSettings)
public void Deconstruct(out GameSettings Settings)Parameters
Settings GameSettings
Equals(object?)
public override bool Equals(object? obj)Parameters
obj object?
Returns
Equals(PlatformRequest?)
public bool Equals(PlatformRequest? other)Parameters
other PlatformRequest?
Returns
GetHashCode()
public override int GetHashCode()Returns
ToString()
public override string ToString()Returns
Operators
operator ==(PlatformRequest?, PlatformRequest?)
public static bool operator ==(PlatformRequest? left, PlatformRequest? right)Parameters
left PlatformRequest?
right PlatformRequest?
Returns
operator !=(PlatformRequest?, PlatformRequest?)
public static bool operator !=(PlatformRequest? left, PlatformRequest? right)Parameters
left PlatformRequest?
right PlatformRequest?