summaryrefslogtreecommitdiff
path: root/src/input_common/helpers/touch_from_buttons.cpp
diff options
context:
space:
mode:
authorGravatar Narr the Reg2022-11-05 10:39:03 -0600
committerGravatar german772022-11-19 08:44:33 -0600
commit38c48cf8d896f28f7424b28265110c34f69d2369 (patch)
tree5777e9fafc1ec4182068daa8d7a0ab9630d1ee40 /src/input_common/helpers/touch_from_buttons.cpp
parentMerge pull request #9226 from Kelebek1/regs_regression (diff)
downloadyuzu-38c48cf8d896f28f7424b28265110c34f69d2369.tar.gz
yuzu-38c48cf8d896f28f7424b28265110c34f69d2369.tar.xz
yuzu-38c48cf8d896f28f7424b28265110c34f69d2369.zip
core: hid: Implement true multitouch support
Diffstat (limited to 'src/input_common/helpers/touch_from_buttons.cpp')
-rw-r--r--src/input_common/helpers/touch_from_buttons.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/input_common/helpers/touch_from_buttons.cpp b/src/input_common/helpers/touch_from_buttons.cpp
index da4a3dca5..003a38da5 100644
--- a/src/input_common/helpers/touch_from_buttons.cpp
+++ b/src/input_common/helpers/touch_from_buttons.cpp
@@ -10,8 +10,8 @@ namespace InputCommon {
10class TouchFromButtonDevice final : public Common::Input::InputDevice { 10class TouchFromButtonDevice final : public Common::Input::InputDevice {
11public: 11public:
12 using Button = std::unique_ptr<Common::Input::InputDevice>; 12 using Button = std::unique_ptr<Common::Input::InputDevice>;
13 TouchFromButtonDevice(Button button_, int touch_id_, float x_, float y_) 13 TouchFromButtonDevice(Button button_, float x_, float y_)
14 : button(std::move(button_)), touch_id(touch_id_), x(x_), y(y_) { 14 : button(std::move(button_)), x(x_), y(y_) {
15 last_button_value = false; 15 last_button_value = false;
16 button->SetCallback({ 16 button->SetCallback({
17 .on_change = 17 .on_change =
@@ -34,7 +34,6 @@ public:
34 .pressed = button_status, 34 .pressed = button_status,
35 .x = {}, 35 .x = {},
36 .y = {}, 36 .y = {},
37 .id = touch_id,
38 }; 37 };
39 status.x.properties = properties; 38 status.x.properties = properties;
40 status.y.properties = properties; 39 status.y.properties = properties;
@@ -62,7 +61,6 @@ public:
62private: 61private:
63 Button button; 62 Button button;
64 bool last_button_value; 63 bool last_button_value;
65 const int touch_id;
66 const float x; 64 const float x;
67 const float y; 65 const float y;
68 const Common::Input::AnalogProperties properties{0.0f, 1.0f, 0.5f, 0.0f, false}; 66 const Common::Input::AnalogProperties properties{0.0f, 1.0f, 0.5f, 0.0f, false};
@@ -73,10 +71,9 @@ std::unique_ptr<Common::Input::InputDevice> TouchFromButton::Create(
73 const std::string null_engine = Common::ParamPackage{{"engine", "null"}}.Serialize(); 71 const std::string null_engine = Common::ParamPackage{{"engine", "null"}}.Serialize();
74 auto button = Common::Input::CreateDeviceFromString<Common::Input::InputDevice>( 72 auto button = Common::Input::CreateDeviceFromString<Common::Input::InputDevice>(
75 params.Get("button", null_engine)); 73 params.Get("button", null_engine));
76 const auto touch_id = params.Get("touch_id", 0);
77 const float x = params.Get("x", 0.0f) / 1280.0f; 74 const float x = params.Get("x", 0.0f) / 1280.0f;
78 const float y = params.Get("y", 0.0f) / 720.0f; 75 const float y = params.Get("y", 0.0f) / 720.0f;
79 return std::make_unique<TouchFromButtonDevice>(std::move(button), touch_id, x, y); 76 return std::make_unique<TouchFromButtonDevice>(std::move(button), x, y);
80} 77}
81 78
82} // namespace InputCommon 79} // namespace InputCommon