Skip to content

Instantly share code, notes, and snippets.

@AngryAnt
Created July 19, 2013 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AngryAnt/6039082 to your computer and use it in GitHub Desktop.
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.
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