mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-03 10:30:00 +00:00
hid/gesture: Add default comparators to Point
Simplifies some comparisons.
This commit is contained in:
parent
60831eabd9
commit
2f1ef3910b
2 changed files with 7 additions and 10 deletions
|
@ -91,8 +91,7 @@ bool Controller_Gesture::ShouldUpdateGesture(const GestureProperties& gesture,
|
||||||
|
|
||||||
// Update if coordinates change
|
// Update if coordinates change
|
||||||
for (size_t id = 0; id < MAX_POINTS; id++) {
|
for (size_t id = 0; id < MAX_POINTS; id++) {
|
||||||
if (gesture.points[id].x != last_gesture.points[id].x ||
|
if (gesture.points[id] != last_gesture.points[id]) {
|
||||||
gesture.points[id].y != last_gesture.points[id].y) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,8 +178,7 @@ void Controller_Gesture::UpdateExistingGesture(GestureProperties& gesture, Touch
|
||||||
|
|
||||||
// Promote to pan type if touch moved
|
// Promote to pan type if touch moved
|
||||||
for (size_t id = 0; id < MAX_POINTS; id++) {
|
for (size_t id = 0; id < MAX_POINTS; id++) {
|
||||||
if (gesture.points[id].x != last_gesture.points[id].x ||
|
if (gesture.points[id] != last_gesture.points[id]) {
|
||||||
gesture.points[id].y != last_gesture.points[id].y) {
|
|
||||||
type = TouchType::Pan;
|
type = TouchType::Pan;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -192,10 +190,7 @@ void Controller_Gesture::UpdateExistingGesture(GestureProperties& gesture, Touch
|
||||||
enable_press_and_tap = false;
|
enable_press_and_tap = false;
|
||||||
gesture.active_points = 0;
|
gesture.active_points = 0;
|
||||||
gesture.mid_point = {};
|
gesture.mid_point = {};
|
||||||
for (size_t id = 0; id < MAX_POINTS; id++) {
|
gesture.points.fill({});
|
||||||
gesture.points[id].x = 0;
|
|
||||||
gesture.points[id].y = 0;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,8 +64,10 @@ private:
|
||||||
static_assert(sizeof(Attribute) == 4, "Attribute is an invalid size");
|
static_assert(sizeof(Attribute) == 4, "Attribute is an invalid size");
|
||||||
|
|
||||||
struct Point {
|
struct Point {
|
||||||
s32_le x;
|
s32_le x{};
|
||||||
s32_le y;
|
s32_le y{};
|
||||||
|
|
||||||
|
friend bool operator==(const Point&, const Point&) = default;
|
||||||
};
|
};
|
||||||
static_assert(sizeof(Point) == 8, "Point is an invalid size");
|
static_assert(sizeof(Point) == 8, "Point is an invalid size");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue