Skip to content

InputAPI reference

Class TouchStyle

Namespace: MicroEngine.Input
Assembly: MicroEngine.Input.Touch.dll
Guide: Input

How touch controls look: shape, colours of each state, outline, press feedback and optional images. Only the drawing changes: hit areas, finger tracking and actions stay those of the layout, so a restyled control behaves exactly as before. Colours left null follow Tint and PressedTint. Set one style for every control kind (ButtonStyle, DPadStyle, StickStyle) or for one control (Style).

C#
public sealed record TouchStyle : IEquatable<TouchStyle>

Inheritance

object ← TouchStyle

Implements

IEquatable<TouchStyle>

Constructors

TouchStyle()

C#
public TouchStyle()

Properties

Arrows

For d-pads: whether the four arrows are drawn (an image may already show them).

C#
public bool Arrows { get; init; }

Property Value

bool

Corner

Corner radius of a rounded square, as a fraction of the control’s radius (0..1).

C#
public float Corner { get; init; }

Property Value

float

Fill

Fill of an idle control (null: the tint, faint).

C#
public Color? Fill { get; init; }

Property Value

Color?

Halo

Whether a dark ring is drawn around the outline, so controls stay visible over light scenes.

C#
public bool Halo { get; init; }

Property Value

bool

Image

An image drawn over the control’s square (twice its radius) instead of fill and outline: a sprite button, a d-pad cross, a joystick base. Pixel art scales without blur.

C#
public PixelImage? Image { get; init; }

Property Value

PixelImage?

KnobImage

For joysticks: the knob’s image (null: a disc).

C#
public PixelImage? KnobImage { get; init; }

Property Value

PixelImage?

KnobSize

For joysticks: the knob’s radius as a fraction of the stick’s radius.

C#
public float KnobSize { get; init; }

Property Value

float

Label

Colour of a button’s label (null: the tint, white while pressed).

C#
public Color? Label { get; init; }

Property Value

Color?

Opacity

Opacity of idle controls with this style, 0..1 (null: Opacity).

C#
public float? Opacity { get; init; }

Property Value

float?

Outline

Outline and arrows of an idle control (null: the tint).

C#
public Color? Outline { get; init; }

Property Value

Color?

OutlineWidth

Thickness of the outline in dp (0: none).

C#
public float OutlineWidth { get; init; }

Property Value

float

PressedFill

Fill of a pressed control (null: the pressed tint).

C#
public Color? PressedFill { get; init; }

Property Value

Color?

PressedImage

The image while pressed (null: Image, tinted with the pressed fill).

C#
public PixelImage? PressedImage { get; init; }

Property Value

PixelImage?

PressedOutline

Outline, lit arrows and the joystick’s direction arrow while pressed (null: the tint, brighter, and the pressed tint for arrows).

C#
public Color? PressedOutline { get; init; }

Property Value

Color?

PressedScale

Size of a pressed button relative to an idle one (1: no shrink).

C#
public float PressedScale { get; init; }

Property Value

float

Shape

The outline: a disc or a rounded square.

C#
public TouchShape Shape { get; init; }

Property Value

TouchShape

Methods

<Clone>$()

C#
public TouchStyle <Clone>$()

Returns

TouchStyle

Equals(object?)

C#
public override bool Equals(object? obj)

Parameters

obj object?

Returns

bool

Equals(TouchStyle?)

C#
public bool Equals(TouchStyle? other)

Parameters

other TouchStyle?

Returns

bool

GetHashCode()

C#
public override int GetHashCode()

Returns

int

ToString()

C#
public override string ToString()

Returns

string

Operators

operator ==(TouchStyle?, TouchStyle?)

C#
public static bool operator ==(TouchStyle? left, TouchStyle? right)

Parameters

left TouchStyle?

right TouchStyle?

Returns

bool

operator !=(TouchStyle?, TouchStyle?)

C#
public static bool operator !=(TouchStyle? left, TouchStyle? right)

Parameters

left TouchStyle?

right TouchStyle?

Returns

bool