Config类(Leap::Config)

Config类(Leap::Config)
Config类提供了Leap Motion系统配置信息的访问。用由Controller对象得到的Config对象可以得到和设置手势配置参数。确定一个配置参数所需要的关键字符串包括:

这里写图片描述

当设置了配置的值,必须调用Config::save()函数来提交修改。在Controller和服务连接之后你可以保存。换句话说,在Controller分派之后,serviceConnected或者连接的事件或者Controller::isConnected是true。配置的值的改变并不保持,你的应用程序需要在每次运行时都要设置这些值。
enum ValueType: 表示配置值可能的数据类型。
TYPE_UNKNOWN = 0表示数据类型是未知的;
TYPE_BOOLEAN = 1表示布尔值;
TYPE_INT32 =2表示32位整型;
TYPE_FLOAT =6表示浮点数;
TYPE_STRING =8表示一串字符。
ValueType type(const std::string& key): 报告与指定的key相关的值的数据类型。返回的是这个值原始的数据类型,也就是说这个类型不要求数据的转换。
用法:Leap::Config::ValueType dataType = controller.config().type(“Gesture.KeyTap.Min
Distance”);
bool getBool(const std::string& key): 得到指定的key的布尔表示。
用法:bool booleanValue = controller.config().getBool(“Key.For.Bool.Setting”);
bool setBool(const std::string& key): 设置指定的key的布尔表示。
用法:controller.config().setBool(“Key.For.Bool.Setting”,true);
int32_t getInt32(const std::string& key): 得到指定的key的32位整型表示。
用法:int32_t intValue = controller.config().getInt32(“Key.For.Integer.Setting”);
bool setInt32(const std::string& key): 设置指定的key的32位整型表示。
用法:controller.config().setInt32(“Key.For. Integer.Setting”,12);
float getFloat(const std::string& key): 得到指定的key的浮点数表示。
用法:float floatValue = controller.config().getFloat(“Gesture.Swipe.MinLength”);
bool setFloat(const std::string& key): 设置指定的key的浮点数表示。
用法:controller.config().setFloat(“Gesture.Circle.MinRadius”,15);
std::string getString(const std::string& key): 得到指定的key的字符串表示。
用法:std::string stringValue = controller.config().getString(“Key.For.String.Setting”);
bool setString(const std::string& key): 设置指定的key的字符串表示。
用法:controller.config().setString(“Key.For.String.Setting”,”A String”);
Config(): 构造一个Config对象。不要创建你自己的Config对象,用Controller::Config()函数来得到一个Config对象。
用法:Leap::Config config=controller. Config();
bool save(): 保存当前配置状态。在改变了一系列配置之后调用该函数。该函数把配置改变传递给Leap Motion服务。
用法:controller.config().setFloat(“Gesture.Circle.MinRadius”, 15);
controller.config().setFloat(“Gesture.Circle.MinArc”, 1.7);
bool success = controller.config().save();

译自:https://developer.leapmotion.com/documentation/cpp/api/Leap.Config.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值