InputAPI reference
Class TouchLayout
Namespace: MicroEngine.Input
Assembly: MicroEngine.Input.Touch.dll
Guide: Input
A game’s on-screen controls: which controls, where, and how they look and feel. The same layout is used on phones
(SDL), in mobile browsers and in tests; games return theirs from Game.CreateTouchLayout.
public sealed record TouchLayout : IEquatable<TouchLayout>Inheritance
Implements
Constructors
TouchLayout()
public TouchLayout()Properties
ButtonStyle
How buttons look (null: the default style).
public TouchStyle? ButtonStyle { get; init; }Property Value
Controls
The controls, drawn in order; ids must be unique.
public IReadOnlyList<TouchControl> Controls { get; init; }Property Value
DPadStyle
How d-pads look (null: the default style).
public TouchStyle? DPadStyle { get; init; }Property Value
Haptics
A short vibration on each press where the device can vibrate.
public bool Haptics { get; init; }Property Value
HitScale
The touchable area as a multiple of the drawn radius (overlaps go to the nearest control).
public float HitScale { get; init; }Property Value
Opacity
Opacity of idle controls, 0..1. Pressed controls are always more opaque.
public float Opacity { get; init; }Property Value
PressedTint
Fill of a pressed control.
public Color PressedTint { get; init; }Property Value
Scale
Size factor on top of the screen’s density (a player setting).
public float Scale { get; init; }Property Value
Skin
Draws the controls (null: DefaultTouchSkin, shaped by the styles). Replace it for a look styles cannot give.
public ITouchSkin? Skin { get; init; }Property Value
SlideBetweenButtons
Whether a finger that slides onto another button presses it instead (fire-and-jump rolls); toggle buttons are never slid onto.
public bool SlideBetweenButtons { get; init; }Property Value
SlideTolerance
A held button stays pressed until its finger is this many touchable radii from its centre.
public float SlideTolerance { get; init; }Property Value
StickStyle
How joysticks look (null: the default style).
public TouchStyle? StickStyle { get; init; }Property Value
Tint
Colour of outlines and labels.
public Color Tint { get; init; }Property Value
Visibility
When the controls are drawn (automatic by default).
public TouchVisibility Visibility { get; init; }Property Value
Methods
<Clone>$()
public TouchLayout <Clone>$()Returns
CreateDefault(ActionNames?)
The layout for CreateDefault: a d-pad on the left; confirm (A), cancel (B) and
action (C) on the right; pause at the top right. names are the actions they press (null: the
default names); the controls keep the default names as their ids.
public static TouchLayout CreateDefault(ActionNames? names = null)Parameters
names ActionNames?
Returns
Equals(object?)
public override bool Equals(object? obj)Parameters
obj object?
Returns
Equals(TouchLayout?)
public bool Equals(TouchLayout? other)Parameters
other TouchLayout?
Returns
GetHashCode()
public override int GetHashCode()Returns
Of(params TouchControl[])
A layout with these controls and the default look.
public static TouchLayout Of(params TouchControl[] controls)Parameters
controls TouchControl[]
Returns
StyleOf(TouchControl)
The style control is drawn with: its own, else its kind’s, else the default.
public TouchStyle StyleOf(TouchControl control)Parameters
control TouchControl
Returns
ToString()
public override string ToString()Returns
Operators
operator ==(TouchLayout?, TouchLayout?)
public static bool operator ==(TouchLayout? left, TouchLayout? right)Parameters
left TouchLayout?
right TouchLayout?
Returns
operator !=(TouchLayout?, TouchLayout?)
public static bool operator !=(TouchLayout? left, TouchLayout? right)Parameters
left TouchLayout?
right TouchLayout?