本文整理汇总了C++中leapsdk::DeviceRef::enableGesture方法的典型用法代码示例。如果您正苦于以下问题:C++ DeviceRef::enableGesture方法的具体用法?C++ DeviceRef::enableGesture怎么用?C++ DeviceRef::enableGesture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类leapsdk::DeviceRef
的用法示例。
在下文中一共展示了DeviceRef::enableGesture方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
// Set up
void GestureApp::setup()
{
// Set up OpenGL
gl::enable( GL_POLYGON_SMOOTH );
glHint( GL_POLYGON_SMOOTH_HINT, GL_NICEST );
// UI
mBackgroundBrightness = 0.0f;
mBackgroundColor = Colorf( 0.0f, 0.1f, 0.2f );
mCircleResolution = 32;
mDialBrightness = 0.0f;
mDialPosition = Vec2f( 155.0f, 230.0f );
mDialRadius = 120.0f;
mDialSpeed = 0.21f;
mDialValue = 0.0f;
mDialValueDest = mDialValue;
mDotRadius = 3.0f;
mDotSpacing = mDotRadius * 3.0f;
mFadeSpeed = 0.95f;
mKeySpacing = 25.0f;
mKeyRect = Rectf( mKeySpacing, 360.0f + mKeySpacing, 600.0f, 600.0f );
mKeySize = 60.0f;
mPointableRadius = 15.0f;
mSwipeBrightness = 0.0f;
mSwipePos = 0.0f;
mSwipePosDest = mSwipePos;
mSwipePosSpeed = 0.33f;
mSwipeRect = Rectf( 310.0f, 100.0f, 595.0f, 360.0f );
mSwipeStep = 0.033f;
// Sets master offset
resize();
// Lay out keys
float spacing = mKeySize + mKeySpacing;
for ( float y = mKeyRect.y1; y < mKeyRect.y2; y += spacing ) {
for ( float x = mKeyRect.x1; x < mKeyRect.x2; x += spacing ) {
Rectf bounds( x, y, x + mKeySize, y + mKeySize );
Key key( bounds );
mKeys.push_back( key );
}
}
// Start device
mLeap = Device::create();
mCallbackId = mLeap->addCallback( &GestureApp::onFrame, this );
// Enable all gesture types
mLeap->enableGesture( Gesture::Type::TYPE_CIRCLE );
mLeap->enableGesture( Gesture::Type::TYPE_KEY_TAP );
mLeap->enableGesture( Gesture::Type::TYPE_SCREEN_TAP );
mLeap->enableGesture( Gesture::Type::TYPE_SWIPE );
// Params
mFrameRate = 0.0f;
mFullScreen = false;
mParams = params::InterfaceGl( "Params", Vec2i( 200, 105 ) );
mParams.addParam( "Frame rate", &mFrameRate, "", true );
mParams.addParam( "Full screen", &mFullScreen, "key=f" );
mParams.addButton( "Screen shot", bind( &GestureApp::screenShot, this ), "key=space" );
mParams.addButton( "Quit", bind( &GestureApp::quit, this ), "key=q" );
}