示例#1
0
void TUIOInputDevice::processUserID(ReceivedMessageArgumentStream& args)
{
    osc::int32 tuioID;
    osc::int32 userID;
    osc::int32 jointID;
    args >> tuioID >> userID >> jointID;
    TouchStatusPtr pTouchStatus = getTouchStatus(tuioID);
    if (!pTouchStatus) {
        AVG_TRACE(Logger::category::EVENTS, Logger::severity::WARNING,
                "Received /tuioext/userid, but tuio id " << tuioID <<
                " doesn't correspond to a contact.");
        return;
    }
    CursorEventPtr pEvent = pTouchStatus->getLastEvent();
    pEvent->setUserID(userID, jointID);
}
示例#2
0
void TUIOInputDevice::processAlive(ReceivedMessageArgumentStream& args, 
        Event::Source source)
{
    std::set<int> liveTUIOIDs;
    int32 tuioID;
    while (!args.Eos()) {
        args >> tuioID;
        liveTUIOIDs.insert(tuioID);
    }

    // Create up events for all ids not in live list.
    set<int> deadTUIOIDs;
    getDeadIDs(liveTUIOIDs, deadTUIOIDs, source);
    set<int>::iterator it;
    for (it = deadTUIOIDs.begin(); it != deadTUIOIDs.end(); ++it) {
        int id = *it;
        TouchStatusPtr pTouchStatus = getTouchStatus(id);
        CursorEventPtr pOldEvent = pTouchStatus->getLastEvent();
        CursorEventPtr pUpEvent = pOldEvent->cloneAs(Event::CURSOR_UP);
        pTouchStatus->pushEvent(pUpEvent);
        removeTouchStatus(id);
    }
}