Thumbrest support;

This commit is contained in:
bjorn 2022-01-29 15:39:55 -08:00 committed by Bjorn
parent 2e5c529faf
commit 54154a643a
5 changed files with 9 additions and 0 deletions

View File

@ -56,6 +56,7 @@ StringEntry lovrDevice[] = {
StringEntry lovrDeviceButton[] = {
[BUTTON_TRIGGER] = ENTRY("trigger"),
[BUTTON_THUMBSTICK] = ENTRY("thumbstick"),
[BUTTON_THUMBREST] = ENTRY("thumbrest"),
[BUTTON_TOUCHPAD] = ENTRY("touchpad"),
[BUTTON_GRIP] = ENTRY("grip"),
[BUTTON_MENU] = ENTRY("menu"),

View File

@ -55,6 +55,7 @@ typedef enum {
typedef enum {
BUTTON_TRIGGER,
BUTTON_THUMBSTICK,
BUTTON_THUMBREST,
BUTTON_TOUCHPAD,
BUTTON_GRIP,
BUTTON_MENU,

View File

@ -723,6 +723,7 @@ static bool getButtonState(Device device, DeviceButton button, bool* value, bool
switch (button) {
case BUTTON_TRIGGER: info.action = state.actions[ACTION_TRIGGER_DOWN + touch]; break;
case BUTTON_THUMBREST: info.action = state.actions[ACTION_THUMBREST_DOWN + touch]; break;
case BUTTON_TOUCHPAD: info.action = state.actions[ACTION_TRACKPAD_DOWN + touch]; break;
case BUTTON_MENU: info.action = state.actions[ACTION_MENU_DOWN + touch]; break;
case BUTTON_GRIP: info.action = state.actions[ACTION_GRIP_DOWN + touch]; break;

View File

@ -300,6 +300,7 @@ static bool vrapi_isTouched(Device device, DeviceButton button, bool* touched) {
switch (button) {
case BUTTON_TRIGGER: *touched = input->Touches & ovrTouch_IndexTrigger; return true;
case BUTTON_THUMBSTICK: *touched = input->Touches & ovrTouch_Joystick; return true;
case BUTTON_THUMBREST: *touched = input->Touches & ovrTouch_ThumbRest; return true;
case BUTTON_A: *touched = input->Touches & ovrTouch_A; return true;
case BUTTON_B: *touched = input->Touches & ovrTouch_B; return true;
case BUTTON_X: *touched = input->Touches & ovrTouch_X; return true;

View File

@ -27,6 +27,8 @@ enum {
ACTION_GRIP_DOWN,
ACTION_GRIP_TOUCH,
ACTION_GRIP_AXIS,
ACTION_THUMBREST_DOWN,
ACTION_THUMBREST_TOUCH,
ACTION_VIBRATE,
MAX_ACTIONS
};
@ -58,6 +60,7 @@ static XrActionCreateInfo actionCreateInfo[] = {
[ACTION_GRIP_DOWN] = action("grip_down", "Grip Down", XR_ACTION_TYPE_BOOLEAN_INPUT),
[ACTION_GRIP_TOUCH] = action("grip_touch", "Grip Touch", XR_ACTION_TYPE_BOOLEAN_INPUT),
[ACTION_GRIP_AXIS] = action("grip_axis", "Grip Axis", XR_ACTION_TYPE_FLOAT_INPUT),
[ACTION_THUMBREST_TOUCH] = action("thumbrest_touch", "Thumbrest Touch", XR_ACTION_TYPE_BOOLEAN_INPUT),
[ACTION_VIBRATE] = action("vibrate", "Vibrate", XR_ACTION_TYPE_VIBRATION_OUTPUT),
};
#undef action
@ -120,6 +123,8 @@ static const char* bindings[MAX_PROFILES][MAX_ACTIONS][2] = {
[ACTION_GRIP_DOWN][1] = "/user/hand/right/input/squeeze/value",
[ACTION_GRIP_AXIS][0] = "/user/hand/left/input/squeeze/value",
[ACTION_GRIP_AXIS][1] = "/user/hand/right/input/squeeze/value",
[ACTION_THUMBREST_TOUCH][0] = "/user/hand/left/input/thumbrest/touch",
[ACTION_THUMBREST_TOUCH][1] = "/user/hand/right/input/thumbrest/touch",
[ACTION_VIBRATE][0] = "/user/hand/left/output/haptic",
[ACTION_VIBRATE][1] = "/user/hand/right/output/haptic"
},