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
469469 return DependencyManager::get<UserInputMapper>()->findDevice(name);
470470 }
471471
472+QVector<QString> ControllerScriptingInterface::getDeviceNames() {
473+ return DependencyManager::get<UserInputMapper>()->getDeviceNames();
474+}
475+
472476 float ControllerScriptingInterface::getActionValue(int action) {
473477 return DependencyManager::get<UserInputMapper>()->getActionState(UserInputMapper::Action(action));
474478 }
475479
476480 int ControllerScriptingInterface::findAction(QString actionName) {
477− auto userInputMapper = DependencyManager::get<UserInputMapper>();
478− auto actions = getAllActions();
479− for (auto action : actions) {
480− if (userInputMapper->getActionName(action) == actionName) {
481− return action;
482− }
483− }
484− // If the action isn't found, return -1
485− return -1;
481+ return DependencyManager::get<UserInputMapper>()->findAction(actionName);
482+}
483+
484+QVector<QString> ControllerScriptingInterface::getActionNames() const {
485+ return DependencyManager::get<UserInputMapper>()->getActionNames();
486486 }
487487
488488 InputController::InputController(int deviceTrackerId, int subTrackerId, QObject* parent) :