FGF 0.1.2.0 Released with Gesture Recognition

New to the input engine within the Focused Games Framework is the gesture recognition capabilities, housed in the GestureTracker class. The gesture recognition class currently supports a small subset of the gestures I plan on supporting, but all are useful none-the-less. The included gestures are press, two fingered press, swipe, two fingered swipe, zoom and pinch. To use the gesture recognition, instantiate a GestureTracker object, add it to the IGame.Modules list and then listen to its GestureTracked even. You will also need an instance of the InputManager class added to the list of modules.

The following is a small sample taken from one of my games that handles some simple menu swiping (a full sample is on the way).

If you do happen to use FGF, I would love to hear what you think! Drop me a line via the Contact form or leave a comment here.

private void OnGestureTracked(object sender, GestureArgs args)
{
    // If it wasn't a swipe, we don't care!
    if (args.Gesture != Gesture.Swipe) return;

    // Get the direction of the swipe to determine what way
    // the menus should move
    if (args.Direction.X < 0)
    {
        // If we are capped at the right side of the menus, return
        if (current == menus.Length - 1) return;

        // Transition the menus
        menus[current].Transition(Menu.MoveDir.OffToLeft);

        current++;

        menus[current].Transition(Menu.MoveDir.OnFromRight);
    }
    else
    {
        if (current == 0) return;

        menus[current].Transition(Menu.MoveDir.OffToRight);

        current--;

        menus[current].Transition(Menu.MoveDir.OnFromLeft);
    }
}

 Download FGF 0.1.2.0 Bin

Change Log

  • Added gesture recognition
  • Added support for Moved state of Tracs
  • Changed Collection<T> class to implement interfaces directly rather than inherit from List<T>
  • Added angle extensions for Vector2 and Vector3

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>