Skip to content

InputAPI reference

Class TouchControl

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

One on-screen control of a TouchLayout. Positions and sizes are density-independent pixels (dp, 1/160 inch), so a control keeps its physical size on any screen; the layout shrinks everything when a screen is too small.

C#
public abstract record TouchControl : IEquatable<TouchControl>

Inheritance

object ← TouchControl

Derived

TouchButton, TouchDPad, TouchStick

Implements

IEquatable<TouchControl>

Constructors

TouchControl(string)

One on-screen control of a TouchLayout. Positions and sizes are density-independent pixels (dp, 1/160 inch), so a control keeps its physical size on any screen; the layout shrinks everything when a screen is too small.

C#
protected TouchControl(string Id)

Parameters

Id string

Names the control for SetVisible, scripts and tests.

TouchControl(TouchControl)

C#
protected TouchControl(TouchControl original)

Parameters

original TouchControl

Properties

Anchor

The corner or edge of the safe area the control is placed from.

C#
public TouchAnchor Anchor { get; init; }

Property Value

TouchAnchor

EqualityContract

C#
protected virtual Type EqualityContract { get; }

Property Value

Type

Id

Names the control for SetVisible, scripts and tests.

C#
public string Id { get; init; }

Property Value

string

Offset

Centre of the control from its anchor, in dp, pointing into the screen (x from the anchored side, y from the anchored edge).

C#
public Vector2 Offset { get; init; }

Property Value

Vector2

Radius

Radius of the drawn control in dp; 0 uses the kind’s default.

C#
public float Radius { get; init; }

Property Value

float

Style

How this control looks (null: its kind’s style in the layout). Changes the drawing only, never the hit area.

C#
public TouchStyle? Style { get; init; }

Property Value

TouchStyle?

Visible

Shown and touchable when the layout starts (see SetVisible).

C#
public bool Visible { get; init; }

Property Value

bool

Methods

<Clone>$()

C#
public abstract TouchControl <Clone>$()

Returns

TouchControl

Deconstruct(out string)

C#
public void Deconstruct(out string Id)

Parameters

Id string

Equals(object?)

C#
public override bool Equals(object? obj)

Parameters

obj object?

Returns

bool

Equals(TouchControl?)

C#
public virtual bool Equals(TouchControl? other)

Parameters

other TouchControl?

Returns

bool

GetHashCode()

C#
public override int GetHashCode()

Returns

int

PrintMembers(StringBuilder)

C#
protected virtual bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

ToString()

C#
public override string ToString()

Returns

string

Operators

operator ==(TouchControl?, TouchControl?)

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

Parameters

left TouchControl?

right TouchControl?

Returns

bool

operator !=(TouchControl?, TouchControl?)

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

Parameters

left TouchControl?

right TouchControl?

Returns

bool