mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
parent
5e978d4fd2
commit
ed8e61dc5d
1 changed files with 5 additions and 2 deletions
|
|
@ -805,8 +805,11 @@ void OS_JavaScript::process_joysticks() {
|
|||
int joy_count = emscripten_get_num_gamepads();
|
||||
for (int i = 0; i < joy_count; i++) {
|
||||
EmscriptenGamepadEvent state;
|
||||
emscripten_get_gamepad_status(i, &state);
|
||||
if (state.connected) {
|
||||
EMSCRIPTEN_RESULT query_result = emscripten_get_gamepad_status(i, &state);
|
||||
// Chromium reserves gamepads slots, so NO_DATA is an expected result.
|
||||
ERR_CONTINUE(query_result != EMSCRIPTEN_RESULT_SUCCESS &&
|
||||
query_result != EMSCRIPTEN_RESULT_NO_DATA);
|
||||
if (query_result == EMSCRIPTEN_RESULT_SUCCESS && state.connected) {
|
||||
|
||||
int num_buttons = MIN(state.numButtons, 18);
|
||||
int num_axes = MIN(state.numAxes, 8);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue