summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2021-05-17 21:04:58 +0200
committerLioncash <mathew1800@gmail.com>2021-05-18 09:32:42 +0200
commit2f1ef3910ba9fa7d6ac412039ff4b6541008a28b (patch)
tree35bcfec1401b31fc194eb59016667593b7cf8d35
parenthid/gesture: Rename Points to Point (diff)
downloadyuzu-2f1ef3910ba9fa7d6ac412039ff4b6541008a28b.tar
yuzu-2f1ef3910ba9fa7d6ac412039ff4b6541008a28b.tar.gz
yuzu-2f1ef3910ba9fa7d6ac412039ff4b6541008a28b.tar.bz2
yuzu-2f1ef3910ba9fa7d6ac412039ff4b6541008a28b.tar.lz
yuzu-2f1ef3910ba9fa7d6ac412039ff4b6541008a28b.tar.xz
yuzu-2f1ef3910ba9fa7d6ac412039ff4b6541008a28b.tar.zst
yuzu-2f1ef3910ba9fa7d6ac412039ff4b6541008a28b.zip
-rw-r--r--src/core/hle/service/hid/controllers/gesture.cpp11
-rw-r--r--src/core/hle/service/hid/controllers/gesture.h6
2 files changed, 7 insertions, 10 deletions
diff --git a/src/core/hle/service/hid/controllers/gesture.cpp b/src/core/hle/service/hid/controllers/gesture.cpp
index d311f754b..07b3a6095 100644
--- a/src/core/hle/service/hid/controllers/gesture.cpp
+++ b/src/core/hle/service/hid/controllers/gesture.cpp
@@ -91,8 +91,7 @@ bool Controller_Gesture::ShouldUpdateGesture(const GestureProperties& gesture,
// Update if coordinates change
for (size_t id = 0; id < MAX_POINTS; id++) {
- if (gesture.points[id].x != last_gesture.points[id].x ||
- gesture.points[id].y != last_gesture.points[id].y) {
+ if (gesture.points[id] != last_gesture.points[id]) {
return true;
}
}
@@ -179,8 +178,7 @@ void Controller_Gesture::UpdateExistingGesture(GestureProperties& gesture, Touch
// Promote to pan type if touch moved
for (size_t id = 0; id < MAX_POINTS; id++) {
- if (gesture.points[id].x != last_gesture.points[id].x ||
- gesture.points[id].y != last_gesture.points[id].y) {
+ if (gesture.points[id] != last_gesture.points[id]) {
type = TouchType::Pan;
break;
}
@@ -192,10 +190,7 @@ void Controller_Gesture::UpdateExistingGesture(GestureProperties& gesture, Touch
enable_press_and_tap = false;
gesture.active_points = 0;
gesture.mid_point = {};
- for (size_t id = 0; id < MAX_POINTS; id++) {
- gesture.points[id].x = 0;
- gesture.points[id].y = 0;
- }
+ gesture.points.fill({});
return;
}
diff --git a/src/core/hle/service/hid/controllers/gesture.h b/src/core/hle/service/hid/controllers/gesture.h
index 21123c46c..619b6f3dc 100644
--- a/src/core/hle/service/hid/controllers/gesture.h
+++ b/src/core/hle/service/hid/controllers/gesture.h
@@ -64,8 +64,10 @@ private:
static_assert(sizeof(Attribute) == 4, "Attribute is an invalid size");
struct Point {
- s32_le x;
- s32_le y;
+ s32_le x{};
+ s32_le y{};
+
+ friend bool operator==(const Point&, const Point&) = default;
};
static_assert(sizeof(Point) == 8, "Point is an invalid size");