Created
July 19, 2013 13:25
-
-
Save AngryAnt/6039082 to your computer and use it in GitHub Desktop.
Example of an OnGesture handler - handling left and right swipes as served up by the TouchGestures component.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void OnGesture (Gesture gesture) | |
{ | |
switch (gesture.type) | |
{ | |
case GestureType.Swipe: | |
if (Vector2.Dot (gesture.direction, new Vector2 (1.0f, 0.0f)) > 0.8f) | |
{ | |
Previous (); | |
} | |
else if (Vector2.Dot (gesture.direction, new Vector2 (-1.0f, 0.0f)) > 0.8f) | |
{ | |
Next (); | |
} | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment