added control button for controller API

This commit is contained in:
Dante Ruiz 2018-02-13 09:41:00 -08:00
parent 040710807d
commit ddcee05b14
2 changed files with 6 additions and 7 deletions

View file

@ -88,8 +88,8 @@
]
},
{ "from": "Keyboard.W", "to": "Actions.LONGITUDINAL_FORWARD" },
{ "from": "Keyboard.S", "to": "Actions.LONGITUDINAL_BACKWARD" },
{ "from": "Keyboard.W", "when": "!Keyboard.Control", "to": "Actions.LONGITUDINAL_FORWARD" },
{ "from": "Keyboard.S", "when": "!Keyboard.Control", "to": "Actions.LONGITUDINAL_BACKWARD" },
{ "from": "Keyboard.C", "to": "Actions.VERTICAL_DOWN" },
{ "from": "Keyboard.E", "to": "Actions.VERTICAL_UP" },
{ "from": "Keyboard.Left", "when": "Keyboard.RightMouseButton", "to": "Actions.LATERAL_LEFT" },

View file

@ -54,11 +54,9 @@ void KeyboardMouseDevice::InputDevice::focusOutEvent() {
void KeyboardMouseDevice::keyPressEvent(QKeyEvent* event) {
auto input = _inputDevice->makeInput((Qt::Key) event->key());
if (!(event->modifiers() & Qt::KeyboardModifier::ControlModifier)) {
auto result = _inputDevice->_buttonPressedMap.insert(input.getChannel());
if (result.second) {
// key pressed again ? without catching the release event ?
}
auto result = _inputDevice->_buttonPressedMap.insert(input.getChannel());
if (result.second) {
// key pressed again ? without catching the release event ?
}
}
@ -237,6 +235,7 @@ controller::Input::NamedVector KeyboardMouseDevice::InputDevice::getAvailableInp
availableInputs.append(Input::NamedPair(makeInput(Qt::Key_PageUp), QKeySequence(Qt::Key_PageUp).toString()));
availableInputs.append(Input::NamedPair(makeInput(Qt::Key_PageDown), QKeySequence(Qt::Key_PageDown).toString()));
availableInputs.append(Input::NamedPair(makeInput(Qt::Key_Tab), QKeySequence(Qt::Key_Tab).toString()));
availableInputs.append(Input::NamedPair(makeInput(Qt::Key_Control), "Control"));
availableInputs.append(Input::NamedPair(makeInput(Qt::LeftButton), "LeftMouseButton"));
availableInputs.append(Input::NamedPair(makeInput(Qt::MiddleButton), "MiddleMouseButton"));