Game Development Reference
In-Depth Information
20. Depending on the motion lag, we inform the responder about individual touches:
switch ( Flag )
{
case MOTION_MOVE:
g_Responder->Event_PointerMoved( ContactID, Pos );
break;
case MOTION_UP:
case MOTION_DOWN:
g_Responder->Event_PointerChanged( ContactID, Pos,
Flag == MOTION_DOWN );
break;
}
}
21. The UpdateGesture() function does all the job of detection. It checks the current
state of the gesture and calls the methods of the g_Responder object if any of the
gestures are in progress:
void UpdateGesture()
{
const sTouchPoint& Pt1 = FInitialPoint;
const sTouchPoint& Pt2 = FCurrentPoint;
g_Responder->Event_UpdateGesture( FMotionData );
22. The drag-and-pinch gestures are checked in the IsDraggingValid() and
IsPinchZoomValid() methods, which are described a bit later. We respond to a
single point drag, if the inger has travelled more than a speciied distance:
if ( IsDraggingValid() )
{
if ( GetPositionDelta().Length() >
FlingThresholdSensitivity )
{
g_Responder->Event_Drag( Pt1, Pt2 );
FFlingWasValid = true;
}
}
else if ( FFlingWasValid )
{
if ( GetPositionDelta().Length() >
FlingStartSensitivity )
g_Responder->Event_Fling( Pt1, Pt2 );
else
g_Responder->Event_Drag( Pt1, Pt2 );
FFlingWasValid = false;
}
 
Search WWH ::




Custom Search