PlatformAPI reference
Class BrowserPage
Namespace: MicroEngine.Sdl
Assembly: MicroEngine.Sdl.dll
Guide: Backends and platforms
One browser page’s way into the SDL platform it hosts. SDL reads the keyboard, the mouse and gamepads from the page
itself; what it cannot know comes from here: the page listens to Pointer Events on the canvas and forwards touch and
pen pointers, in canvas pixels, with the page’s safe-area insets (CSS env(safe-area-inset-*)) and density,
its visibility and how it vibrates. The browser host (src/MicroEngine.Cli/Hosts/web) owns one and calls these from
its JavaScript exports; every platform it builds (BrowserProfile) reads this page and no
other, so nothing is shared through the process.
public sealed class BrowserPageInheritance
Constructors
BrowserPage()
public BrowserPage()Properties
ClipboardWriter
How the page writes text to the system clipboard (navigator.clipboard); null where it cannot.
public Func<string, bool>? ClipboardWriter { get; set; }Property Value
Hidden
Whether the page is hidden (another tab, the phone locked or switched away), set by the page from
visibilitychange; the SDL platform reports it as a suspension (Suspending).
public bool Hidden { get; set; }Property Value
Vibrator
How the page vibrates (navigator.vibrate) for a number of milliseconds; null where it cannot.
public Func<int, bool>? Vibrator { get; set; }Property Value
Methods
Paste(string)
The text of a paste on the page (its paste event): what the game’s clipboard reads from now on, because a
page cannot read the system clipboard without asking. The paste’s key press reaches the game after it.
public void Paste(string text)Parameters
text string
Pointer(long, int, float, float)
A touch or pen pointer. Phase: 0 began, 1 moved, 2 ended, 3 cancelled. Position in canvas (render) pixels.
public void Pointer(long id, int phase, float x, float y)Parameters
id long
phase int
x float
y float
Screen(float, float, float, float, float, bool)
The screen facts the page knows: safe-area insets in canvas pixels, canvas pixels per CSS pixel, and whether touch is the main input.
public void Screen(float left, float top, float right, float bottom, float pixelsPerDp, bool touchFirst)Parameters
left float
top float
right float
bottom float
pixelsPerDp float
touchFirst bool