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


C++ DeviceRef::enableGesture方法代码示例

本文整理汇总了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" );
}
开发者ID:valentebruno,项目名称:Cinder-LeapSdk,代码行数:63,代码来源:GestureApp.cpp


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