本文整理汇总了C++中leap::Controller::config方法的典型用法代码示例。如果您正苦于以下问题:C++ Controller::config方法的具体用法?C++ Controller::config怎么用?C++ Controller::config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类leap::Controller
的用法示例。
在下文中一共展示了Controller::config方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Setup
void LeapController::Setup()
{
resetInitParams();
if (leapDevice && leapDevice->isConnected()) return;
leapDevice = Device::create();
leapDevice->connectEventHandler( &LeapController::onFrame, this );
// Enable all gesture types
Leap::Controller* controller = leapDevice->getController();
controller->enableGesture( Leap::Gesture::Type::TYPE_SWIPE );
controller->enableGesture( Leap::Gesture::Type::TYPE_CIRCLE );
// Write gesture config to console
Leap::Config config = controller->config();
// Update config to make gestures easier
config.setFloat( "Gesture.Swipe.MinLength", 30.0f );
config.setFloat( "Gesture.Swipe.MinVelocity", 100.0f );
config.save();
App::get()->getSignalShutdown().connect(bind(&LeapController::Shutdown, this));
App::get()->getSignalUpdate().connect(bind(&LeapController::Update, this));
}
示例2: bounds
GestureApp::GestureApp()
{
mBackgroundBrightness = 0.0f;
mBackgroundColor = Colorf( 0.0f, 0.1f, 0.2f );
mCircleResolution = 32;
mDialBrightness = 0.0f;
mDialPosition = vec2( 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;
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 );
}
}
mDevice = Device::create();
mDevice->connectEventHandler( [ & ]( Leap::Frame frame )
{
mFrame = frame;
} );
// Enable gesture types
Leap::Controller* controller = mDevice->getController();
controller->enableGesture( Leap::Gesture::Type::TYPE_CIRCLE );
controller->enableGesture( Leap::Gesture::Type::TYPE_KEY_TAP );
controller->enableGesture( Leap::Gesture::Type::TYPE_SCREEN_TAP );
controller->enableGesture( Leap::Gesture::Type::TYPE_SWIPE );
// Write gesture config to console
Leap::Config config = controller->config();
console() << "Gesture.Circle.MinRadius: " << config.getFloat( "Gesture.Circle.MinRadius" ) << endl;
console() << "Gesture.Circle.MinArc: " << config.getFloat( "Gesture.Circle.MinArc" ) << endl;
console() << "Gesture.Swipe.MinLength: " << config.getFloat( "Gesture.Swipe.MinLength" ) << endl;
console() << "Gesture.Swipe.MinVelocity: " << config.getFloat( "Gesture.Swipe.MinVelocity" ) << endl;
console() << "Gesture.KeyTap.MinDownVelocity: " << config.getFloat( "Gesture.KeyTap.MinDownVelocity" ) << endl;
console() << "Gesture.KeyTap.HistorySeconds: " << config.getFloat( "Gesture.KeyTap.HistorySeconds" ) << endl;
console() << "Gesture.KeyTap.MinDistance: " << config.getFloat( "Gesture.KeyTap.MinDistance" ) << endl;
console() << "Gesture.ScreenTap.MinForwardVelocity: " << config.getFloat( "Gesture.ScreenTap.MinForwardVelocity" ) << endl;
console() << "Gesture.ScreenTap.HistorySeconds: " << config.getFloat( "Gesture.ScreenTap.HistorySeconds" ) << endl;
console() << "Gesture.ScreenTap.MinDistance: " << config.getFloat( "Gesture.ScreenTap.MinDistance" ) << endl;
// Update config to make gestures easier
config.setFloat( "Gesture.Circle.MinRadius", 2.5f );
config.setFloat( "Gesture.Circle.MinArc", 3.0f );
config.setFloat( "Gesture.Swipe.MinLength", 75.0f );
config.setFloat( "Gesture.Swipe.MinVelocity", 500.0f );
config.setFloat( "Gesture.KeyTap.MinDownVelocity", 25.0f );
// Allows app to run in background
controller->setPolicyFlags( Leap::Controller::PolicyFlag::POLICY_BACKGROUND_FRAMES );
mFrameRate = 0.0f;
mFullScreen = false;
mParams = params::InterfaceGl::create( "Params", ivec2( 200, 105 ) );
mParams->addParam( "Frame rate", &mFrameRate, "", true );
mParams->addParam( "Full screen", &mFullScreen ).key( "f" );
mParams->addButton( "Screen shot", [ & ]() { screenShot(); }, "key=space" );
mParams->addButton( "Quit", [ & ]() { quit(); }, "key=q" );
gl::enableVerticalSync();
}