diff --git a/src/Window_Web.c b/src/Window_Web.c index 6b20da6bc..ed8036cdc 100644 --- a/src/Window_Web.c +++ b/src/Window_Web.c @@ -571,7 +571,14 @@ static void Cursor_DoSetVisible(cc_bool visible) { /*########################################################################################################################* *-------------------------------------------------------Gamepads----------------------------------------------------------* *#########################################################################################################################*/ -void Gamepads_Init(void) { } +void Gamepads_Init(void) { + /* TODO find a better solution */ + int count; + if (emscripten_sample_gamepad_data() != 0) return; + count = emscripten_get_num_gamepads(); + + if (count) Input.Sources |= INPUT_SOURCE_GAMEPAD; +} /* https://www.w3.org/TR/gamepad/#dfn-standard-gamepad */ #define GetGamepadButton(i) i < numButtons ? ev->digitalButton[i] : 0