Showing the changes to interface/src/Application.cpp (1 of 15 files). Show all
Unified · Split
| @@ -99,6 +99,7 @@ · 98 unmodified lines | |||
| 99 | #include <Tooltip.h> | 99 | #include <Tooltip.h> |
| 100 | #include <UserActivityLogger.h> | 100 | #include <UserActivityLogger.h> |
| 101 | #include <UUID.h> | 101 | #include <UUID.h> |
| 102 | #include <input-plugins/UserInputMapper.h> | ||
| 102 | #include <VrMenu.h> | 103 | #include <VrMenu.h> |
| 103 | 104 | ||
| 104 | #include "Application.h" | 105 | #include "Application.h" |
| @@ -313,6 +314,7 @@ bool setupEssentials(int& argc, char** argv) { · 208 unmodified lines | |||
| 313 | auto autoUpdater = DependencyManager::set<AutoUpdater>(); | 314 | auto autoUpdater = DependencyManager::set<AutoUpdater>(); |
| 314 | auto pathUtils = DependencyManager::set<PathUtils>(); | 315 | auto pathUtils = DependencyManager::set<PathUtils>(); |
| 315 | auto actionFactory = DependencyManager::set<InterfaceActionFactory>(); | 316 | auto actionFactory = DependencyManager::set<InterfaceActionFactory>(); |
| 317 | auto userInputMapper = DependencyManager::set<UserInputMapper>(); | ||
| 316 | 318 | ||
| 317 | return true; | 319 | return true; |
| 318 | } | 320 | } |
| @@ -608,9 +610,12 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 289 unmodified lines | |||
| 608 | this, &Application::checkSkeleton, Qt::QueuedConnection); | 610 | this, &Application::checkSkeleton, Qt::QueuedConnection); |
| 609 | 611 | ||
| 610 | // Setup the userInputMapper with the actions | 612 | // Setup the userInputMapper with the actions |
| 613 | auto userInputMapper = DependencyManager::get<UserInputMapper>(); | ||
| 614 | connect(userInputMapper.data(), &UserInputMapper::actionEvent, &_controllerScriptingInterface, &AbstractControllerScriptingInterface::actionEvent); | ||
| 615 | |||
| 611 | // Setup the keyboardMouseDevice and the user input mapper with the default bindings | 616 | // Setup the keyboardMouseDevice and the user input mapper with the default bindings |
| 612 | _keyboardMouseDevice.registerToUserInputMapper(_userInputMapper); | 617 | _keyboardMouseDevice.registerToUserInputMapper(*userInputMapper); |
| 613 | _keyboardMouseDevice.assignDefaultInputMapping(_userInputMapper); | 618 | _keyboardMouseDevice.assignDefaultInputMapping(*userInputMapper); |
| 614 | 619 | ||
| 615 | // check first run... | 620 | // check first run... |
| 616 | if (_firstRun.get()) { | 621 | if (_firstRun.get()) { |
| @@ -2510,7 +2515,8 @@ void Application::update(float deltaTime) { · 1893 unmodified lines | |||
| 2510 | ViveControllerManager::getInstance().update(); | 2515 | ViveControllerManager::getInstance().update(); |
| 2511 | } | 2516 | } |
| 2512 | 2517 | ||
| 2513 | _userInputMapper.update(deltaTime); | 2518 | auto userInputMapper = DependencyManager::get<UserInputMapper>(); |
| 2519 | userInputMapper->update(deltaTime); | ||
| 2514 | _keyboardMouseDevice.update(); | 2520 | _keyboardMouseDevice.update(); |
| 2515 | 2521 | ||
| 2516 | // Dispatch input events | 2522 | // Dispatch input events |
| @@ -2520,19 +2526,19 @@ void Application::update(float deltaTime) { · 3 unmodified lines | |||
| 2520 | _myAvatar->clearDriveKeys(); | 2526 | _myAvatar->clearDriveKeys(); |
| 2521 | if (_myCamera.getMode() != CAMERA_MODE_INDEPENDENT) { | 2527 | if (_myCamera.getMode() != CAMERA_MODE_INDEPENDENT) { |
| 2522 | if (!_controllerScriptingInterface.areActionsCaptured()) { | 2528 | if (!_controllerScriptingInterface.areActionsCaptured()) { |
| 2523 | _myAvatar->setDriveKeys(FWD, _userInputMapper.getActionState(UserInputMapper::LONGITUDINAL_FORWARD)); | 2529 | _myAvatar->setDriveKeys(FWD, userInputMapper->getActionState(UserInputMapper::LONGITUDINAL_FORWARD)); |
| 2524 | _myAvatar->setDriveKeys(BACK, _userInputMapper.getActionState(UserInputMapper::LONGITUDINAL_BACKWARD)); | 2530 | _myAvatar->setDriveKeys(BACK, userInputMapper->getActionState(UserInputMapper::LONGITUDINAL_BACKWARD)); |
| 2525 | _myAvatar->setDriveKeys(UP, _userInputMapper.getActionState(UserInputMapper::VERTICAL_UP)); | 2531 | _myAvatar->setDriveKeys(UP, userInputMapper->getActionState(UserInputMapper::VERTICAL_UP)); |
| 2526 | _myAvatar->setDriveKeys(DOWN, _userInputMapper.getActionState(UserInputMapper::VERTICAL_DOWN)); | 2532 | _myAvatar->setDriveKeys(DOWN, userInputMapper->getActionState(UserInputMapper::VERTICAL_DOWN)); |
| 2527 | _myAvatar->setDriveKeys(LEFT, _userInputMapper.getActionState(UserInputMapper::LATERAL_LEFT)); | 2533 | _myAvatar->setDriveKeys(LEFT, userInputMapper->getActionState(UserInputMapper::LATERAL_LEFT)); |
| 2528 | _myAvatar->setDriveKeys(RIGHT, _userInputMapper.getActionState(UserInputMapper::LATERAL_RIGHT)); | 2534 | _myAvatar->setDriveKeys(RIGHT, userInputMapper->getActionState(UserInputMapper::LATERAL_RIGHT)); |
| 2529 | _myAvatar->setDriveKeys(ROT_UP, _userInputMapper.getActionState(UserInputMapper::PITCH_UP)); | 2535 | _myAvatar->setDriveKeys(ROT_UP, userInputMapper->getActionState(UserInputMapper::PITCH_UP)); |
| 2530 | _myAvatar->setDriveKeys(ROT_DOWN, _userInputMapper.getActionState(UserInputMapper::PITCH_DOWN)); | 2536 | _myAvatar->setDriveKeys(ROT_DOWN, userInputMapper->getActionState(UserInputMapper::PITCH_DOWN)); |
| 2531 | _myAvatar->setDriveKeys(ROT_LEFT, _userInputMapper.getActionState(UserInputMapper::YAW_LEFT)); | 2537 | _myAvatar->setDriveKeys(ROT_LEFT, userInputMapper->getActionState(UserInputMapper::YAW_LEFT)); |
| 2532 | _myAvatar->setDriveKeys(ROT_RIGHT, _userInputMapper.getActionState(UserInputMapper::YAW_RIGHT)); | 2538 | _myAvatar->setDriveKeys(ROT_RIGHT, userInputMapper->getActionState(UserInputMapper::YAW_RIGHT)); |
| 2533 | } | 2539 | } |
| 2534 | _myAvatar->setDriveKeys(BOOM_IN, _userInputMapper.getActionState(UserInputMapper::BOOM_IN)); | 2540 | _myAvatar->setDriveKeys(BOOM_IN, userInputMapper->getActionState(UserInputMapper::BOOM_IN)); |
| 2535 | _myAvatar->setDriveKeys(BOOM_OUT, _userInputMapper.getActionState(UserInputMapper::BOOM_OUT)); | 2541 | _myAvatar->setDriveKeys(BOOM_OUT, userInputMapper->getActionState(UserInputMapper::BOOM_OUT)); |
| 2536 | } | 2542 | } |
| 2537 | 2543 | ||
| 2538 | updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process... | 2544 | updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process... |