summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface/DInput
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2020-01-24 00:06:39 -0600
committerJordan Woyak <jordan.woyak@gmail.com>2020-01-24 09:20:41 -0600
commitb92f6480a0b7517666ad139fc81c89033f84830f (patch)
tree867c2725a11dba2265cb5c1ed5c7b2a4131a4dae /Source/Core/InputCommon/ControllerInterface/DInput
parent42c03c4dadd9e507a91b07bb01ff597bbd1df728 (diff)
InputCommon: Make "Cursor" inputs aware of the rendered aspect ratio.
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/DInput')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp6
-rw-r--r--Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h6
2 files changed, 6 insertions, 6 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp
index 24edc4386c..1e617d6c24 100644
--- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.cpp
@@ -125,9 +125,11 @@ void KeyboardMouse::UpdateCursorInput()
const auto win_width = rect.right - rect.left;
const auto win_height = rect.bottom - rect.top;
+ const auto window_scale = g_controller_interface.GetWindowInputScale();
+
// Convert the cursor position to a range from -1 to 1.
- m_state_in.cursor.x = ControlState(point.x) / win_width * 2 - 1;
- m_state_in.cursor.y = ControlState(point.y) / win_height * 2 - 1;
+ m_state_in.cursor.x = (ControlState(point.x) / win_width * 2 - 1) * window_scale.x;
+ m_state_in.cursor.y = (ControlState(point.y) / win_height * 2 - 1) * window_scale.y;
}
void KeyboardMouse::UpdateInput()
diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h
index e1d2500b15..711c9461e6 100644
--- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h
+++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputKeyboardMouse.h
@@ -6,6 +6,7 @@
#include <windows.h>
+#include "Common/Matrix.h"
#include "InputCommon/ControllerInterface/DInput/DInput8.h"
#include "InputCommon/ControllerInterface/Device.h"
@@ -20,10 +21,7 @@ private:
{
BYTE keyboard[256];
DIMOUSESTATE2 mouse;
- struct
- {
- ControlState x, y;
- } cursor;
+ Common::TVec2<ControlState> cursor;
};
class Key : public Input