From b92f6480a0b7517666ad139fc81c89033f84830f Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Fri, 24 Jan 2020 00:06:39 -0600 Subject: InputCommon: Make "Cursor" inputs aware of the rendered aspect ratio. --- .../ControllerInterface/ControllerInterface.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp') 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. -- cgit v1.2.3