Game Development Reference
In-Depth Information
int FFlag;
double FTimeStamp;
sTouchPoint(int ID, const vec2& C, int flag, double
tstamp):
FID(ID), FPoint(c), FFlag(flag), FTimeStamp(tstamp) {}
13. Check if this touch point is active:
inline bool IsPressed() const
{
return (FFlag == MOTION_MOVE) || (FFlag ==
MOTION_DOWN);
}
};
14. The Viewport_UpdateTouchPoint() function either adds the point to the list,
or just updates the state depending on the motion lag:
void Viewport_UpdateTouchPoint(const sTouchPoint& pt)
{
std::list<sTouchPoint>::iterator foundIt =
FTouchPoints.end();
for ( auto it = FTouchPoints.begin(); it != foundIt;
++it )
{
if ( it->FID == pt.FID )
{
foundIt = it;
break;
}
}
switch ( pt.FFlag )
{
case MOTION_DOWN:
if ( foundIt == FTouchPoints.end() )
FTouchPoints.push_back( pt );
case MOTION_UP:
case MOTION_MOVE:
if ( foundIt != FTouchPoints.end() )
*foundIt = pt;
break;
}
}
 
Search WWH ::




Custom Search