Game Development Reference
In-Depth Information
There's more...
Windows 8 has introduced the WM_POINTER message, which ensures much cleaner code,
similar to the Android and other touch-based environments. Interested readers may read
the respective MSDN articles ( http://msdn.microsoft.com/en-us/library/
hh454928(v=vs.85).aspx ) and write a similar handler in the window function.
See also
The code for the WM_TOUCH message handling is included in the 1_MultitouchInput
example. The next recipe shows how to decode a sequence of multi-touch events and
recognize some basic gestures.
Recognizing gestures
In this recipe, we implement a function which detects pinch-zoom-rotate and ling/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() method is provided for direct access to the current
state of contact points. The sMotionData structure is presented right after the
iGestureResponder discussion. The 1_MultitouchInput example overrides
this method to render the touch points:
virtual void Event_UpdateGesture(
const sMotionData& Data ) {}
 
Search WWH ::




Custom Search