Skip to content

API reference

Class PromptText

Namespace: MicroEngine.UI
Assembly: MicroEngine.dll
Guide: UI widgets

Draws text with action prompts as glyphs: “Press {attack} to swing” shows a key cap with Z on a keyboard, a green A on an Xbox pad, a × button on a PlayStation pad and the touch button’s label in a ring on a phone. Text that does not name an action is drawn as with Draw. Glyphs are as tall as a line of the font.

C#
public static class PromptText

Inheritance

object ← PromptText

Methods

Draw(IRenderer, BitmapFont, ActionPrompts, string, Vector2, Color, Color?, PromptGlyphStyle?)

Draws one line of template with its top-left at position.

C#
public static void Draw(IRenderer r, BitmapFont font, ActionPrompts prompts, string template, Vector2 position, Color color, Color? shadow = null, PromptGlyphStyle? style = null)

Parameters

r IRenderer

The renderer.

font BitmapFont

The font of the text and of the glyph labels.

prompts ActionPrompts

Resolves the actions (Prompts).

template string

Text with {action} names (see Format).

position Vector2

Top-left of the line, in virtual pixels.

color Color

Colour of the plain text.

shadow Color?

A 1px shadow under the plain text; null draws none.

style PromptGlyphStyle?

Glyph colours (Default when null).

DrawCentered(IRenderer, BitmapFont, ActionPrompts, string, float, float, Color, Color?, PromptGlyphStyle?)

Draws template centred horizontally on centerX.

C#
public static void DrawCentered(IRenderer r, BitmapFont font, ActionPrompts prompts, string template, float centerX, float y, Color color, Color? shadow = null, PromptGlyphStyle? style = null)

Parameters

r IRenderer

font BitmapFont

prompts ActionPrompts

template string

centerX float

y float

color Color

shadow Color?

style PromptGlyphStyle?

DrawGlyph(IRenderer, BitmapFont, ActionPrompt, Vector2, PromptGlyphStyle?)

Draws one prompt with its top-left at position: a key cap for a key, a round button for a gamepad face button (in its colour on Xbox and Nintendo pads), a pill for other gamepad controls, a ring for a touch control, plain text for a label.

C#
public static void DrawGlyph(IRenderer r, BitmapFont font, ActionPrompt prompt, Vector2 position, PromptGlyphStyle? style = null)

Parameters

r IRenderer

font BitmapFont

prompt ActionPrompt

position Vector2

style PromptGlyphStyle?

GlyphWidth(BitmapFont, ActionPrompt)

Width of one prompt’s glyph in pixels.

C#
public static int GlyphWidth(BitmapFont font, ActionPrompt prompt)

Parameters

font BitmapFont

prompt ActionPrompt

Returns

int

Measure(BitmapFont, ActionPrompts, string)

Width of template drawn by Draw, in pixels (one line).

C#
public static int Measure(BitmapFont font, ActionPrompts prompts, string template)

Parameters

font BitmapFont

prompts ActionPrompts

template string

Returns

int