Make TouchButton not always override other input. Modify mappings.

This commit is contained in:
Henrik Rydgård committed 2012-12-26 08:25:38 +01:00
1 parent 8fd4f592ad
commit 1556328129
2 files changed
+8 -7

No files matched your search

+2 -1
View File
@@ -16,6 +16,7 @@ TouchButton::TouchButton(const Atlas *atlas, int imageIndex, int overlayImageInd
void TouchButton::update(InputState &input_state)
{
bool oldIsDown = isDown_;
isDown_ = false;
for (int i = 0; i < MAX_POINTERS; i++) {
if (input_state.pointer_down[i] && isInside(input_state.pointer_x[i], input_state.pointer_y[i]))
@@ -24,7 +25,7 @@ void TouchButton::update(InputState &input_state)
if (isDown_) {
input_state.pad_buttons |= button_;
} else {
} else if (oldIsDown && !isDown_) {
input_state.pad_buttons &= ~button_;
}
}