From 0f83fa700fc6a311ea0a62639b4c7e612399c008 Mon Sep 17 00:00:00 2001 From: Petr Bartos Date: Tue, 12 Apr 2022 21:59:30 +0200 Subject: [PATCH] Use thumbsticks as PAGEUP/PAGEDOWN in menus --- android/app/src/main/cpp/code/vr/vr_input.c | 29 ++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/android/app/src/main/cpp/code/vr/vr_input.c b/android/app/src/main/cpp/code/vr/vr_input.c index 36f8a4f5..b6595ff8 100644 --- a/android/app/src/main/cpp/code/vr/vr_input.c +++ b/android/app/src/main/cpp/code/vr/vr_input.c @@ -525,8 +525,35 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo vr.thumbstick_location[isRightController][0] = joystickX; vr.thumbstick_location[isRightController][1] = joystickY; - if (!vr.virtual_screen && cl.snap.ps.pm_type != PM_INTERMISSION) + if (vr.virtual_screen || cl.snap.ps.pm_type == PM_INTERMISSION) { + + // Use thumbstick UP/DOWN as PAGEUP/PAGEDOWN in menus + if (joystickY > thumbstickPressedThreshold) { + if (!IN_InputActivated(&controller->axisButtons, VR_TOUCH_AXIS_UP)) { + IN_ActivateInput(&controller->axisButtons, VR_TOUCH_AXIS_UP); + Com_QueueEvent(in_vrEventTime, SE_KEY, K_PGUP, qtrue, 0, NULL); + } + } else if (joystickY < -thumbstickPressedThreshold) { + if (!IN_InputActivated(&controller->axisButtons, VR_TOUCH_AXIS_DOWN)) { + IN_ActivateInput(&controller->axisButtons, VR_TOUCH_AXIS_DOWN); + Com_QueueEvent(in_vrEventTime, SE_KEY, K_PGDN, qtrue, 0, NULL); + } + } else if (joystickY < thumbstickReleasedThreshold && joystickY > -thumbstickReleasedThreshold) { + if (IN_InputActivated(&controller->axisButtons, VR_TOUCH_AXIS_UP)) { + IN_DeactivateInput(&controller->axisButtons, VR_TOUCH_AXIS_UP); + Com_QueueEvent(in_vrEventTime, SE_KEY, K_PGUP, qfalse, 0, NULL); + } + if (IN_InputActivated(&controller->axisButtons, VR_TOUCH_AXIS_DOWN)) { + IN_DeactivateInput(&controller->axisButtons, VR_TOUCH_AXIS_DOWN); + Com_QueueEvent(in_vrEventTime, SE_KEY, K_PGDN, qfalse, 0, NULL); + } + } + + } + else + { + if (isRightController == (vr_switchThumbsticks->integer != 0)) { vec3_t positional; VectorClear(positional);