Пример #1
0
void TestHelper::fakeTouchEvent(int id, Event::Type eventType,
        Event::Source source, const glm::vec2& pos, const glm::vec2& speed)
{
    checkEventType(eventType);
    // The id is modified to avoid collisions with real touch events.
    TouchEventPtr pEvent(new TouchEvent(id+std::numeric_limits<int>::max()/2, eventType, 
            IntPoint(pos), source, speed));
    map<int, TouchStatusPtr>::iterator it = m_Touches.find(pEvent->getCursorID());
    switch (pEvent->getType()) {
        case Event::CURSORDOWN: {
                AVG_ASSERT(it == m_Touches.end());
                TouchStatusPtr pTouchStatus(new TouchStatus(pEvent));
                m_Touches[pEvent->getCursorID()] = pTouchStatus;
            }
            break;
        case Event::CURSORMOTION:
        case Event::CURSORUP: {
                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
void TestHelper::fakeTouchEvent(int id, Event::Type eventType,
        Event::Source source, const glm::vec2& pos, const glm::vec2& speed)
{
    checkEventType(eventType);
    // The id is modified to avoid collisions with real touch events.
    TouchEventPtr pEvent(new TouchEvent(id+std::numeric_limits<int>::max()/2, eventType, 
            IntPoint(pos), source, speed));
    processTouchStatus(pEvent);
}
Пример #3
0
void TestHelper::fakeTangibleEvent(int id, int markerID, Event::Type eventType, 
                const glm::vec2& pos, const glm::vec2& speed, float orientation)
{
    checkEventType(eventType);
    // The id is modified to avoid collisions with real events.
    TangibleEventPtr pEvent(new TangibleEvent(id+std::numeric_limits<int>::max()/4, 
            markerID, eventType, IntPoint(pos), speed, orientation));
    processTouchStatus(pEvent);

}
Пример #4
0
void TestHelper::fakeMouseEvent(Event::Type eventType,
        bool leftButtonState, bool middleButtonState, 
        bool rightButtonState,
        int xPosition, int yPosition, int button)
{
    checkEventType(eventType);
    MouseEventPtr pEvent(new MouseEvent(eventType, leftButtonState, 
            middleButtonState, rightButtonState, IntPoint(xPosition, yPosition), button));
    m_Events.push_back(pEvent);
}