mirror of https://github.com/encounter/SDL.git
Better patch to make it more clear what's going on
This commit is contained in:
parent
3fbaa5da05
commit
747df96eb0
|
@ -763,7 +763,7 @@ HandleHat(SDL_Joystick * stick, Uint8 hat, int axis, int value)
|
||||||
{SDL_HAT_LEFTDOWN, SDL_HAT_DOWN, SDL_HAT_RIGHTDOWN}
|
{SDL_HAT_LEFTDOWN, SDL_HAT_DOWN, SDL_HAT_RIGHTDOWN}
|
||||||
};
|
};
|
||||||
|
|
||||||
the_hat = &stick->hwdata->hats[stick->hwdata->hats_indices[hat]];
|
the_hat = &stick->hwdata->hats[hat];
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
value = 0;
|
value = 0;
|
||||||
} else if (value == 0) {
|
} else if (value == 0) {
|
||||||
|
@ -773,7 +773,7 @@ HandleHat(SDL_Joystick * stick, Uint8 hat, int axis, int value)
|
||||||
}
|
}
|
||||||
if (value != the_hat->axis[axis]) {
|
if (value != the_hat->axis[axis]) {
|
||||||
the_hat->axis[axis] = value;
|
the_hat->axis[axis] = value;
|
||||||
SDL_PrivateJoystickHat(stick, stick->hwdata->hats_indices[hat],
|
SDL_PrivateJoystickHat(stick, hat,
|
||||||
position_map[the_hat->axis[1]][the_hat->axis[0]]);
|
position_map[the_hat->axis[1]][the_hat->axis[0]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -875,7 +875,7 @@ HandleInputEvents(SDL_Joystick * joystick)
|
||||||
case ABS_HAT3X:
|
case ABS_HAT3X:
|
||||||
case ABS_HAT3Y:
|
case ABS_HAT3Y:
|
||||||
code -= ABS_HAT0X;
|
code -= ABS_HAT0X;
|
||||||
HandleHat(joystick, code / 2, code % 2, events[i].value);
|
HandleHat(joystick, joystick->hwdata->hats_indices[code / 2], code % 2, events[i].value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (joystick->hwdata->abs_map[code] != 0xFF) {
|
if (joystick->hwdata->abs_map[code] != 0xFF) {
|
||||||
|
|
Loading…
Reference in New Issue