コード例 #1
0
void OscSendingDevice::sendEvent(const osgGA::Event &ea)
{
    bool msg_sent(false);
    unsigned int num_messages = _numMessagesPerEvent;
    
    const osgGA::GUIEventAdapter* ui_event(ea.asGUIEventAdapter());
    
    if(ui_event && ((ui_event->getEventType() == osgGA::GUIEventAdapter::DRAG) || (ui_event->getEventType() == osgGA::GUIEventAdapter::MOVE)))
        num_messages = 1;
    
    for(unsigned int i = 0; i < num_messages; ++i) {
        msg_sent = ui_event ? sendUIEventImpl(*ui_event, _msgId) : sendEventImpl(ea, _msgId);
        if ((_delayBetweenSendsInMilliSecs > 0) && (i < num_messages-1))
            OpenThreads::Thread::microSleep(1000 * _delayBetweenSendsInMilliSecs);
    }
    if (_finishMultiTouchSequence)
    {
        // if the last touch-point ended we'll need to send an empty tuio-bundle, so the receiver gets a chance to clean up
        
        _msgId++;
        for(unsigned int i = 0; i < num_messages; ++i) {
            beginBundle(_msgId);
            beginMultiTouchSequence();
            _oscStream << osc::EndBundle;
            _transmitSocket.Send( _oscStream.Data(), _oscStream.Size() );
            _oscStream.Clear();
        }
        _finishMultiTouchSequence = false;
    }

    if (msg_sent)
        _msgId++;
}
コード例 #2
0
void OscSendingDevice::sendEvent(const osgGA::Event &ea)
{
    bool msg_sent(false);
    unsigned int num_messages = _numMessagesPerEvent;
    
    const osgGA::GUIEventAdapter* ui_event(ea.asGUIEventAdapter());
    
    if(ui_event && ((ui_event->getEventType() == osgGA::GUIEventAdapter::DRAG) || (ui_event->getEventType() == osgGA::GUIEventAdapter::MOVE)))
        num_messages = 1;
    
    for(unsigned int i = 0; i < num_messages; ++i) {
        msg_sent = ui_event ? sendUIEventImpl(*ui_event, _msgId) : sendEventImpl(ea, _msgId);
        if ((_delayBetweenSendsInMilliSecs > 0) && (i < num_messages-1))
            OpenThreads::Thread::microSleep(1000 * _delayBetweenSendsInMilliSecs);
    }
    if (msg_sent)
        _msgId++;
}