diff options
| author | 2022-11-05 10:39:03 -0600 | |
|---|---|---|
| committer | 2022-11-19 08:44:33 -0600 | |
| commit | 38c48cf8d896f28f7424b28265110c34f69d2369 (patch) | |
| tree | 5777e9fafc1ec4182068daa8d7a0ab9630d1ee40 /src/input_common/input_poller.cpp | |
| parent | Merge pull request #9226 from Kelebek1/regs_regression (diff) | |
| download | yuzu-38c48cf8d896f28f7424b28265110c34f69d2369.tar.gz yuzu-38c48cf8d896f28f7424b28265110c34f69d2369.tar.xz yuzu-38c48cf8d896f28f7424b28265110c34f69d2369.zip | |
core: hid: Implement true multitouch support
Diffstat (limited to 'src/input_common/input_poller.cpp')
| -rw-r--r-- | src/input_common/input_poller.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/input_common/input_poller.cpp b/src/input_common/input_poller.cpp index 4ac182147..fb8be42e2 100644 --- a/src/input_common/input_poller.cpp +++ b/src/input_common/input_poller.cpp | |||
| @@ -229,13 +229,12 @@ private: | |||
| 229 | 229 | ||
| 230 | class InputFromTouch final : public Common::Input::InputDevice { | 230 | class InputFromTouch final : public Common::Input::InputDevice { |
| 231 | public: | 231 | public: |
| 232 | explicit InputFromTouch(PadIdentifier identifier_, int touch_id_, int button_, bool toggle_, | 232 | explicit InputFromTouch(PadIdentifier identifier_, int button_, bool toggle_, bool inverted_, |
| 233 | bool inverted_, int axis_x_, int axis_y_, | 233 | int axis_x_, int axis_y_, Common::Input::AnalogProperties properties_x_, |
| 234 | Common::Input::AnalogProperties properties_x_, | ||
| 235 | Common::Input::AnalogProperties properties_y_, | 234 | Common::Input::AnalogProperties properties_y_, |
| 236 | InputEngine* input_engine_) | 235 | InputEngine* input_engine_) |
| 237 | : identifier(identifier_), touch_id(touch_id_), button(button_), toggle(toggle_), | 236 | : identifier(identifier_), button(button_), toggle(toggle_), inverted(inverted_), |
| 238 | inverted(inverted_), axis_x(axis_x_), axis_y(axis_y_), properties_x(properties_x_), | 237 | axis_x(axis_x_), axis_y(axis_y_), properties_x(properties_x_), |
| 239 | properties_y(properties_y_), input_engine(input_engine_) { | 238 | properties_y(properties_y_), input_engine(input_engine_) { |
| 240 | UpdateCallback engine_callback{[this]() { OnChange(); }}; | 239 | UpdateCallback engine_callback{[this]() { OnChange(); }}; |
| 241 | const InputIdentifier button_input_identifier{ | 240 | const InputIdentifier button_input_identifier{ |
| @@ -271,8 +270,7 @@ public: | |||
| 271 | } | 270 | } |
| 272 | 271 | ||
| 273 | Common::Input::TouchStatus GetStatus() const { | 272 | Common::Input::TouchStatus GetStatus() const { |
| 274 | Common::Input::TouchStatus status; | 273 | Common::Input::TouchStatus status{}; |
| 275 | status.id = touch_id; | ||
| 276 | status.pressed = { | 274 | status.pressed = { |
| 277 | .value = input_engine->GetButton(identifier, button), | 275 | .value = input_engine->GetButton(identifier, button), |
| 278 | .inverted = inverted, | 276 | .inverted = inverted, |
| @@ -307,7 +305,6 @@ public: | |||
| 307 | 305 | ||
| 308 | private: | 306 | private: |
| 309 | const PadIdentifier identifier; | 307 | const PadIdentifier identifier; |
| 310 | const int touch_id; | ||
| 311 | const int button; | 308 | const int button; |
| 312 | const bool toggle; | 309 | const bool toggle; |
| 313 | const bool inverted; | 310 | const bool inverted; |
| @@ -919,7 +916,6 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateTriggerDevice( | |||
| 919 | 916 | ||
| 920 | std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateTouchDevice( | 917 | std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateTouchDevice( |
| 921 | const Common::ParamPackage& params) { | 918 | const Common::ParamPackage& params) { |
| 922 | const auto touch_id = params.Get("touch_id", 0); | ||
| 923 | const auto deadzone = std::clamp(params.Get("deadzone", 0.0f), 0.0f, 1.0f); | 919 | const auto deadzone = std::clamp(params.Get("deadzone", 0.0f), 0.0f, 1.0f); |
| 924 | const auto range = std::clamp(params.Get("range", 1.0f), 0.25f, 1.50f); | 920 | const auto range = std::clamp(params.Get("range", 1.0f), 0.25f, 1.50f); |
| 925 | const auto threshold = std::clamp(params.Get("threshold", 0.5f), 0.0f, 1.0f); | 921 | const auto threshold = std::clamp(params.Get("threshold", 0.5f), 0.0f, 1.0f); |
| @@ -954,8 +950,8 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateTouchDevice( | |||
| 954 | input_engine->PreSetAxis(identifier, axis_x); | 950 | input_engine->PreSetAxis(identifier, axis_x); |
| 955 | input_engine->PreSetAxis(identifier, axis_y); | 951 | input_engine->PreSetAxis(identifier, axis_y); |
| 956 | input_engine->PreSetButton(identifier, button); | 952 | input_engine->PreSetButton(identifier, button); |
| 957 | return std::make_unique<InputFromTouch>(identifier, touch_id, button, toggle, inverted, axis_x, | 953 | return std::make_unique<InputFromTouch>(identifier, button, toggle, inverted, axis_x, axis_y, |
| 958 | axis_y, properties_x, properties_y, input_engine.get()); | 954 | properties_x, properties_y, input_engine.get()); |
| 959 | } | 955 | } |
| 960 | 956 | ||
| 961 | std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateBatteryDevice( | 957 | std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateBatteryDevice( |