Gary O' Donoghue
Gary O' Donoghue

Reputation: 372

Prolonged Touch gesture

Im trying to develop my first Windows Phone 8 game using XNA, and want to pick up when a user has their finger held down on the screen for a long period of time. There are some gestures available, such as Tap and Hold:

http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff967546(v=vs.105).aspx

but none of these seem to continuously pick up the event for as long as the user has their finger held down, only the initial event and another for after a second i think.

Does anyone know if there is custom gesture recognition available for this sort of thing or know of a way of getting around this?

Any help would be appreciated, thanks

Upvotes: 0

Views: 94

Answers (1)

Andrew Russell
Andrew Russell

Reputation: 27205

Instead of using gestures, use the raw touch data and process it yourself.

Use TouchPanel.GetState() to get the input for the current frame. This comes as a collection of TouchLocations.

Use its Position, Id and State members to check that there is a single touch on the screen, and that it is remaining within some radius of its start point. If it is, then on that frame the touch is being held down.

Upvotes: 1

Related Questions