Skip to content

PlatformAPI reference

Class DesktopLauncher

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

Standard entry point for desktop games: the shared launcher model (GameHost, the command line of GameLauncher) with the official desktop platforms, in order of preference: sdl (the default on Windows, Linux and macOS), raylib, sdl-software (SDL’s CPU renderer, for machines without a usable GPU such as virtual machines and CI runners) and headless. A game’s Program.cs is one line that hands over its Configure entry point, the same one the browser and phone builds call; choosing a platform is the player’s or the test’s business (–platform, MICROENGINE_PLATFORM), never the game’s.

C#
public static class DesktopLauncher

Inheritance

object ← DesktopLauncher

Examples

C#
return DesktopLauncher.Run(MainGame.Configure, args);

Methods

BundleContentRoot(string)

The content folder of a macOS application bundle (Name.app/Contents/Resources/Content) when the executable runs from Contents/MacOS, where a signed bundle keeps only code; null anywhere else, so the Content folder next to the executable stays the default.

C#
public static string? BundleContentRoot(string executableDirectory)

Parameters

executableDirectory string

Returns

string?

CreateCatalog()

A new catalog of the official desktop platforms; add a profile of your own to offer it with –platform.

C#
public static PlatformCatalog CreateCatalog()

Returns

PlatformCatalog

Defaults(HostBuilder)

The desktop host’s defaults: the official platforms (CreateCatalog) and, inside a macOS application bundle, its Contents/Resources/Content folder as the content (BundleContentRoot).

C#
public static void Defaults(HostBuilder host)

Parameters

host HostBuilder

Run(Action<HostBuilder>, string[])

Runs the game a composition chooses (the game’s Configure entry point, which calls UseGame) with the command line args. The desktop host’s defaults come first (Defaults); configure may replace any of them.

C#
public static int Run(Action<HostBuilder> configure, string[] args)

Parameters

configure Action<HostBuilder>

args string[]

Returns

int

The process exit code: 0 on success, 1 on a game or platform error, 2 on bad arguments.

Run(Game, string[])

Runs game with the arguments of GameLauncher on the official desktop platforms; call it from Program.cs.

C#
public static int Run(Game game, string[] args)

Parameters

game Game

The game to run.

args string[]

The process arguments.

Returns

int

The process exit code: 0 on success, 1 on a game or platform error, 2 on bad arguments.

Run(Game, string[], PlatformCatalog, Func<PlatformRequest, PlatformRequest>?)

Runs with a catalog and request changes of the host’s own (a custom platform, another audio device).

C#
public static int Run(Game game, string[] args, PlatformCatalog catalog, Func<PlatformRequest, PlatformRequest>? configure = null)

Parameters

game Game

args string[]

catalog PlatformCatalog

configure Func<PlatformRequest, PlatformRequest>?

Returns

int