Class MlemPlatform.Mobile
The MLEM platform for mobile platforms as well as consoles.
This platform opens an on-screen keyboard using the Microsoft.Xna.Framework.Input KeyboardInput
class on mobile devices.
Additionally, it starts a new activity whenever OpenLinkOrFile(string) is called.
This listener is initialized as follows in the game's Activity
class:
MlemPlatform.Current = new MlemPlatform.Mobile(KeyboardInput.Show, l => this.StartActivity(new Intent(Intent.ActionView, Uri.Parse(l))));
public class MlemPlatform.Mobile : MlemPlatform
- Inheritance
-
MlemPlatform.Mobile
- Inherited Members
Constructors
Mobile(OpenOnScreenKeyboardDelegate, Action<string>)
Creates a new mobile- and console-based platform. See MlemPlatform.Mobile class documentation for more detailed information.
public Mobile(MlemPlatform.Mobile.OpenOnScreenKeyboardDelegate openOnScreenKeyboard, Action<string> openLink = null)
Parameters
openOnScreenKeyboard
MlemPlatform.Mobile.OpenOnScreenKeyboardDelegateThe function that is used to display the on-screen keyboard
openLink
Action<string>The action that is invoked to open a link in the browser, which is used for LinkCode
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 override void AddTextInputListener(GameWindow window, MlemPlatform.TextInputCallback callback)
Parameters
window
GameWindowThe game's window
callback
MlemPlatform.TextInputCallbackThe callback that should be called whenever a character is pressed
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 override 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 override Task<string> OpenOnScreenKeyboard(string title, string description, string defaultText, bool usePasswordMode)
Parameters
title
stringTitle of the dialog box.
description
stringDescription of the dialog box.
defaultText
stringDefault text displayed in the input area.
usePasswordMode
boolIf password mode is enabled, the characters entered are not displayed.