History

Merge remote-tracking branch 'jherico/input-plugins' into sam/vive-hand-controllers

Sam Gondelman committed 11 years ago

Commit 1ea8e852 parents aaf84b4 b2b571b15 files · +143 −52Browse files

Showing the changes to interface/src/Application.cpp (1 of 15 files). Show all

Unified · Split

interface/src/Application.cpp+21−15
@@ -99,6 +99,7 @@ · 98 unmodified lines
9999 #include <Tooltip.h>
100100 #include <UserActivityLogger.h>
101101 #include <UUID.h>
102+#include <input-plugins/UserInputMapper.h>
102103 #include <VrMenu.h>
103104
104105 #include "Application.h"
@@ -313,6 +314,7 @@ bool setupEssentials(int& argc, char** argv) { · 208 unmodified lines
313314 auto autoUpdater = DependencyManager::set<AutoUpdater>();
314315 auto pathUtils = DependencyManager::set<PathUtils>();
315316 auto actionFactory = DependencyManager::set<InterfaceActionFactory>();
317+ auto userInputMapper = DependencyManager::set<UserInputMapper>();
316318
317319 return true;
318320 }
@@ -608,9 +610,12 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 289 unmodified lines
608610 this, &Application::checkSkeleton, Qt::QueuedConnection);
609611
610612 // Setup the userInputMapper with the actions
613+ auto userInputMapper = DependencyManager::get<UserInputMapper>();
614+ connect(userInputMapper.data(), &UserInputMapper::actionEvent, &_controllerScriptingInterface, &AbstractControllerScriptingInterface::actionEvent);
615+
611616 // Setup the keyboardMouseDevice and the user input mapper with the default bindings
612− _keyboardMouseDevice.registerToUserInputMapper(_userInputMapper);
613− _keyboardMouseDevice.assignDefaultInputMapping(_userInputMapper);
617+ _keyboardMouseDevice.registerToUserInputMapper(*userInputMapper);
618+ _keyboardMouseDevice.assignDefaultInputMapping(*userInputMapper);
614619
615620 // check first run...
616621 if (_firstRun.get()) {
@@ -2510,7 +2515,8 @@ void Application::update(float deltaTime) { · 1893 unmodified lines
25102515 ViveControllerManager::getInstance().update();
25112516 }
25122517
2513− _userInputMapper.update(deltaTime);
2518+ auto userInputMapper = DependencyManager::get<UserInputMapper>();
2519+ userInputMapper->update(deltaTime);
25142520 _keyboardMouseDevice.update();
25152521
25162522 // Dispatch input events
@@ -2520,19 +2526,19 @@ void Application::update(float deltaTime) { · 3 unmodified lines
25202526 _myAvatar->clearDriveKeys();
25212527 if (_myCamera.getMode() != CAMERA_MODE_INDEPENDENT) {
25222528 if (!_controllerScriptingInterface.areActionsCaptured()) {
2523− _myAvatar->setDriveKeys(FWD, _userInputMapper.getActionState(UserInputMapper::LONGITUDINAL_FORWARD));
2524− _myAvatar->setDriveKeys(BACK, _userInputMapper.getActionState(UserInputMapper::LONGITUDINAL_BACKWARD));
2525− _myAvatar->setDriveKeys(UP, _userInputMapper.getActionState(UserInputMapper::VERTICAL_UP));
2526− _myAvatar->setDriveKeys(DOWN, _userInputMapper.getActionState(UserInputMapper::VERTICAL_DOWN));
2527− _myAvatar->setDriveKeys(LEFT, _userInputMapper.getActionState(UserInputMapper::LATERAL_LEFT));
2528− _myAvatar->setDriveKeys(RIGHT, _userInputMapper.getActionState(UserInputMapper::LATERAL_RIGHT));
2529− _myAvatar->setDriveKeys(ROT_UP, _userInputMapper.getActionState(UserInputMapper::PITCH_UP));
2530− _myAvatar->setDriveKeys(ROT_DOWN, _userInputMapper.getActionState(UserInputMapper::PITCH_DOWN));
2531− _myAvatar->setDriveKeys(ROT_LEFT, _userInputMapper.getActionState(UserInputMapper::YAW_LEFT));
2532− _myAvatar->setDriveKeys(ROT_RIGHT, _userInputMapper.getActionState(UserInputMapper::YAW_RIGHT));
2529+ _myAvatar->setDriveKeys(FWD, userInputMapper->getActionState(UserInputMapper::LONGITUDINAL_FORWARD));
2530+ _myAvatar->setDriveKeys(BACK, userInputMapper->getActionState(UserInputMapper::LONGITUDINAL_BACKWARD));
2531+ _myAvatar->setDriveKeys(UP, userInputMapper->getActionState(UserInputMapper::VERTICAL_UP));
2532+ _myAvatar->setDriveKeys(DOWN, userInputMapper->getActionState(UserInputMapper::VERTICAL_DOWN));
2533+ _myAvatar->setDriveKeys(LEFT, userInputMapper->getActionState(UserInputMapper::LATERAL_LEFT));
2534+ _myAvatar->setDriveKeys(RIGHT, userInputMapper->getActionState(UserInputMapper::LATERAL_RIGHT));
2535+ _myAvatar->setDriveKeys(ROT_UP, userInputMapper->getActionState(UserInputMapper::PITCH_UP));
2536+ _myAvatar->setDriveKeys(ROT_DOWN, userInputMapper->getActionState(UserInputMapper::PITCH_DOWN));
2537+ _myAvatar->setDriveKeys(ROT_LEFT, userInputMapper->getActionState(UserInputMapper::YAW_LEFT));
2538+ _myAvatar->setDriveKeys(ROT_RIGHT, userInputMapper->getActionState(UserInputMapper::YAW_RIGHT));
25332539 }
2534− _myAvatar->setDriveKeys(BOOM_IN, _userInputMapper.getActionState(UserInputMapper::BOOM_IN));
2535− _myAvatar->setDriveKeys(BOOM_OUT, _userInputMapper.getActionState(UserInputMapper::BOOM_OUT));
2540+ _myAvatar->setDriveKeys(BOOM_IN, userInputMapper->getActionState(UserInputMapper::BOOM_IN));
2541+ _myAvatar->setDriveKeys(BOOM_OUT, userInputMapper->getActionState(UserInputMapper::BOOM_OUT));
25362542 }
25372543
25382544 updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process...

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t