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.
public static class PromptTextInheritance
Methods
Draw(IRenderer, BitmapFont, ActionPrompts, string, Vector2, Color, Color?, PromptGlyphStyle?)
Draws one line of template with its top-left at position.
public static void Draw(IRenderer r, BitmapFont font, ActionPrompts prompts, string template, Vector2 position, Color color, Color? shadow = null, PromptGlyphStyle? style = null)Parameters
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.
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
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.
public static void DrawGlyph(IRenderer r, BitmapFont font, ActionPrompt prompt, Vector2 position, PromptGlyphStyle? style = null)Parameters
font BitmapFont
prompt ActionPrompt
position Vector2
style PromptGlyphStyle?
GlyphWidth(BitmapFont, ActionPrompt)
Width of one prompt’s glyph in pixels.
public static int GlyphWidth(BitmapFont font, ActionPrompt prompt)Parameters
font BitmapFont
prompt ActionPrompt
Returns
Measure(BitmapFont, ActionPrompts, string)
Width of template drawn by Draw, in pixels (one line).
public static int Measure(BitmapFont font, ActionPrompts prompts, string template)Parameters
font BitmapFont
prompts ActionPrompts
template string