Table of Contents

Struct TouchLocation

Namespace
Microsoft.Xna.Framework.Input.Touch
Assembly
MonoGame.Framework.dll

Provides methods and properties for interacting with a touch location on a touch screen device.

public struct TouchLocation : IEquatable<TouchLocation>
Implements
Inherited Members

Constructors

TouchLocation(int, TouchLocationState, Vector2)

Initializes a new instance of the TouchLocation structure.

public TouchLocation(int id, TouchLocationState state, Vector2 position)

Parameters

id int

ID of the touch location.

state TouchLocationState

Current state of the touch location.

position Vector2

Position of the touch location.

TouchLocation(int, TouchLocationState, Vector2, TouchLocationState, Vector2)

Initializes a new instance of the TouchLocation structure.

public TouchLocation(int id, TouchLocationState state, Vector2 position, TouchLocationState previousState, Vector2 previousPosition)

Parameters

id int

ID of the touch location.

state TouchLocationState

Current state of the touch location.

position Vector2

Position of the touch location.

previousState TouchLocationState

Previous state of this touch location.

previousPosition Vector2

Previous position of this touch location.

Properties

Id

Gets the ID of the touch location.

public int Id { get; }

Property Value

int

Position

Gets the position of the touch location.

public Vector2 Position { get; }

Property Value

Vector2

Pressure

Gets the pressure of the touch location.

public float Pressure { get; }

Property Value

float

Remarks

Only used in Android devices

State

Gets the current state of the touch location.

public TouchLocationState State { get; }

Property Value

TouchLocationState

Methods

Equals(TouchLocation)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(TouchLocation other)

Parameters

other TouchLocation

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

IsHighFrequencyEvent()

Returns true if the touch panel is configured to process high frequence touch events.

public bool IsHighFrequencyEvent()

Returns

bool

ToString()

Gets a string representation of the TouchLocation.

public override string ToString()

Returns

string

TryGetPreviousLocation(out TouchLocation)

Attempts to get the previous location of this touch location object.

public bool TryGetPreviousLocation(out TouchLocation aPreviousLocation)

Parameters

aPreviousLocation TouchLocation

Previous location data, as a TouchLocation.

Returns

bool

Operators

operator ==(TouchLocation, TouchLocation)

Returns a value that indicates whether the two values are equal.

public static bool operator ==(TouchLocation value1, TouchLocation value2)

Parameters

value1 TouchLocation

The value on the left of the equality operator.

value2 TouchLocation

The value on the right of the equality operator.

Returns

bool

true if the two values are equal; otherwise, false.

operator !=(TouchLocation, TouchLocation)

Returns a value that indicates whether the two values are not equal.

public static bool operator !=(TouchLocation value1, TouchLocation value2)

Parameters

value1 TouchLocation

The value on the left of the inequality operator.

value2 TouchLocation

The value on the right of the inequality operator.

Returns

bool

true if the two values are not equal; otherwise, false.