History

cleanup controller interface, add getActionNames() and getDeviceNames()

Brad Hefta-Gaub committed 11 years ago

Commit 13a9dc41 parent 6549e474 files · +46 −12Browse files

Showing the changes to interface/src/scripting/ControllerScriptingInterface.cpp (1 of 4 files). Show all

Unified · Split

interface/src/scripting/ControllerScriptingInterface.cpp+9−9
@@ -469,20 +469,20 @@ int ControllerScriptingInterface::findDevice(QString name) { · 468 unmodified lines
469 return DependencyManager::get<UserInputMapper>()->findDevice(name);469 return DependencyManager::get<UserInputMapper>()->findDevice(name);
470}470}
471 471
472QVector<QString> ControllerScriptingInterface::getDeviceNames() {
473 return DependencyManager::get<UserInputMapper>()->getDeviceNames();
474}
475
472float ControllerScriptingInterface::getActionValue(int action) {476float ControllerScriptingInterface::getActionValue(int action) {
473 return DependencyManager::get<UserInputMapper>()->getActionState(UserInputMapper::Action(action));477 return DependencyManager::get<UserInputMapper>()->getActionState(UserInputMapper::Action(action));
474}478}
475 479
476int ControllerScriptingInterface::findAction(QString actionName) {480int ControllerScriptingInterface::findAction(QString actionName) {
477 auto userInputMapper = DependencyManager::get<UserInputMapper>();481 return DependencyManager::get<UserInputMapper>()->findAction(actionName);
478 auto actions = getAllActions();482}
479 for (auto action : actions) {483
480 if (userInputMapper->getActionName(action) == actionName) {484QVector<QString> ControllerScriptingInterface::getActionNames() const {
481 return action;485 return DependencyManager::get<UserInputMapper>()->getActionNames();
482 }
483 }
484 // If the action isn't found, return -1
485 return -1;
486}486}
487 487
488InputController::InputController(int deviceTrackerId, int subTrackerId, QObject* parent) :488InputController::InputController(int deviceTrackerId, int subTrackerId, QObject* parent) :