KernelAPI reference
Class HeadlessTouchScreen
Namespace: MicroEngine.Core
Assembly: MicroEngine.dll
Guide: Game lifecycle and time
A touch screen for tests: fingers go down, move and lift by hand, the size, safe area and density can change (a rotation, a notch), vibrations are counted, and DrawOverlay records what the overlay draws.
public sealed class HeadlessTouchScreen : ITouchScreenInheritance
Implements
Constructors
HeadlessTouchScreen(Vector2)
A touch screen for tests: fingers go down, move and lift by hand, the size, safe area and density can change (a rotation, a notch), vibrations are counted, and DrawOverlay records what the overlay draws.
public HeadlessTouchScreen(Vector2 size)Parameters
size Vector2
Properties
CanVibrate
Whether Vibrate can do anything here.
public bool CanVibrate { get; set; }Property Value
Overlay
Drawn over the letterboxed game in screen pixels after every frame (never in captures).
public ITouchOverlay? Overlay { get; set; }Property Value
PixelsPerDp
Pixels per density-independent pixel (1/160 inch): 1 on a classic desktop display, 2-4 on phones.
public float PixelsPerDp { get; set; }Property Value
SafeArea
Defaults to the whole screen.
public RectF SafeArea { get; set; }Property Value
Size
Drawable size in pixels.
public Vector2 Size { get; set; }Property Value
TouchFirst
Whether touch is the main way to play here (a phone, a tablet, a touch-only browser).
public bool TouchFirst { get; set; }Property Value
Vibrations
Successful Vibrate calls so far.
public int Vibrations { get; }Property Value
Methods
Cancel(long)
Cancels finger, as the system does when the game loses the screen.
public void Cancel(long finger)Parameters
finger long
Down(long, float, float)
Puts finger down at (x, y) in screen pixels; delivered at the next read.
public void Down(long finger, float x, float y)Parameters
finger long
x float
y float
Down(long, Vector2)
Puts finger down at at in screen pixels.
public void Down(long finger, Vector2 at)Parameters
finger long
at Vector2
DrawOverlay()
Draws the overlay into a recorder and returns what it drew.
public RecordingOverlayCanvas DrawOverlay()Returns
Move(long, Vector2)
Moves finger to at.
public void Move(long finger, Vector2 at)Parameters
finger long
at Vector2
ReadTouches(List<TouchEvent>)
Moves every touch event since the previous call into events, oldest first.
public void ReadTouches(List<TouchEvent> events)Parameters
events List<TouchEvent>
Up(long, Vector2)
Lifts finger.
public void Up(long finger, Vector2 at = default)Parameters
finger long
at Vector2
Vibrate(float, int)
Counts the vibration in Vibrations; false when CanVibrate is false.
public bool Vibrate(float strength, int milliseconds)Parameters
strength float
milliseconds int