当前位置: 首页>>代码示例>>C++>>正文


C++ Gesture::isValid方法代码示例

本文整理汇总了C++中Gesture::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ Gesture::isValid方法的具体用法?C++ Gesture::isValid怎么用?C++ Gesture::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gesture的用法示例。


在下文中一共展示了Gesture::isValid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: selfInteractionEnded

//--------------------------------------------------------------
void CloudsVisualSystemYellowTail::selfInteractionEnded(CloudsInteractionEventArgs& args){
    int touchId = args.playerId;
	
    map<int,Gesture *>::iterator G = gestureForTouch.find(touchId);
    	//JG removed asserts as they are a stability problem
	//assert(G != gestureForTouch.end());
	if(G == gestureForTouch.end()){
		return;
	}
    
	Gesture *gesture = G->second;
    
    gestureForTouch.erase(G);
    potentialGestures.erase(find(potentialGestures.begin(), potentialGestures.end(), gesture));
    
    if (gesture->isValid()) {
        gestures.push_back(gesture);
    } else {
        delete gesture;
    }
}
开发者ID:SethGibson,项目名称:CLOUDS,代码行数:22,代码来源:CloudsVisualSystemYellowTail.cpp

示例2: sendGesture

/*----------------------------------------------------------------------------------------------------*/
void Gestures::sendGesture(const Gesture& pGesture) {
    if ( !pGesture.isValid() ) {
        return;
    }

    Gesture::Type type = pGesture.type();
    Gesture::State state = pGesture.state();
    int64_t duration = pGesture.duration();

    Leap::Vector position;
    Leap::Vector direction;
    float progress = 0;
    float speed = 0;
    float radius = 0;
    std::string typeKey;
    std::string stateName;

    ////

    if ( type == Gesture::TYPE_CIRCLE ) {
        CircleGesture circle = (CircleGesture)pGesture;
        position = circle.center();
        progress = circle.progress();
        radius = circle.radius();
        typeKey = GestureKey::Circle;
    }
    else if ( type == Gesture::TYPE_SWIPE ) {
        SwipeGesture swipe = (SwipeGesture)pGesture;
        position = swipe.startPosition();
        direction = swipe.direction();
        speed = swipe.speed();
        typeKey = GestureKey::Swipe;
    }
    else if ( type == Gesture::TYPE_KEY_TAP ) {
        KeyTapGesture keyTap = (KeyTapGesture)pGesture;
        position = keyTap.position();
        direction = keyTap.direction();
        progress = keyTap.progress();
        typeKey = GestureKey::KeyTap;
    }
    else if ( type == Gesture::TYPE_SCREEN_TAP ) {
        ScreenTapGesture screenTap = (ScreenTapGesture)pGesture;
        position = screenTap.position();
        direction = screenTap.direction();
        progress = screenTap.progress();
        typeKey = GestureKey::ScreenTap;
    }
    else {
        std::cout << "[LEAP] Unsupported gesture type: " << type << std::endl;
        return;
    }

    ////

    switch ( state ) {
    case Gesture::STATE_INVALID:
        stateName = "Invalid";
        break;

    case Gesture::STATE_START:
        stateName = "Start";
        break;

    case Gesture::STATE_UPDATE:
        stateName = "Update";
        break;

    case Gesture::STATE_STOP:
        stateName = "Stop";
        break;

    default:
        std::cout << "[LEAP] Unsupported state type: " << state << std::endl;
        return;
    }

    ////

    std::cout << "GESTURE MESSAGE" <<
              "\n - type: " << type << " (" << typeKey << ")" <<
              "\n - stat: " << state << " (" << stateName << ")" <<
              "\n - dura: " << duration <<
              "\n - pos:  " << position <<
              "\n - dir:  " << direction <<
              "\n - prog: " << progress <<
              "\n - radi: " << radius <<
              "\n - spd:  " << speed <<
              "\n" << std::endl;
}
开发者ID:itguy327,项目名称:OSVR-Leap-Motion,代码行数:90,代码来源:Gestures.cpp


注:本文中的Gesture::isValid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。