Table of Contents

Struct TouchCollection

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

Provides state information for a touch screen enabled device.

public struct TouchCollection : IList<TouchLocation>, ICollection<TouchLocation>, IEnumerable<TouchLocation>, IEnumerable
Implements
Inherited Members

Constructors

TouchCollection(TouchLocation[])

Initializes a new instance of the TouchCollection with a pre-determined set of touch locations.

public TouchCollection(TouchLocation[] touches)

Parameters

touches TouchLocation[]

Array of TouchLocation items to initialize with.

Properties

Count

Returns the number of TouchLocation items that exist in the collection.

public int Count { get; }

Property Value

int

IsConnected

States if a touch screen is available.

public bool IsConnected { get; }

Property Value

bool

IsReadOnly

States if touch collection is read only.

public bool IsReadOnly { get; }

Property Value

bool

this[int]

Gets or sets the item at the specified index of the collection.

public TouchLocation this[int index] { get; set; }

Parameters

index int

Position of the item.

Property Value

TouchLocation

TouchLocation

Methods

Add(TouchLocation)

Adds a TouchLocation to the collection.

public void Add(TouchLocation item)

Parameters

item TouchLocation

The TouchLocation item to be added.

Clear()

Clears all the items in collection.

public void Clear()

Contains(TouchLocation)

Returns true if specified TouchLocation item exists in the collection, false otherwise./>

public bool Contains(TouchLocation item)

Parameters

item TouchLocation

The TouchLocation item to query for.

Returns

bool

Returns true if queried item is found, false otherwise.

CopyTo(TouchLocation[], int)

Copies the TouchLocationcollection to specified array starting from the given index.

public void CopyTo(TouchLocation[] array, int arrayIndex)

Parameters

array TouchLocation[]

The array to copy TouchLocation items.

arrayIndex int

The starting index of the copy operation.

FindById(int, out TouchLocation)

Returns TouchLocation specified by ID.

public bool FindById(int id, out TouchLocation touchLocation)

Parameters

id int
touchLocation TouchLocation

Returns

bool

GetEnumerator()

Returns an enumerator for the TouchCollection.

public TouchCollection.Enumerator GetEnumerator()

Returns

TouchCollection.Enumerator

Enumerable list of TouchLocation objects.

IndexOf(TouchLocation)

Returns the index of the first occurrence of specified TouchLocation item in the collection.

public int IndexOf(TouchLocation item)

Parameters

item TouchLocation

TouchLocation to query.

Returns

int

Insert(int, TouchLocation)

Inserts a TouchLocation item into the indicated position.

public void Insert(int index, TouchLocation item)

Parameters

index int

The position to insert into.

item TouchLocation

The TouchLocation item to insert.

Remove(TouchLocation)

Removes the specified TouchLocation item from the collection.

public bool Remove(TouchLocation item)

Parameters

item TouchLocation

The TouchLocation item to remove.

Returns

bool

RemoveAt(int)

Removes the TouchLocation item at specified index.

public void RemoveAt(int index)

Parameters

index int

Index of the item that will be removed from collection.