Skip to content

InputAPI reference

Class FrameLayout

Namespace: MicroEngine.Input
Assembly: MicroEngine.Input.Touch.dll
Guide: Input

Where the virtual canvas goes in a window: the shared letterbox rule of every backend.

C#
public static class FrameLayout

Inheritance

object ← FrameLayout

Methods

Fit(Vector2, RectF, int, int, Presentation?)

Where the frame goes in the safe area (the whole window when the safe area is empty), by the presentation’s rule (Fit). With PixelArt (the default, also used when presentation is null) it is the largest integer scale of the canvas that fits, centred, so pixels stay square and even; when that would fill less than 80 % of what fits (a 480×270 game on a 412-pixel-high phone browser is 1× of a possible 1.5×), the frame scales fractionally instead: on small screens size matters more than even pixels. With HighResolution2D the frame always takes the largest size that fits. On a portrait screen the frame sits at the top of the safe area, so on-screen controls get the space below.

C#
public static RectF Fit(Vector2 window, RectF safeArea, int virtualWidth, int virtualHeight, Presentation? presentation = null)

Parameters

window Vector2

safeArea RectF

virtualWidth int

virtualHeight int

presentation Presentation?

Returns

RectF

Exceptions

ArgumentOutOfRangeException

The canvas size is not positive.

ToCanvas(Vector2, RectF, int, int)

A window position in virtual canvas pixels for the frame frame.

C#
public static Vector2 ToCanvas(Vector2 window, RectF frame, int virtualWidth, int virtualHeight)

Parameters

window Vector2

frame RectF

virtualWidth int

virtualHeight int

Returns

Vector2