summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
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/ControllerInterface.cpp
parent42c03c4dadd9e507a91b07bb01ff597bbd1df728 (diff)
InputCommon: Make "Cursor" inputs aware of the rendered aspect ratio.
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
index 35dfbde0be..130f0f357a 100644
--- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
@@ -257,6 +257,21 @@ void ControllerInterface::UpdateInput()
}
}
+void ControllerInterface::SetAspectRatioAdjustment(float value)
+{
+ m_aspect_ratio_adjustment = value;
+}
+
+Common::Vec2 ControllerInterface::GetWindowInputScale() const
+{
+ const auto ar = m_aspect_ratio_adjustment.load();
+
+ if (ar > 1)
+ return {1.f, ar};
+ else
+ return {1 / ar, 1.f};
+}
+
// Register a callback to be called when a device is added or removed (as from the input backends'
// hotplug thread), or when devices are refreshed
// Returns a handle for later removing the callback.