Ejemplo n.º 1
0
void CCEGLView::onTouchEvent(const Control& source, TouchStatus status)
{
	IList *pList = null;
    do
    {
        CC_BREAK_IF(!m_pDelegate);
        int i = 0;
    	Touch touch;
    	pList = touch.GetTouchInfoListN(source);

    	CC_BREAK_IF(pList == NULL);

       	int pointerNumber = pList->GetCount();

        CC_BREAK_IF(pointerNumber <= 0);

    	int id[30] = {0};
    	float x[30] = {0};
    	float y[30] = {0};

    	for (i = 0; i < pointerNumber; i++) {
    		TouchInfo *pTouchInfo = static_cast<TouchInfo *>(pList->GetAt(i));
            id[i] = (int)pTouchInfo->id;
            float tmpX = (float)pTouchInfo->position.x;
            float tmpY = (float)pTouchInfo->position.y;
        	if (!m_bNotHVGA)
        	{
        		x[i] = tmpX * 2 / 3;
        		y[i] = tmpY * 2 / 3;
        	}
        	else
        	{
				x[i] = tmpX;
				y[i] = tmpY;
        	}
        }
    	if (TOUCH_PRESSED == status)
    	{
    		onTouchesBegin(id, x, y, pointerNumber);
    	}
    	else if (TOUCH_MOVED == status)
    	{
    		onTouchesMove(id, x, y, pointerNumber);
    	}
    	else if (TOUCH_RELEASED == status)
    	{
    		onTouchesEnd(id, x, y, pointerNumber);
    	}

    } while (0);

    if (pList != null)
    {
   		pList->RemoveAll(true);
    	delete pList;
    }
}
void
TouchEventForm::DisplayMultipointTouchInfo(const Control &source)
{
    Touch touch;
    IList *pList = null;
    pList = touch.GetTouchInfoListN(source);
    if (pList)
    {
        for(int i=0; i<pList->GetCount(); i++ )
        {
            TouchInfo *pTouchInfo = static_cast<TouchInfo *>(pList->GetAt(i));
            AppLog("OnTouchMoved : [%d]%d,%d - %d", pTouchInfo->id, pTouchInfo->position.x ,pTouchInfo->position.y,pTouchInfo->status);
        }
        pList->RemoveAll(true);
        delete pList;
    }
}