summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h
diff options
context:
space:
mode:
authorTilka <tilkax@gmail.com>2020-01-25 20:28:01 +0000
committerGitHub <noreply@github.com>2020-01-25 20:28:01 +0000
commitb0e040431a633ea3b0486673592e0de753110823 (patch)
tree5b2e36a8cc6259de49d28461a00778960f254faa /Source/Core/InputCommon/ControllerInterface/ControllerInterface.h
parent9827aa7a37e444cb359d4db50f5d73cb58eda77c (diff)
parentb92f6480a0b7517666ad139fc81c89033f84830f (diff)
Merge pull request #8581 from jordan-woyak/ciface-ar-aware
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.h10
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;