O'Reilly logo

Android NDK Game Development Cookbook by Viktor Latypov, Sergey Kosarevsky

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Recognizing gestures

In this recipe, we implement a function which detects pinch-zoom-rotate and fling/swipe gestures. It can serve as a starting point for recognition of your own custom gestures.

Getting ready

This recipe relies on the recipe Processing multi-touch events on Android from this chapter to handle multi-touch input.

How to do it...

  1. We split the task of motion decoding into individual layers. The low-level code handles the OS-generated touch events. Collected touch point data is processed using a set of routines in the mid-level code, which we present in this recipe. Finally, all the decoded gestures are reported to the user's high-level code using the simple iGestureResponder interface:
    class iGestureResponder
    {
    public:
  2. The Event_UpdateGesture() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required