Skip to content

KernelAPI reference

Interface IPlatform

Namespace: MicroEngine.Core
Assembly: MicroEngine.dll
Guide: Backends and platforms

Everything a backend provides: the host (IPlatformHost: clock, events, main surface, capabilities, whether it may block) plus, until the graphics, input and audio contracts are split from it, the renderer that draws into the virtual canvas and the graphics, input and audio devices.

C#
public interface IPlatform : IPlatformHost, IDisposable

Implements

IPlatformHost, IDisposable

Remarks

Optional features are capabilities found with TryGetCapability``1, never by casting a platform: IDisplayControl, IPlatformDiagnostics, ITouchScreen (with its vibration), IDisplayPacing and IPreciseDelay. A platform that wraps another forwards every member, so wrapping never hides a capability.

Properties

Audio

Plays sound; a silent device when there is no audio.

C#
IAudioDevice Audio { get; }

Property Value

IAudioDevice

Graphics

Creates textures.

C#
IGraphicsDevice Graphics { get; }

Property Value

IGraphicsDevice

Input

Keyboard, gamepad and pointer state, read once per update.

C#
IInputSource Input { get; }

Property Value

IInputSource

Letterbox

Colour of the window around the frame. Starts as Letterbox; the start screen sets its own colour while it shows. Platforms without a window keep it and ignore it.

C#
Color Letterbox { get; set; }

Property Value

Color

Methods

BeginFrame()

Starts a frame and returns the renderer that draws into the virtual canvas.

C#
IRenderer BeginFrame()

Returns

IRenderer

EndFrame()

Finishes the frame and presents it.

C#
void EndFrame()

SaveScreenshot(string)

Writes the most recently completed virtual frame as a PNG.

C#
void SaveScreenshot(string path)

Parameters

path string

ToggleFullscreen()

Switches between window and full screen where the platform has a window; does nothing elsewhere.

C#
void ToggleFullscreen()