For Quest, discern left/right XY/AB buttons

The VrApi implementation now checks that X, Y, A, B buttons exist on that
specific controller. X,Y are on left; A,B on the right controller. That
mapping covers Quest Touch and Quest 2 controllers.
This commit is contained in:
Josip Miskovic 2022-02-14 17:30:30 +01:00 committed by Bjorn
parent ee3ba6ef3e
commit 2e82dfce92
1 changed files with 16 additions and 0 deletions

View File

@ -247,6 +247,14 @@ static bool vrapi_isDown(Device device, DeviceButton button, bool* down, bool* c
return false;
}
if (device == DEVICE_HAND_LEFT && (button == BUTTON_A || button == BUTTON_B)) {
return false;
}
if (device == DEVICE_HAND_RIGHT && (button == BUTTON_X || button == BUTTON_Y)) {
return false;
}
if (state.hands[device - DEVICE_HAND_LEFT].Type != ovrControllerType_TrackedRemote) {
return false;
}
@ -275,6 +283,14 @@ static bool vrapi_isTouched(Device device, DeviceButton button, bool* touched) {
return false;
}
if (device == DEVICE_HAND_LEFT && (button == BUTTON_A || button == BUTTON_B)) {
return false;
}
if (device == DEVICE_HAND_RIGHT && (button == BUTTON_X || button == BUTTON_Y)) {
return false;
}
if (state.hands[device - DEVICE_HAND_LEFT].Type != ovrControllerType_TrackedRemote) {
return false;
}