History

ViveController - mapping of buttons

AlessandroSigna committed 11 years ago

Commit 01d38051 parent 2bf6ce02 files · +26 −21Browse files

Showing the changes to libraries/input-plugins/src/input-plugins/ViveControllerManager.cpp (1 of 2 files). Show all

Unified · Split

libraries/input-plugins/src/input-plugins/ViveControllerManager.cpp+12−8
@@ -307,11 +307,13 @@ void ViveControllerManager::focusOutEvent() { · 306 unmodified lines
307// These functions do translation from the Steam IDs to the standard controller IDs307// These functions do translation from the Steam IDs to the standard controller IDs
308void ViveControllerManager::handleAxisEvent(uint32_t axis, float x, float y, bool left) {308void ViveControllerManager::handleAxisEvent(uint32_t axis, float x, float y, bool left) {
309#ifdef Q_OS_WIN309#ifdef Q_OS_WIN
310 axis += vr::k_EButton_Axis0;
310 using namespace controller;311 using namespace controller;
311 if (axis == vr::k_EButton_SteamVR_Touchpad) {312 if (axis == vr::k_EButton_SteamVR_Touchpad) {
312 _axisStateMap[left ? LX : RX] = x;313 _axisStateMap[left ? LX : RX] = x;
313 _axisStateMap[left ? LY : RY] = y;314 _axisStateMap[left ? LY : RY] = y;
314 } else if (axis == vr::k_EButton_SteamVR_Trigger) {315 } else if (axis == vr::k_EButton_SteamVR_Trigger) {
316 //FIX ME: Seems that enters here everytime
315 _axisStateMap[left ? LT : RT] = x;317 _axisStateMap[left ? LT : RT] = x;
316 }318 }
317#endif319#endif
@@ -325,15 +327,17 @@ void ViveControllerManager::handleButtonEvent(uint32_t button, bool pressed, boo · 7 unmodified lines
325 }327 }
326 328
327 if (button == vr::k_EButton_ApplicationMenu) {329 if (button == vr::k_EButton_ApplicationMenu) {
328 // FIXME?330 _buttonPressedMap.insert(left ? controller::LEFT_PRIMARY_THUMB : controller::RIGHT_PRIMARY_THUMB);
329 _buttonPressedMap.insert(left ? controller::B : controller::A);
330 } else if (button == vr::k_EButton_Grip) {331 } else if (button == vr::k_EButton_Grip) {
331 // Tony says these are harder to reach, so make them the meta buttons332 // Tony says these are harder to reach, so make them the meta buttons
332 _buttonPressedMap.insert(left ? controller::BACK : controller::START);
333 } else if (button == vr::k_EButton_SteamVR_Trigger) {
334 _buttonPressedMap.insert(left ? controller::LB : controller::RB);333 _buttonPressedMap.insert(left ? controller::LB : controller::RB);
334 } else if (button == vr::k_EButton_SteamVR_Trigger) {
335 _buttonPressedMap.insert(left ? controller::LT : controller::RT);
335 } else if (button == vr::k_EButton_SteamVR_Touchpad) {336 } else if (button == vr::k_EButton_SteamVR_Touchpad) {
336 _buttonPressedMap.insert(left ? controller::LS : controller::RS);337 _buttonPressedMap.insert(left ? controller::LS : controller::RS);
338 } else if (button == vr::k_EButton_System) {
339 //FIX ME: not able to ovrewrite the behaviour of this button
340 _buttonPressedMap.insert(left ? controller::LEFT_SECONDARY_THUMB : controller::RIGHT_SECONDARY_THUMB);
337 }341 }
338#endif342#endif
339}343}
@@ -425,10 +429,10 @@ controller::Input::NamedVector ViveControllerManager::getAvailableInputs() const · 85 unmodified lines
425 makePair(LEFT_HAND, "LeftHand"),429 makePair(LEFT_HAND, "LeftHand"),
426 makePair(RIGHT_HAND, "RightHand"),430 makePair(RIGHT_HAND, "RightHand"),
427 431
428 makePair(A, "A"),432 makePair(LEFT_PRIMARY_THUMB, "LeftPrimaryThumb"),
429 makePair(B, "B"),433 makePair(LEFT_SECONDARY_THUMB, "LeftSecondaryThumb"),
430 makePair(BACK, "Back"),434 makePair(RIGHT_PRIMARY_THUMB, "RightPrimaryThumb"),
431 makePair(START, "Start"),435 makePair(RIGHT_SECONDARY_THUMB, "RightSecondaryThumb"),
432 };436 };
433 437
434 //availableInputs.append(Input::NamedPair(makeInput(BUTTON_A, 0), "Left Button A"));438 //availableInputs.append(Input::NamedPair(makeInput(BUTTON_A, 0), "Left Button A"));