Commit Graph

321 Commits

Author SHA1 Message Date
6772047e50 Sync controller mappings DB with SDL 2 community repo
Synced with mdqinc/SDL_GameControllerDB@4c9b8dace8
2024-04-08 22:22:30 +02:00
41e70db8b1 Fix action_press() by clamping strength to 0, 1
Changed Input.action_press() treatment of strength parameter to match
behavior of InputEventAction and documentation, by clamping between 0
and 1. Fixes Input.get_action_strength() returning values over 1 when
large values are passed to Input.action_press().
2024-03-27 11:17:40 -04:00
f371b7fb70 Merge pull request #87883 from TontonSancho/text-skip-occurence
Add 'Skip to next (text) occurrence' feature to text editor
2024-03-25 13:15:56 +01:00
c988bec4b3 Add 'Skip to next (text) occurrence' feature to text editor
Adds `ui_text_skip_selection_for_next_occurrence` action and related implementation to text editor.
This action is bound `Ctrl+Alt+D` shorcut.

Used in conjonction with `ui_add_skip_selection_for_next_occurrence`, it gives the user the ability to select many occurrences of a selection
and avoid some of them.
Used without a previous selection, the action jumps to the next occurrence of the current word under the caret.
2024-03-25 11:12:28 +01:00
4933fa8bf5 [Buildsystem] Fix encoding when reading files 2024-03-24 18:02:56 +01:00
6818e50adc Expose DEVICE_ID_EMULATION constant in InputEvent
This also improves the documentation related to emulated InputEvents.
2024-03-16 19:16:40 +01:00
5a6e3cbcb0 SCons: Remove run_in_subprocess dependency 2024-03-11 13:20:09 -05:00
fb299d0fb1 SCons: Ensure with statement where applicable 2024-03-10 12:57:57 -05:00
d9fa40f2df Enforce \n eol for Python writes
• Ensure utf-8 encoding if previously unspecified
2024-03-09 14:29:24 -06:00
0ce9b6fd1d Add two new COMSTR environment variables 2024-03-01 12:44:03 -06:00
70b428041b Add autocompletion for InputMap's methods 2024-03-01 16:44:26 +01:00
cd2032a90b Optimise Object's get_argument_options 2024-02-29 18:00:54 +01:00
a8bc9f3e78 Add const lvalue ref to core/* container parameters 2024-02-14 11:20:36 -03:00
2235a1cbd0 Add screen-related attributes to mouse input events 2024-02-05 23:30:15 +01:00
10445d80d8 Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@232c738ce0
2024-01-30 15:14:27 +01:00
8406e60522 Add InputEventKey.location to tell left from right
This adds a new enum `KeyLocation` and associated property
`InputEventKey.location`, which indicates the left/right location of key
events which may come from one of two physical keys, eg. Shift, Ctrl.

It also adds simulation of missing Shift KEYUP events for Windows.
When multiple Shifts are held down at the same time, Windows natively
only sends a KEYUP for the last one to be released.
2024-01-26 14:42:28 +01:00
2ababdcc06 Merge pull request #87324 from jsjtxietian/action-exist
Check action exists in `Input.action_press` and `action_release`
2024-01-18 19:27:06 +01:00
4b3a12f4ee Check action exists in Input.action_press and action_release 2024-01-18 16:18:16 +08:00
0a7579b161 Fix #if *_ENABLED inconsistencies, should check if defined
Co-authored-by: Caroline Joy Bell <halotroop2288@proton.me>
2024-01-17 10:30:15 +01:00
6c390b620d Merge pull request #84445 from Rubonnek/add-const-references-clang-tidy
Add const references detected by clang-tidy
2024-01-04 14:25:33 +01:00
ca2f340384 Fix missing autocompletion for inheriting classes 2024-01-03 00:13:04 +01:00
a3cb1b096f Add const references detected by clang-tidy 2023-12-16 13:36:44 -05:00
075a54bbcf Add bindings for setting and getting emulation mouse from touch and touch from mouse in input 2023-12-13 08:07:36 +03:00
8cfcd36253 Rework action pressed state to support multiple controllers 2023-12-04 18:02:51 +01:00
d9d0cfaf38 Rework input actions to be reliable 2023-11-10 15:24:04 +01:00
d3c0a7d598 Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@eb831f75ab

Fixes #83552.
2023-10-23 16:11:38 +02:00
e6e9b04aab Merge pull request #81322 from johnnyw/android_fix_joypad_trigger_range
Android: Fix joypad trigger value range
2023-10-20 22:02:00 +02:00
d413a02079 Android: Fix joypad trigger value range
`Input::joy_axis` converts trigger values to be between 0.0f to 1.0f by default. This is not needed for Android, as values are already within that range, as per Android documentation: https://developer.android.com/reference/android/view/MotionEvent#AXIS_RTRIGGER

This patch prevents this conversion on Android, which caused L2 and R2 triggers to get stuck pressed. https://github.com/godotengine/godot/issues/79263
2023-10-20 11:30:20 -07:00
ccb8ea613a Fix Input.is_action_just_pressed flicker on joypad axes
Pressed tick assignments were in the wrong scope, resulting in updating
`pressed_frame` even when it shouldn't and therefore the `just_pressed`
would return true every time that the strength changes and not only when
there's a new valid press.

Fixes #81975.
2023-10-16 11:41:56 +02:00
0b4959bdf0 Merge pull request #82203 from KoBeWi/shortcuts_under_pressure
Make InputEventShortcut always pressed
2023-09-24 23:36:09 +02:00
e40b0b3ed8 Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@fc4b33c872
2023-09-24 15:51:12 +02:00
90a0b19301 Make InputEventShortcut always pressed 2023-09-23 19:43:07 +02:00
5f5ca23586 Merge pull request #81170 from KoBeWi/step_input
Prevent axis-based actions from getting stuck
2023-09-11 15:37:42 +02:00
8de6405288 UWP: Remove platform port, needs to be redone from scratch for 4.x
The UWP platform port was never ported to the Godot 4.0+ API,
and it's now accumulating bitrot as it doesn't compile, and thus
we no longer propagate platform changes in it.

So we finally remove to acknowledge this state. There's still some
interest in reviving the UWP port eventually, especially as support
for Direct3D 12 will soon be merged, but when that happens it will
be easiest to redo it from scratch.
2023-09-07 15:01:59 +02:00
a490fad82d Prevent axis-based actions from getting stuck 2023-09-04 15:47:26 +02:00
5b95935e18 Remove debug print 2023-08-29 15:34:24 +02:00
76bc5a6554 Merge pull request #80859 from KoBeWi/prepare_for_action_and_make_it_double
Fix action state when multiple events are assigned
2023-08-29 15:06:02 +02:00
deaf6c3bb1 Context aware MIDI event printing 2023-08-28 12:42:15 +02:00
ad1abca668 Fix action state when multiple events are assigned 2023-08-25 23:10:27 +02:00
1bb73b0689 Ensure joy_connection_changed is emitted on the main thread 2023-08-09 15:32:06 +01:00
3aa340d081 Add the ability to get per-platform information for joypads.
This adds the ability for games to obtain platform-specific information about joypads such as their vendor/product ID, their XInput gamepad index or the real name of the device before it gets swapped out by the gamecontrollerdb's name.

This PR also includes a rebased version of #76045, this is because this PR is intended to be mainly to help people implementing Steam Input, as having the gamepad index is essential.
2023-08-02 22:30:30 +02:00
55b74c7cdf Merge pull request #76045 from Eoin-ONeill-Yokai/steaminput-fix
Prevent double input events on gamepad when running through steam input
2023-07-12 17:16:36 +02:00
8de98dbf21 Prevent double input events on gamepad when running through steam input
During GDC and general testing on Steam Deck units, we found that single
gamepads would often register inputs twice under certain circumstances.
This was caused by SteamInput creating a new virtual device, which Godot
registers as a second gamepad. This resulted in two gamepad devices
reporting the same button presses, often leading to buggy input response
on games with no multi-device logic and other-wise could cause intended
Steam rebindings to not work as intended (for example, swapping o and x
on a playstation pad if that feature isn't supported by the game.)

SDL gets around this by taking in a list of devices that are to be
ignored. When valve sees a controller that wants to be rebound via
SteamInput, they push a new VID/PID entry onto the environment
variable `SDL_GAMECONTROLLER_IGNORE_DEVICES` for the original gamepad
so that all game inputs can be read from the virtual gamepad instead.

This leverages the same logic as we are already using SDL gamepad
related HID mappings.
2023-07-10 15:26:33 -07:00
1621b4e2b1 Mention Xbox menu button by name in Start button description
Microsoft officially calls it the Menu button:

https://support.xbox.com/en-US/help/hardware-network/controller/get-to-know-your-xbox-series-x-s-controller
2023-06-26 09:41:54 +02:00
6fb391bc23 Fix various typos with codespell
And ignore some false positives introduced by recent versions of codespell.
2023-06-16 08:45:35 +02:00
0b30785bca Merge pull request #75438 from ronyeh/typo
Fix typo on "autoremapping".
2023-06-15 10:39:44 +02:00
35ff936b93 Merge pull request #77055 from lawnjelly/input_just_pressed_4
Input - fix just pressed and released with short presses
2023-06-12 14:13:52 +02:00
a3ef092f18 Input - fix just pressed and released with short presses
Previously if an action was both pressed and released on the same tick or frame, `is_action_just_pressed()` would return false, resulting in missed input.

This PR separately the timestamp for pressing and releasing so each can be tested independently.
2023-06-12 11:14:58 +01:00
91e2859cd3 Merge pull request #77748 from DevanOBoyle/fix/ignore_false_button_error
Skip error messages for buttons that don't exist
2023-06-12 11:38:43 +02:00
ed02d515e0 Skip error messages for buttons that don't exist 2023-06-11 21:25:29 -07:00