Table of Contents

Namespace MLEM.Misc

Classes

Direction2Helper

A set of helper and extension methods for dealing with Direction2

Easings

This class contains a set of easing functions, adapted from https://easings.net. These can be used for ui elements or any other kind of animations. By default, each function takes an input that ranges between 0 and 1, and produces an output that roughly ranges between 0 and 1. To change this behavior, you can use ScaleInput(Easing, float, float) and ScaleOutput(Easing, float, float).

EnumHelper

A helper class that allows easier usage of Enum values.

GenericDataHolder

Represents an object that can hold generic key-value based data. A lot of MLEM components extend this class to allow for users to add additional data to them easily. This IGenericDataHolder implemention uses an underlying Dictionary<TKey, TValue> that only keeps track of non-default values.

MlemPlatform

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

MlemPlatform.DesktopFna

The MLEM Desktop platform for FNA. This platform uses the built-in FNA TextInputEXT event, which makes this listener work with any keyboard localization natively. This platform is initialized as follows:

MlemPlatform.Current = new MlemPlatform.DesktopFna(a => TextInputEXT.TextInput += a);
MlemPlatform.DesktopGl<T>

The MLEM DesktopGL platform, which is also compatible with other desktop distributions of MonoGame, like WindowsDX. This platform uses the built-in MonoGame TextInput event, which makes this listener work with any keyboard localization natively. This platform is initialized as follows:

MlemPlatform.Current = new MlemPlatform.DesktopGl<TextInputEventArgs>((w, c) => w.TextInput += c);
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))));
MlemPlatform.None

A MLEM platform implementation that does nothing. This can be used if no platform-dependent code is required for the game.

SingleRandom

The SingleRandom class allows generating single, one-off pseudorandom numbers based on a seed or a SeedSource. The types of numbers that can be generated are int and float, both of which can be generated with specific minimum and maximum values if desired. Methods in this class are tested to be sufficiently "random", that is, to be sufficiently distributed throughout their range, as well as sufficiently different for neighboring seeds.

Structs

Padding

Represents a generic padding. A padding is an object of data that stores an offset from each side of a rectangle or square.

RectangleF

Represents a float-based version of Microsoft.Xna.Framework.Rectangle

SeedSource

A seed source contains an int value which can be used as a seed for a Random or SingleRandom. Seed sources feature a convenient way to add multiple seeds using Add(int), which will be sufficiently scrambled to be deterministically pseudorandom and combined into a single int. This struct behaves similarly to System.HashCode in many ways, with an important distinction being that SeedSource's scrambling procedure is not considered an implementation detail, and will stay consistent between process executions.

Interfaces

IGenericDataHolder

Represents an object that can hold generic key-value based data. A lot of MLEM components extend this class to allow for users to add additional data to them easily.

Enums

Direction2

An enum that represents two-dimensional directions. Both straight and diagonal directions are supported. There are several extension methods and arrays available in Direction2Helper.

Delegates

Easings.Easing

A delegate method used by Easings.

MlemPlatform.Mobile.OpenOnScreenKeyboardDelegate

A delegate method used for OpenOnScreenKeyboard(string, string, string, bool)

MlemPlatform.TextInputCallback

A delegate method that can be used for AddTextInputListener(GameWindow, TextInputCallback)