change join to makeAxis, fix some warnings

This commit is contained in:
Brad Hefta-Gaub 2015-10-17 12:46:05 -07:00
parent e888391e7e
commit 293b7c12e1
3 changed files with 4 additions and 4 deletions

View file

@ -39,7 +39,7 @@ QObject* MappingBuilderProxy::from(const Endpoint::Pointer& source) {
return new RouteBuilderProxy(_parent, _mapping, route);
}
QObject* MappingBuilderProxy::join(const QJSValue& source1, const QJSValue& source2) {
QObject* MappingBuilderProxy::makeAxis(const QJSValue& source1, const QJSValue& source2) {
auto source1Endpoint = _parent.endpointFor(source1);
auto source2Endpoint = _parent.endpointFor(source2);
return from(_parent.compositeEndpointFor(source1Endpoint, source2Endpoint));
@ -82,6 +82,7 @@ QObject* MappingBuilderProxy::from(const QJsonValue& json) {
// Endpoint is defined as an object, we expect a js function then
return nullptr;
}
return nullptr;
}
QObject* MappingBuilderProxy::enable(bool enable) {

View file

@ -33,7 +33,7 @@ public:
Q_INVOKABLE QObject* from(const QJSValue& source);
Q_INVOKABLE QObject* from(const QScriptValue& source);
Q_INVOKABLE QObject* join(const QJSValue& source1, const QJSValue& source2);
Q_INVOKABLE QObject* makeAxis(const QJSValue& source1, const QJSValue& source2);
Q_INVOKABLE QObject* enable(bool enable = true);
Q_INVOKABLE QObject* disable() { return enable(false); }

View file

@ -83,8 +83,7 @@ Column {
mapping.from(function() { return Math.sin(Date.now() / 250); }).to(standard.RX);
// Constrainting a value to -1, 0, or 1, with a deadzone
mapping.from(xbox.LY).deadZone(0.5).constrainToInteger().to(standard.LY);
// change join to makeAxis
mapping.join(standard.LB, standard.RB).to(actions.Yaw);
mapping.makeAxis(standard.LB, standard.RB).to(actions.Yaw);
mapping.from(actions.Yaw).clamp(0, 1).invert().to(actions.YAW_RIGHT);
mapping.from(actions.Yaw).clamp(-1, 0).to(actions.YAW_LEFT);
// mapping.modifier(keyboard.Ctrl).scale(2.0)