本文整理汇总了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;
}
}
示例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;
}