Пример #1
0
void TestHelper::processTouchStatus(CursorEventPtr pEvent)
{
    map<int, TouchStatusPtr>::iterator it = m_Touches.find(pEvent->getCursorID());
    switch (pEvent->getType()) {
        case Event::CURSOR_DOWN: {
                AVG_ASSERT(it == m_Touches.end());
                TouchStatusPtr pTouchStatus(new TouchStatus(pEvent));
                m_Touches[pEvent->getCursorID()] = pTouchStatus;
            }
            break;
        case Event::CURSOR_MOTION:
        case Event::CURSOR_UP: {
                if (it == m_Touches.end()) {
                    cerr << "borked: " << pEvent->getCursorID() << ", " << 
                            pEvent->typeStr() << endl;
                }
                AVG_ASSERT(it != m_Touches.end());
                TouchStatusPtr pTouchStatus = (*it).second;
                pTouchStatus->pushEvent(pEvent);
            }
            break;
        default:
            AVG_ASSERT(false);
            break;
    }
}
Пример #2
0
Contact::Contact(CursorEventPtr pEvent)
    : Publisher("Contact"),
      m_bSendingEvents(false),
      m_bCurListenerIsDead(false),
      m_CursorID(pEvent->getCursorID()),
      m_DistanceTravelled(0)
{
    m_Events.push_back(pEvent);
}