diff options
author | bunnei <bunneidev@gmail.com> | 2021-01-20 22:39:01 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-20 22:39:01 -0800 |
commit | a1335d3d5142f47602e54a51d09ed16d22164271 (patch) | |
tree | 91e3d396895e1d915cbaef7a7151d119b43a646e /src/input_common/touch_from_button.cpp | |
parent | ffbde909c86cef97a0c8352dece27a4980dedbc7 (diff) | |
parent | b483f2d010bf745ab873e8f8bfaca5515e56d39f (diff) |
Merge pull request #5270 from german77/multiTouch
HID: Add multitouch support
Diffstat (limited to 'src/input_common/touch_from_button.cpp')
-rw-r--r-- | src/input_common/touch_from_button.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/input_common/touch_from_button.cpp b/src/input_common/touch_from_button.cpp index a07124a86..ffbe4f2ed 100644 --- a/src/input_common/touch_from_button.cpp +++ b/src/input_common/touch_from_button.cpp @@ -25,18 +25,19 @@ public: } } - std::tuple<float, float, bool> GetStatus() const override { - for (const auto& m : map) { - const bool state = std::get<0>(m)->GetStatus(); + Input::TouchStatus GetStatus() const override { + Input::TouchStatus touch_status{}; + for (std::size_t id = 0; id < map.size() && id < touch_status.size(); ++id) { + const bool state = std::get<0>(map[id])->GetStatus(); if (state) { - const float x = static_cast<float>(std::get<1>(m)) / + const float x = static_cast<float>(std::get<1>(map[id])) / static_cast<int>(Layout::ScreenUndocked::Width); - const float y = static_cast<float>(std::get<2>(m)) / + const float y = static_cast<float>(std::get<2>(map[id])) / static_cast<int>(Layout::ScreenUndocked::Height); - return {x, y, true}; + touch_status[id] = {x, y, true}; } } - return {}; + return touch_status; } private: |