Skip to content

PlatformAPI reference

Class BrowserLauncher

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

Entry point for browser builds (SDL 3 compiled to WebAssembly): the shared launcher model (GameHost) for a page. A page cannot block its only thread in a game loop, so this returns a GameSession: the page starts it with a LaunchRequest (a script in development packages), ticks it once per requestAnimationFrame and may start it again after the game ends. Every run composes the game with the same Configure entry point its desktop Program.cs uses, so what the game configures there (platforms, request changes, engine services) reaches the browser too; a scripted run is in deterministic time with seed 1, exactly as on desktop and phones. Saves go to localStorage by default (DefaultStorage).

C#
public static class BrowserLauncher

Inheritance

object ← BrowserLauncher

Methods

CreateSession(Action<HostBuilder>, BrowserPage)

The session a browser page drives. The host’s defaults (Defaults) come first, then configure (the game’s Configure entry point), for every run.

C#
public static GameSession CreateSession(Action<HostBuilder> configure, BrowserPage page)

Parameters

configure Action<HostBuilder>

The game’s composition.

page BrowserPage

The page whose touches, screen, visibility, vibration and clipboard the platforms use.

Returns

GameSession

Exceptions

ArgumentNullException

An argument is null.

Defaults(HostBuilder, BrowserPage)

The browser host’s defaults: the SDL platform of page as its only platform.

C#
public static void Defaults(HostBuilder host, BrowserPage page)

Parameters

host HostBuilder

page BrowserPage

Exceptions

ArgumentNullException

An argument is null.