diff options
author | bunnei <bunneidev@gmail.com> | 2021-05-30 10:35:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-30 10:35:26 +0200 |
commit | a5ebba7e366dcd2b8818c6748296ca5fdeb45ad2 (patch) | |
tree | b6be6dbfb6f5b4199cb5accaeba43493d80b2f7e /src/core/hle/service/hid/controllers/touchscreen.cpp | |
parent | Merge pull request #6387 from lioncash/class-token (diff) | |
parent | touchscreen: Make use of common point struct (diff) | |
download | yuzu-a5ebba7e366dcd2b8818c6748296ca5fdeb45ad2.tar yuzu-a5ebba7e366dcd2b8818c6748296ca5fdeb45ad2.tar.gz yuzu-a5ebba7e366dcd2b8818c6748296ca5fdeb45ad2.tar.bz2 yuzu-a5ebba7e366dcd2b8818c6748296ca5fdeb45ad2.tar.lz yuzu-a5ebba7e366dcd2b8818c6748296ca5fdeb45ad2.tar.xz yuzu-a5ebba7e366dcd2b8818c6748296ca5fdeb45ad2.tar.zst yuzu-a5ebba7e366dcd2b8818c6748296ca5fdeb45ad2.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/hid/controllers/touchscreen.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp index ac9112c40..6ef17acc5 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.cpp +++ b/src/core/hle/service/hid/controllers/touchscreen.cpp @@ -74,8 +74,11 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin for (std::size_t id = 0; id < MAX_FINGERS; ++id) { auto& touch_entry = cur_entry.states[id]; if (id < active_fingers_count) { - touch_entry.x = static_cast<u16>(active_fingers[id].x * Layout::ScreenUndocked::Width); - touch_entry.y = static_cast<u16>(active_fingers[id].y * Layout::ScreenUndocked::Height); + const auto& [active_x, active_y] = active_fingers[id].position; + touch_entry.position = { + .x = static_cast<u16>(active_x * Layout::ScreenUndocked::Width), + .y = static_cast<u16>(active_y * Layout::ScreenUndocked::Height), + }; touch_entry.diameter_x = Settings::values.touchscreen.diameter_x; touch_entry.diameter_y = Settings::values.touchscreen.diameter_y; touch_entry.rotation_angle = Settings::values.touchscreen.rotation_angle; @@ -86,8 +89,7 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin } else { // Clear touch entry touch_entry.attribute.raw = 0; - touch_entry.x = 0; - touch_entry.y = 0; + touch_entry.position = {}; touch_entry.diameter_x = 0; touch_entry.diameter_y = 0; touch_entry.rotation_angle = 0; @@ -140,8 +142,7 @@ std::size_t Controller_Touchscreen::UpdateTouchInputEvent( fingers[finger_id].id = static_cast<u32_le>(finger_id); attribute.start_touch.Assign(1); } - fingers[finger_id].x = x; - fingers[finger_id].y = y; + fingers[finger_id].position = {x, y}; fingers[finger_id].attribute = attribute; return finger_id; } |