godot/platform/web
Lisandro Lorea d92f9017c6
Fix gamepad triggers not working on web exports
Fixes #81758

DisplayServerWeb::process_joypads handles buttons 6 and 7 of the
HTML5 Standard Gamepad as a special case by doing:
`input->joy_axis(idx, (JoyAxis)b, s_btns[b]);`

This doesn't work because there is no JoyAxis 6 or 7 in the enum

To fix this we use JoyAxis::TRIGGER_LEFT and TRIGGER_RIGHT for button 6
and 7

However since we are now lying to input->joy_axis we also need to lie in
the mappings for the standard gamepad in godotcontrollersdb.txt,
otherwise input->joy_axis will try to find a mapping to axis 4(LT) and
axis 5(RT) that's not defined.

Therefore we set lefttrigger to +a4 and righttrigger to +a5 in the
mapping, to match what we are actually sending.

A cleaner, and more involved fix to this would be modifying
input->joy_button so that it can handle analog buttons and map them to
axes preserving their value instead of converting to boolean

(cherry picked from commit 9dd372f316)
2024-09-17 08:57:45 +02:00
..
api Organize existing code for editor plugins 2024-04-27 11:59:58 -07:00
doc_classes [Doc] Fix some incorrect uses of `a/an` 2024-03-13 21:20:28 +01:00
export Fix AudioStreamPlayer get_playback_position() for web build 2024-09-16 16:41:06 +02:00
js Honor `pitch_scale` value before playing audio sample 2024-09-16 17:15:29 +02:00
README.md Update all outdated online documentation links 2023-01-14 19:38:00 +03:00
SCsub [Web] Remove unnecessary EMCC_FORCE_STDLIBS in dlink builds 2024-07-02 16:47:00 +02:00
audio_driver_web.cpp Honor `pitch_scale` value before playing audio sample 2024-09-16 17:15:29 +02:00
audio_driver_web.h Fix AudioStreamPlayer get_playback_position() for web build 2024-09-16 16:41:06 +02:00
detect.py [Web] Add workaround for missing export in threaded builds 2024-07-26 12:28:36 +02:00
display_server_web.cpp Fix gamepad triggers not working on web exports 2024-09-17 08:57:45 +02:00
display_server_web.h Merge pull request #91695 from bruvzg/web_ime_pos 2024-05-28 15:48:42 +02:00
dom_keys.inc Add InputEventKey.location to tell left from right 2024-01-26 14:42:28 +01:00
emscripten_helpers.py Fix AudioStreamPlayer get_playback_position() for web build 2024-09-16 16:41:06 +02:00
eslint.config.cjs Add samples playback support 2024-06-18 11:06:31 -04:00
godot_audio.h Honor `pitch_scale` value before playing audio sample 2024-09-16 17:15:29 +02:00
godot_js.h [Web] Add IME input support. 2023-12-15 19:11:10 +02:00
godot_webgl2.h Add MSAA support for WebXR 2023-12-11 09:01:24 -06:00
http_client_web.cpp [Web] Always return -1 as body length in HTTPClientWeb. 2023-07-24 08:57:02 +02:00
http_client_web.h [Web] Always return -1 as body length in HTTPClientWeb. 2023-07-24 08:57:02 +02:00
javascript_bridge_singleton.cpp Replace `.bind(...).call_deferred()` with `.call_deferred(...)` 2024-05-27 13:29:57 +02:00
os_web.cpp Reduce and prevent unnecessary random-access to `List` 2024-05-04 16:08:55 +02:00
os_web.h Implement `amplitude` to Input.vibrate_handheld 2024-05-02 19:09:42 +03:00
package-lock.json Upgrade to eslint 9 2024-05-22 11:32:25 +02:00
package.json Upgrade to eslint 9 2024-05-22 11:32:25 +02:00
platform_config.h [macOS/Windows] Add optional ANGLE backed OpenGL renderer support. Add EGL_ANDROID_blob_cache caching. 2023-09-21 14:21:00 +03:00
platform_gl.h Disable `*glGetProcAddress()` on the web 2024-06-24 10:57:22 -05:00
serve.py Update pre-commit hooks configuration to use `ruff` instead of `black` 2024-05-21 18:02:29 -05:00
web_main.cpp Fix missing include in Web main after #93906 2024-07-05 14:40:44 +02:00
web_runtime.cpp One Copyright Update to rule them all 2023-01-05 13:25:55 +01:00

README.md

Web platform port

This folder contains the C++ and JavaScript code for the Web platform port, compiled using Emscripten.

It also contains a ESLint linting setup (see package.json).

See also misc/dist/html folder for additional files used by this platform such as the html shell (web page).

Documentation

Artwork license

logo.png and run_icon.png are licensed under Creative Commons Attribution 3.0 Unported per the HTML5 logo usage guidelines.