Skip to content

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.

C#
public sealed record PlatformRequest : IEquatable<PlatformRequest>

Inheritance

object ← PlatformRequest

Implements

IEquatable<PlatformRequest>

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.

C#
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.

C#
public Func<IAudioDevice>? Audio { get; init; }

Property Value

Func<IAudioDevice>?

AudioOutput

Whether the backend may open a physical audio device: Automatic (the default) and Device open one, Silent opens none.

C#
public AudioOutput AudioOutput { get; init; }

Property Value

AudioOutput

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).

C#
public int CaptureScale { get; init; }

Property Value

int

ExtraInput

Input sources read together with the backend’s (an on-screen pad, a network peer, a test).

C#
public IReadOnlyList<IInputSource> ExtraInput { get; init; }

Property Value

IReadOnlyList<IInputSource>

Hidden

Renders into a hidden window (captures still work). A hidden window never waits for the display.

C#
public bool Hidden { get; init; }

Property Value

bool

Identity

The game’s application identity (name, id, icon, orientation); null keeps the backend’s defaults.

C#
public AppIdentity? Identity { get; init; }

Property Value

AppIdentity?

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.

C#
public ILog Log { get; init; }

Property Value

ILog

Mute

No sound: the backend opens no audio device.

C#
public bool Mute { get; init; }

Property Value

bool

OpensOwnAudio

Whether the backend should open its own audio device: no device was supplied, no mute, and the output is not silent.

C#
public bool OpensOwnAudio { get; }

Property Value

bool

Scale

Window scale; null uses Scale.

C#
public int? Scale { get; init; }

Property Value

int?

Settings

C#
public GameSettings Settings { get; init; }

Property Value

GameSettings

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.

C#
public bool StartGamepadsAfterFirstFrame { get; init; }

Property Value

bool

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.

C#
public bool WaitForDisplay { get; init; }

Property Value

bool

Methods

<Clone>$()

C#
public PlatformRequest <Clone>$()

Returns

PlatformRequest

CombineInput(IInputSource)

The input a backend reports for this request: its own source, read together with ExtraInput when there are any.

C#
public IInputSource CombineInput(IInputSource own)

Parameters

own IInputSource

Returns

IInputSource

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.

C#
public IAudioDevice CreateAudio(Func<IAudioDevice> openOwn)

Parameters

openOwn Func<IAudioDevice>

Returns

IAudioDevice

Deconstruct(out GameSettings)

C#
public void Deconstruct(out GameSettings Settings)

Parameters

Settings GameSettings

Equals(object?)

C#
public override bool Equals(object? obj)

Parameters

obj object?

Returns

bool

Equals(PlatformRequest?)

C#
public bool Equals(PlatformRequest? other)

Parameters

other PlatformRequest?

Returns

bool

GetHashCode()

C#
public override int GetHashCode()

Returns

int

ToString()

C#
public override string ToString()

Returns

string

Operators

operator ==(PlatformRequest?, PlatformRequest?)

C#
public static bool operator ==(PlatformRequest? left, PlatformRequest? right)

Parameters

left PlatformRequest?

right PlatformRequest?

Returns

bool

operator !=(PlatformRequest?, PlatformRequest?)

C#
public static bool operator !=(PlatformRequest? left, PlatformRequest? right)

Parameters

left PlatformRequest?

right PlatformRequest?

Returns

bool