Table of Contents

Struct GamepadTouchpadEvent

Namespace
Sdl3Sharp.Events
Assembly
Sdl3Sharp.dll

Represents an event that occurs when a finger interacts with a gamepad touchpad

public struct GamepadTouchpadEvent : ICommonEvent<GamepadTouchpadEvent>, ICommonEvent, ISpanFormattable, IFormattable
Implements
Inherited Members

Remarks

Properties

Finger

Gets or sets the index of the finger on the touchpad

public int Finger { readonly get; set; }

Property Value

int

The index of the finger on the touchpad

JoystickId

Gets or sets the joystick device ID for the Gamepad associated with the event

public uint JoystickId { readonly get; set; }

Property Value

uint

The joystick device ID for the Gamepad associated with the event

Pressure

Gets or sets the pressure of the finger applied on the touchpad

public float Pressure { readonly get; set; }

Property Value

float

The pressure of the finger applied on the touchpad, normalized between 0 and 1, where 0 is no pressure and 1 is 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.

Touchpad

Gets or sets the index of the touchpad on the gamepad

public int Touchpad { readonly get; set; }

Property Value

int

The index of the touchpad on the gamepad

Type

Gets or sets the type of the current event

public EventType Type { readonly get; set; }

Property Value

EventType

The type of the current event

Remarks

When setting this property, the value must be either GamepadTouchpadDown, GamepadTouchpadMotion, or GamepadTouchpadUp. Otherwise, it will lead the property to throw an ArgumentException!

Exceptions

ArgumentException

When setting this property, the value was neither GamepadTouchpadDown, GamepadTouchpadMotion, nor GamepadTouchpadUp

X

Gets or sets the X position of the finger on the touchpad

public float X { readonly get; set; }

Property Value

float

The X position of the finger on the touchpad, normalized between 0 and 1, where 0 is the left edge and 1 is the right edge

Y

Gets or sets the Y position of the finger on the touchpad

public float Y { readonly get; set; }

Property Value

float

The Y position of the finger on the touchpad, normalized between 0 and 1, where 0 is the top edge and 1 is the bottom edge

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

formatProvider IFormatProvider

The provider to use to format the value.

-or-

A null reference (Nothing in 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

format string

The format to use.

-or-

A null reference (Nothing in 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

format string

The format to use.

-or-

A null reference (Nothing in Visual Basic) to use the default format defined for the type of the IFormattable implementation.

formatProvider IFormatProvider

The provider to use to format the value.

-or-

A null reference (Nothing in 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

destination Span<char>

The span in which to write this instance's value formatted as a span of characters.

charsWritten int

When this method returns, contains the number of characters that were written in destination.

format ReadOnlySpan<char>

A span containing the characters that represent a standard or custom format string that defines the acceptable format for destination.

provider IFormatProvider

An optional object that supplies culture-specific formatting information for destination.

Returns

bool

true if the formatting was successful; otherwise, false.

Operators

explicit operator GamepadTouchpadEvent(in Event)

Converts a general Event to an event of type GamepadTouchpadEvent

public static explicit operator GamepadTouchpadEvent(in Event @event)

Parameters

event Event

The general Event to convert to an event of type GamepadTouchpadEvent

Returns

GamepadTouchpadEvent

Remarks

The Type of the given event must be either GamepadTouchpadDown, GamepadTouchpadMotion, or GamepadTouchpadUp. Otherwise, it will lead the method to throw an ArgumentException!

Exceptions

ArgumentException

The Type of the given event was neither GamepadTouchpadDown, GamepadTouchpadMotion, nor GamepadTouchpadUp

implicit operator Event(in GamepadTouchpadEvent)

Converts an event of type GamepadTouchpadEvent to a general Event

public static implicit operator Event(in GamepadTouchpadEvent @event)

Parameters

event GamepadTouchpadEvent

The event of type GamepadTouchpadEvent to convert to a general Event

Returns

Event

Remarks

This conversion usually requires the event to be copied into a new general Event structure. Note: This can impact performance!