Make TouchButton not always override other input. Modify mappings.

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

View File

@ -91,14 +91,14 @@ void LaunchEmail(const char *email_address)
const int buttonMappings[14] = {
SDLK_x, //A
SDLK_s, //B
SDLK_z, //X
SDLK_a, //Y
SDLK_z, //A
SDLK_x, //B
SDLK_a, //X
SDLK_s, //Y
SDLK_w, //LBUMPER
SDLK_q, //RBUMPER
SDLK_1, //START
SDLK_2, //SELECT
SDLK_SPACE, //START
SDLK_v, //SELECT
SDLK_UP, //UP
SDLK_DOWN, //DOWN
SDLK_LEFT, //LEFT

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_;
}
}