Skip to content

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.

C#
public sealed class BrowserPage

Inheritance

object ← BrowserPage

Constructors

BrowserPage()

C#
public BrowserPage()

Properties

ClipboardWriter

How the page writes text to the system clipboard (navigator.clipboard); null where it cannot.

C#
public Func<string, bool>? ClipboardWriter { get; set; }

Property Value

Func<string, bool>?

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

C#
public bool Hidden { get; set; }

Property Value

bool

Vibrator

How the page vibrates (navigator.vibrate) for a number of milliseconds; null where it cannot.

C#
public Func<int, bool>? Vibrator { get; set; }

Property Value

Func<int, bool>?

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.

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

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

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