Skip to content

Commit

Permalink
Fix dpad analog overlap interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
iota97 committed Sep 21, 2021
1 parent d31eddf commit fc70333
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions UI/GamepadEmu.cpp
Expand Up @@ -97,16 +97,13 @@ void MultiTouchButton::GetContentDimensions(const UIContext &dc, float &w, float
}

void MultiTouchButton::Touch(const TouchInput &input) {
if (analogPointerMask & (1 << input.id))
return;

GamepadView::Touch(input);
if ((input.flags & TOUCH_DOWN) && bounds_.Contains(input.x, input.y)) {
pointerDownMask_ |= 1 << input.id;
usedPointerMask |= 1 << input.id;
}
if (input.flags & TOUCH_MOVE) {
if (bounds_.Contains(input.x, input.y))
if (bounds_.Contains(input.x, input.y) && !(analogPointerMask & (1 << input.id)))
pointerDownMask_ |= 1 << input.id;
else
pointerDownMask_ &= ~(1 << input.id);
Expand Down Expand Up @@ -156,9 +153,6 @@ void MultiTouchButton::Draw(UIContext &dc) {
}

void BoolButton::Touch(const TouchInput &input) {
if (analogPointerMask & (1 << input.id))
return;

bool lastDown = pointerDownMask_ != 0;
MultiTouchButton::Touch(input);
bool down = pointerDownMask_ != 0;
Expand All @@ -172,9 +166,6 @@ void BoolButton::Touch(const TouchInput &input) {
}

void PSPButton::Touch(const TouchInput &input) {
if (analogPointerMask & (1 << input.id))
return;

bool lastDown = pointerDownMask_ != 0;
MultiTouchButton::Touch(input);
bool down = pointerDownMask_ != 0;
Expand Down Expand Up @@ -202,9 +193,6 @@ void ComboKey::GetContentDimensions(const UIContext &dc, float &w, float &h) con
}

void ComboKey::Touch(const TouchInput &input) {
if (analogPointerMask & (1 << input.id))
return;

using namespace CustomKey;
bool lastDown = pointerDownMask_ != 0;
MultiTouchButton::Touch(input);
Expand Down Expand Up @@ -244,9 +232,6 @@ void PSPDpad::GetContentDimensions(const UIContext &dc, float &w, float &h) cons
}

void PSPDpad::Touch(const TouchInput &input) {
if (analogPointerMask & (1 << input.id))
return;

GamepadView::Touch(input);

if (input.flags & TOUCH_DOWN) {
Expand All @@ -257,7 +242,7 @@ void PSPDpad::Touch(const TouchInput &input) {
}
}
if (input.flags & TOUCH_MOVE) {
if (dragPointerId_ == -1 && bounds_.Contains(input.x, input.y)) {
if (dragPointerId_ == -1 && bounds_.Contains(input.x, input.y) && !(analogPointerMask & (1 << input.id))) {
dragPointerId_ = input.id;
}
if (input.id == dragPointerId_) {
Expand Down

0 comments on commit fc70333

Please sign in to comment.