Game Development Reference
In-Depth Information
3.
The Event_PointerChanged() and Event_PointerMoved() methods are called
to indicate the changes in individual touches:
virtual void Event_PointerChanged(int PtrID,
const vec2& Pnt, bool Pressed) {}
virtual void Event_PointerMoved(int PtrID, const vec2&
const vec2& Pnt){}
4.
The information about decoded gestures is sent to the iGestureResponder
instance. When the ling/swipe event inishes, the Event_Fling() method is called:
virtual void Event_Fling( const sTouchPoint& Down,
const sTouchPoint& Up ) {}
5.
Using the timestamps in the Up and Down points, the responder may estimate the
speed of the inger movement and decide if the gesture succeeds. The Event_
Drag() method is called when the inger is dragged across the screen:
virtual void Event_Drag( const sTouchPoint& Down,
const sTouchPoint& Current ) {}
6.
The pinch-zoom event is handled using three methods. The Event_PinchStart()
method is called when the gesture starts, Event_PinchStop() is called at the end
of the gesture, and the Event_Pinch() method is called on each update of two
touch points:
virtual void Event_PinchStart( const sTouchPoint& Initial1,
const sTouchPoint& Initial2 ) {}
virtual void Event_Pinch( const sTouchPoint& Initial1,
const sTouchPoint& Initial2,
const sTouchPoint& Current1,
const sTouchPoint& Current2 ) {}
virtual void Event_PinchStop( const sTouchPoint& Initial1,
const sTouchPoint& Initial2,
const sTouchPoint& Current1,
const sTouchPoint& Current2 ) {};
};
7.
Let's get to the mid-level routines to decode gestures. First, declare an instance
of iGestureResponder which is used later:
iGestureResponder* g_Responder;
8.
We introduce the sMotionData structure, which describes the current gesture
state. Individual touch point features are accessed with the Get* functions. The
AddTouchPoint() function ensures no points with duplicate IDs are added:
struct sMotionData
{
sMotionData(): FTouchPoints() {};
void Clear() { FTouchPoints.clear(); };
 
Search WWH ::




Custom Search