Struct TouchFingerEvent
Represents an event that occurs when a finger is placed on, moved on, lifted from, or canceled on a touch device
public struct TouchFingerEvent : ICommonEvent<TouchFingerEvent>, ICommonEvent, ISpanFormattable, IFormattable
- Implements
- Inherited Members
Remarks
Associated EventTypes:
Properties
DX
Gets or sets the change in X position of the finger on the touch device
public float DX { readonly get; set; }
Property Value
- float
The change in X position of the finger on the touch device, normalized between
-1and1, where-1is a tranversal all the way from the right edge to the left edge, and1is a transversal all the way from the left edge to the right edge
DY
Gets or sets the change in Y position of the finger on the touch device
public float DY { readonly get; set; }
Property Value
- float
The change in Y position of the finger on the touch device, normalized between
-1and1, where-1is a tranversal all the way from the bottom edge to the top edge, and1is a transversal all the way from the top edge to the bottom edge
FingerId
Gets or sets the finger ID for the Finger associated with the event
public ulong FingerId { readonly get; set; }
Property Value
- ulong
The finger ID for the Finger associated with the event
Pressure
Gets or sets the pressure of the finger applied on the touch device
public float Pressure { readonly get; set; }
Property Value
- float
The pressure of the finger applied on the touch device, normalized between
0and1, where0is no pressure and1is maximum pressure
Timestamp
Gets or sets the timestamp of the current event
public ulong Timestamp { readonly get; set; }
Property Value
- ulong
The timestamp of the current event, in nanoseconds in nanoseconds since the initialization of SDL
Remarks
The value of this property usually describes the time passed, in nanoseconds since the initialization of SDL. It can be properly populated by using NanosecondTicks.
TouchId
Gets or sets the touch device ID for the TouchDevice associated with the event
public ulong TouchId { readonly get; set; }
Property Value
- ulong
The touch device ID for the TouchDevice associated with the event
Type
Gets or sets the type of the current event
public EventType Type { readonly get; set; }
Property Value
Remarks
When setting this property, the value must be either FingerDown, FingerUp, FingerMotion, or FingerCanceled. Otherwise, it will lead the property to throw an ArgumentException!
Exceptions
- ArgumentException
When setting this property, the value was neither FingerDown, FingerUp, FingerMotion, nor FingerCanceled
WindowId
Gets or sets the window Id of the Window underneath the finger, if any
public uint WindowId { readonly get; set; }
Property Value
- uint
The window Id of the Window underneath the finger, if any, or
0
X
Gets or sets the X position of the finger on the touch device
public float X { readonly get; set; }
Property Value
- float
The X position of the finger on the touch device, normalized between
0and1, where0is the left edge and1is the right edge
Remarks
Note that while the coordinates are normalized, they are not clamped, which means in some circumstances you can get a value outside of this range. For example, a renderer using logical presentation might give a negative value when the touch is in the letterboxing. Some platforms might report a touch outside of the window, which will also be outside of the range.
Y
Gets or sets the Y position of the finger on the touch device
public float Y { readonly get; set; }
Property Value
- float
The Y position of the finger on the touch device, normalized between
0and1, where0is the top edge and1is the bottom edge
Remarks
Note that while the coordinates are normalized, they are not clamped, which means in some circumstances you can get a value outside of this range. For example, a renderer using logical presentation might give a negative value when the touch is in the letterboxing. Some platforms might report a touch outside of the window, which will also be outside of the range.
Methods
ToString()
Returns the fully qualified type name of this instance.
public override readonly string ToString()
Returns
- string
The fully qualified type name.
ToString(IFormatProvider?)
Formats the value of the current instance using the specified format.
public readonly string ToString(IFormatProvider? formatProvider)
Parameters
formatProviderIFormatProviderThe provider to use to format the value.
-or-
A null reference (
Nothingin Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.
Returns
- string
The value of the current instance in the specified format.
ToString(string?)
Formats the value of the current instance using the specified format.
public readonly string ToString(string? format)
Parameters
formatstringThe format to use.
-or-
A null reference (
Nothingin Visual Basic) to use the default format defined for the type of the IFormattable implementation.
Returns
- string
The value of the current instance in the specified format.
ToString(string?, IFormatProvider?)
Formats the value of the current instance using the specified format.
public readonly string ToString(string? format, IFormatProvider? formatProvider)
Parameters
formatstringThe format to use.
-or-
A null reference (
Nothingin Visual Basic) to use the default format defined for the type of the IFormattable implementation.formatProviderIFormatProviderThe provider to use to format the value.
-or-
A null reference (
Nothingin Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.
Returns
- string
The value of the current instance in the specified format.
TryFormat(Span<char>, out int, ReadOnlySpan<char>, IFormatProvider?)
Tries to format the value of the current instance into the provided span of characters.
public readonly bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
Parameters
destinationSpan<char>The span in which to write this instance's value formatted as a span of characters.
charsWrittenintWhen this method returns, contains the number of characters that were written in
destination.formatReadOnlySpan<char>A span containing the characters that represent a standard or custom format string that defines the acceptable format for
destination.providerIFormatProviderAn optional object that supplies culture-specific formatting information for
destination.
Returns
Operators
explicit operator TouchFingerEvent(in Event)
Converts a general Event to an event of type TouchFingerEvent
public static explicit operator TouchFingerEvent(in Event @event)
Parameters
eventEventThe general Event to convert to an event of type TouchFingerEvent
Returns
Remarks
The Type of the given event must be either FingerDown, FingerUp, FingerMotion, or FingerCanceled.
Otherwise, it will lead the method to throw an ArgumentException!
Exceptions
- ArgumentException
The Type of the given
eventwas neither FingerDown, FingerUp, FingerMotion, nor FingerCanceled
implicit operator Event(in TouchFingerEvent)
Converts an event of type TouchFingerEvent to a general Event
public static implicit operator Event(in TouchFingerEvent @event)
Parameters
eventTouchFingerEventThe event of type TouchFingerEvent to convert to a general Event
Returns
Remarks
This conversion usually requires the event to be copied into a new general Event structure. Note: This can impact performance!