godot/platform/web
Lisandro Lorea 9dd372f316 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
2024-08-14 16:13:16 -03:00
..
api
doc_classes
export Fix web export state for remote debug 2024-06-26 08:37:56 -04:00
js Add missing null check before disconnecting source 2024-07-30 15:00:58 -04:00
audio_driver_web.cpp Fix audio samples not being able to be "finished" 2024-07-17 10:45:38 -04:00
audio_driver_web.h Fix Web samples finished missing signal 2024-07-07 14:47:54 -04: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-08-14 16:13:16 -03:00
display_server_web.h
dom_keys.inc
emscripten_helpers.py
eslint.config.cjs Add samples playback support 2024-06-18 11:06:31 -04:00
godot_audio.h Fix Web samples finished missing signal 2024-07-07 14:47:54 -04:00
godot_js.h
godot_webgl2.h
http_client_web.cpp
http_client_web.h
javascript_bridge_singleton.cpp
os_web.cpp
os_web.h
package-lock.json
package.json
platform_config.h
platform_gl.h Disable *glGetProcAddress() on the web 2024-06-24 10:57:22 -05:00
README.md
SCsub [Web] Remove unnecessary EMCC_FORCE_STDLIBS in dlink builds 2024-07-02 16:47:00 +02:00
serve.py
web_main.cpp Fix missing include in Web main after #93906 2024-07-05 14:40:44 +02:00
web_runtime.cpp

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.