diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2020-01-24 00:06:39 -0600 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2020-01-24 09:20:41 -0600 |
| commit | b92f6480a0b7517666ad139fc81c89033f84830f (patch) | |
| tree | 867c2725a11dba2265cb5c1ed5c7b2a4131a4dae /Source/Core/InputCommon/ControllerInterface/ControllerInterface.h | |
| parent | 42c03c4dadd9e507a91b07bb01ff597bbd1df728 (diff) | |
InputCommon: Make "Cursor" inputs aware of the rendered aspect ratio.
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/ControllerInterface.h')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/ControllerInterface.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h index 359bd8f0c3..4f1651f361 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h @@ -10,6 +10,7 @@ #include <memory> #include <mutex> +#include "Common/Matrix.h" #include "Common/WindowSystemInfo.h" #include "InputCommon/ControllerInterface/Device.h" @@ -52,6 +53,14 @@ public: bool IsInit() const { return m_is_init; } void UpdateInput(); + // Set adjustment from the full render window aspect-ratio to the drawn aspect-ratio. + // Used to fit mouse cursor inputs to the relevant region of the render window. + void SetAspectRatioAdjustment(float); + + // Calculated from the aspect-ratio adjustment. + // Inputs based on window coordinates should be multiplied by this. + Common::Vec2 GetWindowInputScale() const; + HotplugCallbackHandle RegisterDevicesChangedCallback(std::function<void(void)> callback); void UnregisterDevicesChangedCallback(const HotplugCallbackHandle& handle); void InvokeDevicesChangedCallbacks() const; @@ -62,6 +71,7 @@ private: std::atomic<bool> m_is_init; std::atomic<bool> m_is_populating_devices{false}; WindowSystemInfo m_wsi; + std::atomic<float> m_aspect_ratio_adjustment = 1; }; extern ControllerInterface g_controller_interface; |
