Commit graph

171 commits

Author SHA1 Message Date
kobewi
d61a337a70 Improve usage of String.split() vs get_slice() 2025-09-19 16:31:55 +02:00
Thaddeus Crews
52a5644b5f
Merge pull request #108214 from Nintorch/fix-joypad-vendor-product
Fix `Input.get_joy_info()` regression after the SDL input driver PR
2025-09-01 11:14:12 -05:00
Nintorch
f28acf97d0 Fix Input.get_joy_info() regression
SDL input driver did not have the "xinput_index", "raw_name", "vendor_id" and "product_id" fields for this method and exposed an additional, essentially useless for the users "mapping_handled" field. This commit fixes these issues.
2025-08-29 22:13:40 +05:00
Pāvels Nadtočajevs
10fd7163d4
Add methods to check which event first triggered "just pressed/released" state. 2025-08-12 16:25:23 +03:00
风青山
efed435fa3
Fix screen_accum not being reset when it should be in Input::VelocityTrack
Resets `screen_accum` like `accum`.
2025-06-26 20:06:03 +08:00
Nintorch
0b3496fb4f
Add support for SDL3 joystick input driver
Made possible by EIREXE, xsellier and the SDL team.

This commit includes statically linked SDL3 for Windows, Linux and macOS.
The vendored copy of SDL3 was setup to only build the required subsystems
for gamepad/joystick support, with some patches to be able to make it as
minimal as possible and reduce the impact on binary size and code size.

Co-authored-by: Álex Román Núñez <eirexe123@gmail.com>
Co-authored-by: Xavier Sellier <xsellier@gmail.com>
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2025-06-25 01:28:50 +02:00
kobewi
5af4bef46f Inline static variables (part 1) 2025-04-29 18:10:44 +02:00
A Thousand Ships
331a43a9d8
Add String::remove_char(s) methods for performance and convenience 2025-03-10 13:19:28 +01:00
A Thousand Ships
466590d0ec
Use get_slicec instead of get_slice for single character splitters 2025-03-08 20:36:37 +01:00
A Thousand Ships
5113022dfe
Clean up some uses of String::substr
Cases where the end position is either equvalent to the default or past
the end of the string.
2025-03-07 14:50:38 +01:00
Anish Mishra
93bababb8c Android: Inform that sensors must be enabled in ProjectSettings 2025-02-21 23:04:01 +05:30
Adam Scott
47f553ae0b
Delegate to the DisplayServer the task of handling mouse_mode
- Add `MOUSE_MODE_MAX` and various index checks
2025-01-28 11:22:27 -05:00
MJacred
8e75fae49e Ue an array removed_idx 2025-01-14 12:09:16 +01:00
MJacred
f355382ef5 Updating the index after the first mapping record of p_guid requires a second loop 2025-01-13 16:55:26 +01:00
MJacred
e98f3a6bf0 Apply feedback 2025-01-13 16:23:55 +01:00
MJacred
f7c6a8659a Apply feedback + Remove unused variable uid in parse_mapping() 2025-01-13 11:43:25 +01:00
MJacred
40832387ce Fix Input::remove_joy_mapping
Erasing a joypad mapping can invalidate other attached joypads and the fallback mapping guid
2024-12-16 20:27:33 +01:00
MJacred
01a2726c59 Get joypad's vendor ID, product ID, and name on Windows 2024-12-15 23:59:11 +01:00
Hilderin
4e19ab8afe
Fix connecting a signal with a double click is too difficult
Co-authored-by: Danil Alexeev <dalexeev12@yandex.ru>
2024-12-14 16:18:34 +03:00
A Thousand Ships
68f638cf02
Use (r)find_char instead of (r)find for single characters 2024-11-17 10:02:18 +01:00
Thaddeus Crews
bb5f390fb9
Style: Apply clang-tidy fixes (superficial)
• `modernize-use-bool-literals`, `modernize-use-nullptr`, and `readability-braces-around-statements`
2024-11-04 12:11:14 -06:00
Michael Alexsander
16524a8a01
Add "Game" editor for better runtime debugging 2024-10-30 11:42:17 -03:00
alexkar598
fd6138ed7e Fixes window_id being erased when emulating mouse events from touch events 2024-10-18 15:37:39 -04:00
Fredia Huya-Kouadio
a57a99f5bc Memory cleanup and optimizations
- Returns an empty list when there's not registered plugins, thus preventing the creation of spurious iterator objects

- Inline `Godot#getRotatedValues(...)` given it only had a single caller. This allows to remove the allocation of a float array on each call and replace it with float variables

- Disable sensor events by default. Sensor events can fired at 10-100s Hz taking cpu and memory resources. Now the use of sensor data is behind a project setting allowing projects that have use of it to enable it, while other projects don't pay the cost for a feature they don't use

- Create a pool of specialized input `Runnable` objects to prevent spurious, unbounded `Runnable` allocations

- Disable showing the boot logo for Android XR projects

- Delete locale references of jni strings
2024-08-16 09:27:41 -07:00
Rémi Verschelde
59737bf3f0
Merge pull request #94413 from rburing/fix_action_press_tick
Fix physics tick count in `Input.action_press` and `Input.action_release`
2024-07-17 11:44:31 +02:00
Rémi Verschelde
496fd12b17
Merge pull request #94052 from m4gr3d/clean_input_dispatch_settings
Cleanup Android input on render thread settings
2024-07-17 11:42:52 +02:00
Ricardo Buring
b41ec93d63 Fix physics tick count in Input.action_press and Input.action_release
The physics tick count was not yet updated there.
2024-07-16 00:31:44 +02:00
Fredia Huya-Kouadio
5e59819727 Cleanup Android input on render thread settings
Follow up to https://github.com/godotengine/godot/pull/93933
Clean up the set of settings use to control whether Android input should be dispatched on the render thread.

Addresses comments in https://github.com/godotengine/godot/pull/93933#issuecomment-2210437977
2024-07-09 09:15:18 -07:00
Ricardo Buring
23521635d2 Fix physics tick counter
The counter is now incremented at the start of a physics tick rather than at the end.

Co-authored-by: lawnjelly <lawnjelly@gmail.com>
2024-07-07 19:04:05 +02:00
Rémi Verschelde
62120c7841
Fix Steam input "crc" errors, and some other Coverity reports of uninitialized scalar variable
- Fixes #88630.
- Fixes #92578.
2024-05-31 09:55:02 +02:00
Rémi Verschelde
be2c5e66f4
Merge pull request #92201 from bruvzg/input_flush
Clean `Input::frame_parsed_events` before de-initialising scripting languages to ensure no script created events exist at the exit.
2024-05-30 15:41:56 +02:00
kobewi
17d3f26e5d Add event_index to InputEventAction 2024-05-30 12:51:15 +02:00
bruvzg
2c9df769ad
Clean Input::frame_parsed_events before de-initialising scripting languages to ensure no script created events exist at the exit. 2024-05-30 13:23:00 +03:00
Rémi Verschelde
1069d7b7c6
Merge pull request #88343 from Riteo/warped-mouse-float
Handle warped mouse motion as floating point
2024-05-06 15:14:46 +02:00
Radiant
789c6ebdfd Implement amplitude to Input.vibrate_handheld
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: m4gr3d <m4gr3d@users.noreply.github.com>
2024-05-02 19:09:42 +03:00
Mark Wilson
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
Micky
cd2032a90b Optimise Object's get_argument_options 2024-02-29 18:00:54 +01:00
Riteo
759a32eb0c Handle warped mouse motion as floating point
Fixes certain issues where sub-pixel motions would get discarded while
the mouse is captured, such as when free look is enabled in the editor
(at least when turned on while holding right click).

Very slightly compat breaking, as actual public APIs are changed,
although with "compatible" types (Point2i->Point2).
2024-02-14 22:37:51 +01:00
Muller-Castro
a8bc9f3e78 Add const lvalue ref to core/* container parameters 2024-02-14 11:20:36 -03:00
Markus Sauermann
2235a1cbd0 Add screen-related attributes to mouse input events 2024-02-05 23:30:15 +01:00
jsjtxietian
4b3a12f4ee Check action exists in Input.action_press and action_release 2024-01-18 16:18:16 +08:00
Rémi Verschelde
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
Micky
ca2f340384 Fix missing autocompletion for inheriting classes 2024-01-03 00:13:04 +01:00
Wilson E. Alvarez
a3cb1b096f
Add const references detected by clang-tidy 2023-12-16 13:36:44 -05:00
CaTaTo
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
Gilles Roudière
8cfcd36253 Rework action pressed state to support multiple controllers 2023-12-04 18:02:51 +01:00
kobewi
d9d0cfaf38 Rework input actions to be reliable 2023-11-10 15:24:04 +01:00
Rémi Verschelde
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
John Watson
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
ErezShahaf
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