summaryrefslogtreecommitdiff
path: root/src/input_common/helpers/touch_from_buttons.cpp
diff options
context:
space:
mode:
authorGravatar Narr the Reg2022-11-20 09:31:20 -0600
committerGravatar GitHub2022-11-20 09:31:20 -0600
commitdb7bcd51ae09c4ef25e08096de563903f61e2380 (patch)
tree5ae9977b48e1aff118fae3ebffb215b0b4afa887 /src/input_common/helpers/touch_from_buttons.cpp
parentservice: nfc: Implement nfc user (diff)
parentMerge pull request #9238 from german77/cabinet_applet (diff)
downloadyuzu-db7bcd51ae09c4ef25e08096de563903f61e2380.tar.gz
yuzu-db7bcd51ae09c4ef25e08096de563903f61e2380.tar.xz
yuzu-db7bcd51ae09c4ef25e08096de563903f61e2380.zip
Merge branch 'master' into nfc_impl
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