moving key press detection to JSON

This commit is contained in:
Wayne Chen 2019-03-11 14:27:47 -07:00
parent 8aedc98a58
commit 07ddd4e1dd
2 changed files with 3 additions and 13 deletions

View file

@ -5,6 +5,7 @@
{ "from": "Keyboard.D", "when": ["Keyboard.RightMouseButton", "!Keyboard.Control"], "to": "Actions.LATERAL_RIGHT" },
{ "from": "Keyboard.E", "when": "!Keyboard.Control", "to": "Actions.LATERAL_RIGHT" },
{ "from": "Keyboard.Q", "when": "!Keyboard.Control", "to": "Actions.LATERAL_LEFT" },
{ "from": "Keyboard.T", "when": "!Keyboard.Control", "to": "Actions.TogglePushToTalk" },
{ "comment" : "Mouse turn need to be small continuous increments",
"from": { "makeAxis" : [

View file

@ -1608,9 +1608,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
switch (actionEnum) {
case Action::TOGGLE_PUSHTOTALK:
if (state > 0.0f) {
audioScriptingInterface->setPushingToTalk(false);
} else if (state < 0.0f) {
audioScriptingInterface->setPushingToTalk(true);
} else if (state <= 0.0f) {
audioScriptingInterface->setPushingToTalk(false);
}
break;
@ -4047,7 +4047,6 @@ void Application::keyPressEvent(QKeyEvent* event) {
_keysPressed.insert(event->key(), *event);
}
auto audioScriptingInterface = reinterpret_cast<scripting::Audio*>(DependencyManager::get<AudioScriptingInterface>().data());
_controllerScriptingInterface->emitKeyPressEvent(event); // send events to any registered scripts
// if one of our scripts have asked to capture this event, then stop processing it
if (_controllerScriptingInterface->isKeyCaptured(event) || isInterstitialMode()) {
@ -4215,10 +4214,6 @@ void Application::keyPressEvent(QKeyEvent* event) {
}
break;
case Qt::Key_T:
audioScriptingInterface->setPushingToTalk(true);
break;
case Qt::Key_P: {
if (!isShifted && !isMeta && !isOption && !event->isAutoRepeat()) {
AudioInjectorOptions options;
@ -4325,12 +4320,6 @@ void Application::keyReleaseEvent(QKeyEvent* event) {
_keyboardMouseDevice->keyReleaseEvent(event);
}
auto audioScriptingInterface = reinterpret_cast<scripting::Audio*>(DependencyManager::get<AudioScriptingInterface>().data());
switch (event->key()) {
case Qt::Key_T:
audioScriptingInterface->setPushingToTalk(false);
break;
}
}
void Application::focusOutEvent(QFocusEvent* event) {