Skip to content

Commit 82a800e

Browse files
committed
emscripten: Let joystick dpad-to-hat conversion allow impossible combinations.
This matches what other backends do.
1 parent b58d0f8 commit 82a800e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/joystick/emscripten/SDL_sysjoystick.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,14 @@ static EM_BOOL Emscripten_JoyStickConnected(int eventType, const EmscriptenGamep
100100
// this currently expects the first button to be up, then down, then left, then right.
101101
if (gamepadEvent->digitalButton[first_hat_button + 0]) {
102102
value |= SDL_HAT_UP;
103-
} else if (gamepadEvent->digitalButton[first_hat_button + 1]) {
103+
}
104+
if (gamepadEvent->digitalButton[first_hat_button + 1]) {
104105
value |= SDL_HAT_DOWN;
105106
}
106107
if (gamepadEvent->digitalButton[first_hat_button + 2]) {
107108
value |= SDL_HAT_LEFT;
108-
} else if (gamepadEvent->digitalButton[first_hat_button + 3]) {
109+
}
110+
if (gamepadEvent->digitalButton[first_hat_button + 3]) {
109111
value |= SDL_HAT_RIGHT;
110112
}
111113
item->hat = value;

0 commit comments

Comments
 (0)