bug fix: would only detect first XBOX button press

This commit is contained in:
Fred 2015-02-15 19:56:17 +00:00
parent 9979e50426
commit 199612e93e

View file

@ -262,10 +262,10 @@ void XBOXONE::readReport() {
ButtonState |= XBOX_BUTTONS[XBOX]; ButtonState |= XBOX_BUTTONS[XBOX];
} }
else { else {
ButtonState &= XBOX_BUTTONS[XBOX]; ButtonState &= ~XBOX_BUTTONS[XBOX];
} }
if(ButtonState != OldButtonState) { if(ButtonState != OldButtonState) {
ButtonClickState = ButtonState & ~OldButtonState; // Update click state variable, but don't include the two trigger buttons L2 and R2 ButtonClickState = ButtonState & ~OldButtonState; // Update click state variable
OldButtonState = ButtonState; OldButtonState = ButtonState;
} }
} }
@ -296,7 +296,7 @@ void XBOXONE::readReport() {
ButtonClickState = ButtonState & ~OldButtonState; // Update click state variable ButtonClickState = ButtonState & ~OldButtonState; // Update click state variable
OldButtonState = ButtonState; OldButtonState = ButtonState;
} }
// handle click detection for triggers
if (triggerValue[0] != triggerValueOld[0]) { if (triggerValue[0] != triggerValueOld[0]) {
triggerValueOld[0] = triggerValue[0]; triggerValueOld[0] = triggerValue[0];
L2Clicked = true; L2Clicked = true;