godot/core/input
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
..
SCsub Update pre-commit hooks configuration to use `ruff` instead of `black` 2024-05-21 18:02:29 -05:00
default_controller_mappings.h One Copyright Update to rule them all 2023-01-05 13:25:55 +01:00
gamecontrollerdb.txt Sync controller mappings DB with SDL 2 community repo 2024-04-24 11:55:55 +02:00
godotcontrollerdb.txt Fix gamepad triggers not working on web exports 2024-09-17 08:57:45 +02:00
input.compat.inc Implement `amplitude` to Input.vibrate_handheld 2024-05-02 19:09:42 +03:00
input.cpp Merge pull request #94413 from rburing/fix_action_press_tick 2024-07-17 11:44:31 +02:00
input.h Cleanup Android input on render thread settings 2024-07-09 09:15:18 -07:00
input_builders.py [Buildsystem] Fix encoding when reading files 2024-03-24 18:02:56 +01:00
input_enums.h Fix mouse-button-mask on button release in unit test 2023-02-08 01:17:40 +01:00
input_event.cpp Add event_index to InputEventAction 2024-05-30 12:51:15 +02:00
input_event.h Add event_index to InputEventAction 2024-05-30 12:51:15 +02:00
input_map.cpp Add Home/End to text caret movements on macOS 2024-07-08 16:08:27 +02:00
input_map.h Add autocompletion for InputMap's methods 2024-03-01 16:44:26 +01:00
shortcut.cpp One Copyright Update to rule them all 2023-01-05 13:25:55 +01:00
shortcut.h One Copyright Update to rule them all 2023-01-05 13:25:55 +01:00