1
0
Fork 0
godot/core/input
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
..
SCsub
default_controller_mappings.h
gamecontrollerdb.txt
godotcontrollerdb.txt Fix gamepad triggers not working on web exports 2024-08-14 16:13:16 -03:00
input.compat.inc
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
input_enums.h
input_event.cpp
input_event.h
input_map.cpp Add Home/End to text caret movements on macOS 2024-07-08 16:08:27 +02:00
input_map.h
shortcut.cpp
shortcut.h