From ef6c4f6f665c56bd37ae31dede4241a424a95762 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Mon, 19 Oct 2015 19:31:25 -0700 Subject: [PATCH] Working on JSON parsing and cleanup Conflicts: libraries/controllers/src/controllers/Route.cpp libraries/controllers/src/controllers/ScriptingInterface.cpp libraries/controllers/src/controllers/StandardController.cpp libraries/controllers/src/controllers/impl/RouteBuilderProxy.h --- .../resources/controllers/mapping-config.json | 48 ++-- .../resources/controllers/mapping-test0.json | 70 +++--- interface/resources/qml/controller/Xbox.qml | 208 +++++++++--------- 3 files changed, 163 insertions(+), 163 deletions(-) diff --git a/interface/resources/controllers/mapping-config.json b/interface/resources/controllers/mapping-config.json index dd3bc7b05e..2ccd216c2f 100644 --- a/interface/resources/controllers/mapping-config.json +++ b/interface/resources/controllers/mapping-config.json @@ -1,24 +1,24 @@ -{ - "name": "Full Mapping config including the standard hydra and gamepad and one more thing", - "mappings": [ - { "src": "./mapping-hydra.json" }, - { "src": "./mapping-xbox.json" }, - { - "name": "example mapping for standard to js function", - "channels": [ { - "from": "Standard.B", - "to": { - "type":"js", - "function": "function(value){ print(\"Standard.B = \" + value );}" - } - }, { - "from": "Standard.B", - "to": { - "type":"js", - "src": "http://www.theNextBigThing.com/hifiInputSignalHandler.js" - } - } - ] - } - ] -} +{ + "name": "Full Mapping config including the standard hydra and gamepad and one more thing", + "mappings": [ + { "src": "./mapping-hydra.json" }, + { "src": "./mapping-xbox.json" }, + { + "name": "example mapping for standard to js function", + "channels": [ { + "from": "Standard.B", + "to": { + "type":"js", + "function": "function(value){ print(\"Standard.B = \" + value );}" + } + }, { + "from": "Standard.B", + "to": { + "type":"js", + "src": "http://www.theNextBigThing.com/hifiInputSignalHandler.js" + } + } + ] + } + ] +} diff --git a/interface/resources/controllers/mapping-test0.json b/interface/resources/controllers/mapping-test0.json index d6a1de5313..5232c97f19 100644 --- a/interface/resources/controllers/mapping-test0.json +++ b/interface/resources/controllers/mapping-test0.json @@ -1,36 +1,36 @@ -{ - "name": "example mapping from Standard to actions", - "channels": [ { - "from": "Standard.LY", - "filters": [ { - "type": "clamp", - "min": 0, - "max": 1 - } - ], - "to": "Actions.Forward" - }, { - "from": "Standard.LY", - "filters": [ { - "type": "clamp", - "min": -1, - "max": 0 - }, { - "type": "invert" - } - ], - "to": "Actions.Backward" - }, { - "from": "Standard.LX", - "filters": [ { - "type": "scale", - "scale": 2.0 - } - ], - "to": "Actions.Yaw" - }, { - "from": "Standard.A", - "to": "Actions.Action0" - } - ] +{ + "name": "example mapping from Standard to actions", + "channels": [ { + "from": "Standard.LY", + "filters": [ { + "type": "clamp", + "min": 0, + "max": 1 + } + ], + "to": "Actions.Forward" + }, { + "from": "Standard.LY", + "filters": [ { + "type": "clamp", + "min": -1, + "max": 0 + }, { + "type": "invert" + } + ], + "to": "Actions.Backward" + }, { + "from": "Standard.LX", + "filters": [ { + "type": "scale", + "scale": 2.0 + } + ], + "to": "Actions.Yaw" + }, { + "from": "Standard.A", + "to": "Actions.Action0" + } + ] } \ No newline at end of file diff --git a/interface/resources/qml/controller/Xbox.qml b/interface/resources/qml/controller/Xbox.qml index 165ac596fe..4ff2959129 100644 --- a/interface/resources/qml/controller/Xbox.qml +++ b/interface/resources/qml/controller/Xbox.qml @@ -1,104 +1,104 @@ -import QtQuick 2.1 -import QtQuick.Controls 1.0 -import QtQuick.Layouts 1.0 -import QtQuick.Dialogs 1.0 - -import "xbox" - -Item { - id: root - property real aspect: 300.0 / 215.0 - width: 300 - height: width / aspect - property var device - property string label: "" - property real scale: width / 300.0 - - Image { - Text { - anchors.left: parent.left - anchors.top: parent.top - text: root.label - visible: root.label != "" - } - anchors.fill: parent - source: "xbox/xbox360-controller-md.png" - - LeftAnalogStick { - device: root.device - x: (65 * root.scale) - width / 2; y: (42 * root.scale) - height / 2 - } - - // Left stick press - ToggleButton { - controlId: root.device.LS - width: 16 * root.scale; height: 16 * root.scale - x: (65 * root.scale) - width / 2; y: (42 * root.scale) - height / 2 - } - - - RightAnalogStick { - device: root.device - x: (193 * root.scale) - width / 2; y: (96 * root.scale) - height / 2 - } - - // Right stick press - ToggleButton { - controlId: root.device.RS - width: 16 * root.scale; height: 16 * root.scale - x: (193 * root.scale) - width / 2; y: (96 * root.scale) - height / 2 - } - - // Left trigger - AnalogButton { - controlId: root.device.LT - width: 8; height: 64 - x: (20 * root.scale); y: (7 * root.scale) - } - - // Right trigger - AnalogButton { - controlId: root.device.RT - width: 8; height: 64 - x: (272 * root.scale); y: (7 * root.scale) - } - - // Left bumper - ToggleButton { - controlId: root.device.LB - width: 32 * root.scale; height: 16 * root.scale - x: (40 * root.scale); y: (7 * root.scale) - } - - // Right bumper - ToggleButton { - controlId: root.device.RB - width: 32 * root.scale; height: 16 * root.scale - x: (root.width - width) - (40 * root.scale); y: (7 * root.scale) - } - - DPad { - device: root.device - size: 48 * root.scale - x: (80 * root.scale); y: (71 * root.scale) - } - - XboxButtons { - device: root.device - size: 65 * root.scale - x: (206 * root.scale); y: (19 * root.scale) - } - - ToggleButton { - controlId: root.device.Back - width: 16 * root.scale; height: 12 * root.scale - x: (112 * root.scale); y: (45 * root.scale) - } - - ToggleButton { - controlId: root.device.Start - width: 16 * root.scale; height: 12 * root.scale - x: (177 * root.scale); y: (45 * root.scale) - } - } -} +import QtQuick 2.1 +import QtQuick.Controls 1.0 +import QtQuick.Layouts 1.0 +import QtQuick.Dialogs 1.0 + +import "xbox" + +Item { + id: root + property real aspect: 300.0 / 215.0 + width: 300 + height: width / aspect + property var device + property string label: "" + property real scale: width / 300.0 + + Image { + Text { + anchors.left: parent.left + anchors.top: parent.top + text: root.label + visible: root.label != "" + } + anchors.fill: parent + source: "xbox/xbox360-controller-md.png" + + LeftAnalogStick { + device: root.device + x: (65 * root.scale) - width / 2; y: (42 * root.scale) - height / 2 + } + + // Left stick press + ToggleButton { + controlId: root.device.LS + width: 16 * root.scale; height: 16 * root.scale + x: (65 * root.scale) - width / 2; y: (42 * root.scale) - height / 2 + } + + + RightAnalogStick { + device: root.device + x: (193 * root.scale) - width / 2; y: (96 * root.scale) - height / 2 + } + + // Right stick press + ToggleButton { + controlId: root.device.RS + width: 16 * root.scale; height: 16 * root.scale + x: (193 * root.scale) - width / 2; y: (96 * root.scale) - height / 2 + } + + // Left trigger + AnalogButton { + controlId: root.device.LT + width: 8; height: 64 + x: (20 * root.scale); y: (7 * root.scale) + } + + // Right trigger + AnalogButton { + controlId: root.device.RT + width: 8; height: 64 + x: (272 * root.scale); y: (7 * root.scale) + } + + // Left bumper + ToggleButton { + controlId: root.device.LB + width: 32 * root.scale; height: 16 * root.scale + x: (40 * root.scale); y: (7 * root.scale) + } + + // Right bumper + ToggleButton { + controlId: root.device.RB + width: 32 * root.scale; height: 16 * root.scale + x: (root.width - width) - (40 * root.scale); y: (7 * root.scale) + } + + DPad { + device: root.device + size: 48 * root.scale + x: (80 * root.scale); y: (71 * root.scale) + } + + XboxButtons { + device: root.device + size: 65 * root.scale + x: (206 * root.scale); y: (19 * root.scale) + } + + ToggleButton { + controlId: root.device.Back + width: 16 * root.scale; height: 12 * root.scale + x: (112 * root.scale); y: (45 * root.scale) + } + + ToggleButton { + controlId: root.device.Start + width: 16 * root.scale; height: 12 * root.scale + x: (177 * root.scale); y: (45 * root.scale) + } + } +}