Skip to content

InputAPI reference

Interface ITouchScreen

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

A screen that may be touched, a capability a backend offers (TryGetCapability``1): its drawable size, the area free of notches, rounded corners and system bars, its density, the touches since the last frame, and a layer drawn over the game for on-screen controls. Coordinates are drawable pixels with the origin at the top left. SDL reports phones and touch screens, the browser host reports Pointer Events, the headless platform lets tests touch it (HeadlessTouchScreen).

C#
public interface ITouchScreen

Properties

CanVibrate

Whether Vibrate can do anything here.

C#
bool CanVibrate { get; }

Property Value

bool

Overlay

Drawn over the letterboxed game in screen pixels after every frame (never in captures).

C#
ITouchOverlay? Overlay { get; set; }

Property Value

ITouchOverlay?

PixelsPerDp

Pixels per density-independent pixel (1/160 inch): 1 on a classic desktop display, 2-4 on phones.

C#
float PixelsPerDp { get; }

Property Value

float

SafeArea

The part of Size no notch, rounded corner or system bar covers.

C#
RectF SafeArea { get; }

Property Value

RectF

Size

Drawable size in pixels.

C#
Vector2 Size { get; }

Property Value

Vector2

TouchFirst

Whether touch is the main way to play here (a phone, a tablet, a touch-only browser).

C#
bool TouchFirst { get; }

Property Value

bool

Methods

ReadTouches(List<TouchEvent>)

Moves every touch event since the previous call into events, oldest first.

C#
void ReadTouches(List<TouchEvent> events)

Parameters

events List<TouchEvent>

Vibrate(float, int)

A short vibration (strength 0..1). Returns false when the device cannot vibrate.

C#
bool Vibrate(float strength, int milliseconds)

Parameters

strength float

milliseconds int

Returns

bool