Implement full support for mouse input on Android

The smoothing algorithm changed a bit now that I centralized that logic
in a way that can work with all backends.
This commit is contained in:
Henrik Rydgård committed 2023-12-10 09:52:19 +01:00
1 parent 904ce4f7e1
commit db4993bfdc
10 files changed
+120 -64

No files matched your search

+1 -19
View File
@@ -65,9 +65,6 @@ void UpdateConsolePosition() {
}
void WindowsInputManager::Init() {
mouseDeltaX_ = 0;
mouseDeltaY_ = 0;
//add first XInput device to respond
input.push_back(std::make_unique<XinputDevice>());
#ifndef _M_ARM
@@ -102,22 +99,7 @@ void WindowsInputManager::PollControllers() {
// Disabled by default, needs a workaround to map to psp keys.
if (g_Config.bMouseControl) {
float scaleFactor_x = g_display.dpi_scale_x * 0.1 * g_Config.fMouseSensitivity;
float scaleFactor_y = g_display.dpi_scale_y * 0.1 * g_Config.fMouseSensitivity;
float mx = std::max(-1.0f, std::min(1.0f, mouseDeltaX_ * scaleFactor_x));
float my = std::max(-1.0f, std::min(1.0f, mouseDeltaY_ * scaleFactor_y));
AxisInput axis[2];
axis[0].axisId = JOYSTICK_AXIS_MOUSE_REL_X;
axis[0].deviceId = DEVICE_ID_MOUSE;
axis[0].value = mx;
axis[1].axisId = JOYSTICK_AXIS_MOUSE_REL_Y;
axis[1].deviceId = DEVICE_ID_MOUSE;
axis[1].value = my;
if (GetUIState() == UISTATE_INGAME || g_Config.bMapMouse) {
NativeAxis(axis, 2);
}
NativeMouseDelta(mouseDeltaX_, mouseDeltaY_);
}
mouseDeltaX_ *= g_Config.fMouseSmoothing;