Table of Contents

Class MlemPlatform

Namespace
MLEM.Misc
Assembly
MLEM.dll

MlemPlatform is a wrapper around some of MonoGame's platform-dependent behavior to allow for MLEM to stay platform-independent. See MlemPlatform.DesktopGl<T>, MlemPlatform.DesktopFna, MlemPlatform.Mobile and MlemPlatform.None, as well as the online documentation at https://mlem.ellpeck.de/articles/ui.html#text-input for information on the specific platforms. The MLEM demos' main classes also make use of this functionality: https://github.com/Ellpeck/MLEM/blob/main/Demos.DesktopGL/Program.cs#L8 and https://github.com/Ellpeck/MLEM/blob/main/Demos.Android/Activity1.cs#L33.

public abstract class MlemPlatform
Inheritance
MlemPlatform
Derived
Inherited Members

Fields

Current

The current MLEM platform Set this value before starting your game if you want to use platform-dependent MLEM features.

public static MlemPlatform Current

Field Value

MlemPlatform

Methods

AddTextInputListener(GameWindow, TextInputCallback)

Adds a text input listener to this platform, if supported. The supplied listener will be called whenever a character is input.

public abstract void AddTextInputListener(GameWindow window, MlemPlatform.TextInputCallback callback)

Parameters

window GameWindow

The game's window

callback MlemPlatform.TextInputCallback

The callback that should be called whenever a character is pressed

EnsureExists()

Ensures that Current is set to a valid MlemPlatform value by throwing an InvalidOperationException exception if Current is null.

public static void EnsureExists()

Exceptions

InvalidOperationException

If Current is null

OpenLinkOrFile(string)

A method that should be executed to open a link in the browser or a file explorer. This method is currently used only by MLEM.Ui's implementation of the LinkCode formatting code.

public abstract void OpenLinkOrFile(string link)

Parameters

link string

OpenOnScreenKeyboard(string, string, string, bool)

Opens the on-screen keyboard if one is required by the platform. Note that, if no on-screen keyboard is required, a null string should be returned.

public abstract Task<string> OpenOnScreenKeyboard(string title, string description, string defaultText, bool usePasswordMode)

Parameters

title string

Title of the dialog box.

description string

Description of the dialog box.

defaultText string

Default text displayed in the input area.

usePasswordMode bool

If password mode is enabled, the characters entered are not displayed.

Returns

Task<string>

Text entered by the player. Null if back was used.