Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- touchCollection = TouchPanel.GetState();
- if (touchCollection.Count > 0)
- {
- //Only Fire Select Once it's been released
- if (touchCollection[0].State == TouchLocationState.Pressed)
- {
- OldtouchCollection = TouchPanel.GetState();
- Debug.WriteLine("Pressed");
- }
- else if (touchCollection[0].State == TouchLocationState.Moved)
- {
- //Debug.WriteLine("x: " + (touchCollection[0].Position.X - OldtouchCollection[0].Position.X) + " /y: " + (touchCollection[0].Position.Y - OldtouchCollection[0].Position.Y));
- //Debug.WriteLine("Old touch : x: " + OldtouchCollection[0].Position.X + " /y: " + OldtouchCollection[0].Position.Y);
- //Debug.WriteLine("New touch : x: " + touchCollection[0].Position.X + " /y: " + touchCollection[0].Position.Y);
- }else if (touchCollection[0].State == TouchLocationState.Released)
- {
- Vector2 finger = new Vector2(OldtouchCollection[0].Position.X - touchCollection[0].Position.X, OldtouchCollection[0].Position.Y - touchCollection[0].Position.Y);
- if (Math.Abs(finger.X) < 10 && Math.Abs(finger.Y) < 10)
- {
- Debug.WriteLine("Tap !");
- }
- else if (Math.Abs(finger.X) > Math.Abs(finger.Y))
- {
- if (finger.X > 0)
- {
- Debug.WriteLine("Swipe Left");
- }else
- {
- Debug.WriteLine("Swipe Right");
- }
- }else
- {
- if (finger.Y > 0)
- {
- Debug.WriteLine("Swipe Up");
- }
- else
- {
- Debug.WriteLine("Swipe Down");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement