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
307307 // These functions do translation from the Steam IDs to the standard controller IDs
308308 void ViveControllerManager::handleAxisEvent(uint32_t axis, float x, float y, bool left) {
309309 #ifdef Q_OS_WIN
310+ axis += vr::k_EButton_Axis0;
310311 using namespace controller;
311312 if (axis == vr::k_EButton_SteamVR_Touchpad) {
312313 _axisStateMap[left ? LX : RX] = x;
313314 _axisStateMap[left ? LY : RY] = y;
314315 } else if (axis == vr::k_EButton_SteamVR_Trigger) {
316+ //FIX ME: Seems that enters here everytime
315317 _axisStateMap[left ? LT : RT] = x;
316318 }
317319 #endif
@@ -325,15 +327,17 @@ void ViveControllerManager::handleButtonEvent(uint32_t button, bool pressed, boo · 7 unmodified lines
325327 }
326328
327329 if (button == vr::k_EButton_ApplicationMenu) {
328− // FIXME?
329− _buttonPressedMap.insert(left ? controller::B : controller::A);
330+ _buttonPressedMap.insert(left ? controller::LEFT_PRIMARY_THUMB : controller::RIGHT_PRIMARY_THUMB);
330331 } else if (button == vr::k_EButton_Grip) {
331332 // 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) {
334333 _buttonPressedMap.insert(left ? controller::LB : controller::RB);
334+ } else if (button == vr::k_EButton_SteamVR_Trigger) {
335+ _buttonPressedMap.insert(left ? controller::LT : controller::RT);
335336 } else if (button == vr::k_EButton_SteamVR_Touchpad) {
336337 _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);
337341 }
338342 #endif
339343 }
@@ -425,10 +429,10 @@ controller::Input::NamedVector ViveControllerManager::getAvailableInputs() const · 85 unmodified lines
425429 makePair(LEFT_HAND, "LeftHand"),
426430 makePair(RIGHT_HAND, "RightHand"),
427431
428− makePair(A, "A"),
429− makePair(B, "B"),
430− makePair(BACK, "Back"),
431− makePair(START, "Start"),
432+ makePair(LEFT_PRIMARY_THUMB, "LeftPrimaryThumb"),
433+ makePair(LEFT_SECONDARY_THUMB, "LeftSecondaryThumb"),
434+ makePair(RIGHT_PRIMARY_THUMB, "RightPrimaryThumb"),
435+ makePair(RIGHT_SECONDARY_THUMB, "RightSecondaryThumb"),
432436 };
433437
434438 //availableInputs.append(Input::NamedPair(makeInput(BUTTON_A, 0), "Left Button A"));