Commit graph

194 commits

Author SHA1 Message Date
Rémi Verschelde
344b42703b
Merge pull request #62212 from hansemro/eraser-detect-4
Add inversion/eraser-end property for tablet pens
2022-07-04 21:48:19 +02:00
Hansem Ro
6dcc9d1131 [macOS, Windows, X11] Add stylus inverted/eraser support to
InputEventMouseMotion event
2022-07-04 10:36:53 -07:00
Rémi Verschelde
00b3822306 Input: Re-enable input accumulation by default
I turned it off by mistake in #38697.
See also #62664 for details on this boolean's complex history :)
2022-07-03 12:16:16 +02:00
Marco F
0efa5d4cbd Input: Make get_action_raw_strength print error when the action doesn't exist 2022-06-28 15:58:26 +02:00
FireForge
4678736a39 Add suffixes to all nodes and resources 2022-06-11 09:41:05 -05:00
Rémi Verschelde
ecde7ce834
Merge pull request #61669 from fire-forge/input
Make Input `mouse_mode` and `use_accumulated_input` properties
2022-06-04 15:52:34 +02:00
FireForge
f16c33fff6 Make Input mouse_mode and use_accumulated_input properties 2022-06-03 14:19:38 -05:00
Raul Santos
3e53afd52c
Add array element type to get_connected_joypads 2022-06-03 20:37:46 +02:00
reduz
45af29da80 Add a new HashSet template
* Intended to replace RBSet in most cases.
* Optimized for iteration speed
2022-05-20 22:40:38 +02:00
reduz
746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00
reduz
8b7c7f5a75 Add a new HashMap implementation
Adds a new, cleaned up, HashMap implementation.

* Uses Robin Hood Hashing (https://en.wikipedia.org/wiki/Hash_table#Robin_Hood_hashing).
* Keeps elements in a double linked list for simpler, ordered, iteration.
* Allows keeping iterators for later use in removal (Unlike Map<>, it does not do much
  for performance vs keeping the key, but helps replace old code).
* Uses a more modern C++ iterator API, deprecates the old one.
* Supports custom allocator (in case there is a wish to use a paged one).

This class aims to unify all the associative template usage and replace it by this one:
* Map<> (whereas key order does not matter, which is 99% of cases)
* HashMap<>
* OrderedHashMap<>
* OAHashMap<>
2022-05-12 11:21:29 +02:00
Rémi Verschelde
30fbb8964d Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@b7d126eb71
2022-05-05 14:12:55 +02:00
Hugo Locurcio
180e5d3028
Remove RES and REF typedefs in favor of spelled out Ref<>
These typedefs don't save much typing compared to the full `Ref<Resource>`
and `Ref<RefCounted>`, yet they sometimes introduce confusion among
new contributors.
2022-05-03 01:43:50 +02:00
Rémi Verschelde
c273ddc3ee Style: Partially apply clang-tidy's cppcoreguidelines-pro-type-member-init
Didn't commit all the changes where it wants to initialize a struct
with `{}`. Should be reviewed in a separate PR.

Option `IgnoreArrays` enabled for now to be conservative, can be
disabled to see if it proposes more useful changes.

Also fixed manually a handful of other missing initializations / moved
some from constructors.
2022-05-02 16:28:25 +02:00
Paulb23
5e4e4967fe Use Input::push_input for tests plus extra mouse testing 2022-04-22 17:39:12 +01:00
Rémi Verschelde
bd9ba4bd10
Merge pull request #60208 from Magorx/input-set-custom-mouse-cursor-fix
Added p_shape check to avoid engine crash in DisplayServer
2022-04-14 00:12:51 +02:00
KingCakeTheFruity
29a2809d21 Added p_shape check to avoid engine crush 2022-04-13 14:50:30 +03:00
bruvzg
f851c4aa33
Fix some issues found by cppcheck. 2022-04-06 14:34:37 +03:00
Rémi Verschelde
7119d355eb String: Remove TTR and DTR defines in non-tools build
This ensures we don't use TTR in runtime code, as it's specifically meant
to source translations for the editor.
2022-03-28 20:26:35 +02:00
Markus Sauermann
0494e024d8 Rename warp mouse functions to warp_mouse 2022-03-27 14:12:01 +02:00
Marcel Admiraal
ea20049afc Ensure minimum modifiers are pressed when matching actions 2022-03-20 08:02:54 +00:00
Haoyu Qiu
d1ca29cd8c Remove TTRC() with empty string
Fixes "duplicate message definition" when extracting messages.
2022-03-02 17:02:10 +08:00
Rémi Verschelde
e3d89a76f7 Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@94b76208bc
2022-02-20 12:20:17 +01:00
Powerbyte7
b8a7ea034c
[HTML5] Add Stadia controller to database
Add web support for the Stadia controller.
2022-02-19 23:01:41 +01:00
Rémi Verschelde
b8b4580448
Style: Cleanup single-line blocks, semicolons, dead code
Remove currently unused implementation of TextureBasisU, could be re-added
later on if needed and ported.
2022-02-16 14:06:29 +01:00
Rémi Verschelde
bf0253bab9
Merge pull request #56764 from madmiraal/fix-45592-2 2022-02-03 18:10:30 +01:00
Nathan Franke
8a0a3accee
simplify formatting scripts, add a clang-tidy script, and run clang-tidy 2022-01-29 04:41:03 -06:00
Rémi Verschelde
d74d4cbdff
Merge pull request #54173 from nathanfranke/fix-exact-match 2022-01-26 13:35:36 +01:00
Nathan Franke
dc1c4cfbfa
Fix action exact match 2022-01-24 05:55:37 -06:00
Rémi Verschelde
57a057f7ff
Merge pull request #56754 from madmiraal/fix-45592 2022-01-24 10:05:42 +01:00
Andrii Doroshenko (Xrayez)
5d17fe7d0f Add Input.is_anything_pressed method 2022-01-20 20:55:14 +02:00
Marcel Admiraal
f41c72c538 Fix Actions mapped to triggers not using the full range 2022-01-14 15:36:20 +00:00
Marcel Admiraal
5c3600b29f Fix mouse velocity not changing fast enough
- Uses all accumulated movements when calculating velocity
- Discards old accumulated movements
- Sets last mouse velocity to zero when there is no movement
2022-01-13 18:51:34 +00:00
Marcel Admiraal
5250cdd150 Use mouse event relative motion to calculate mouse velocity 2022-01-13 15:23:21 +00:00
Rémi Verschelde
46624388d4
Merge pull request #56322 from madmiraal/fix-42450 2022-01-11 11:33:59 +01:00
bruvzg
61ea8f8337
Add joystick button index boundary check. Increase max. button number to 128 (max. buttons supported by DirectInput). 2022-01-10 14:39:05 +02:00
Aaron Franke
de9adcf045
Document InputEventMIDI and add some missing 0xF MIDI messages 2022-01-04 05:30:43 -08:00
Rémi Verschelde
fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
Marcel Admiraal
3105d9b1f3 Rename speed to velocity when it's a directional Vector 2021-12-29 15:35:26 +00:00
Marcel Admiraal
39136ce3e0
Revert "Fixed event spam when using the Nintendo Switch controller" 2021-12-17 17:14:07 +00:00
Rémi Verschelde
ed395c6b99
Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@265b43b789.
2021-12-17 00:14:44 +01:00
Sam Lantinga
313815f818 Fixed event spam when using the Nintendo Switch controller
There is no filtering on the Nintendo Switch Pro controller thumbstick, so there will frequently be events with very slight change. These are turned into "not pressed" events, which cancel "pressed" events from keys and buttons.

This change filters out up to 5% jitter, but it might be worth revisiting whether "not pressed" events should cancel "pressed" events.
2021-12-16 09:04:58 -08:00
Rémi Verschelde
03e105f677
Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@348cfa347f.
2021-12-10 10:59:30 +01:00
Nathan Franke
49403cbfa0
Replace String comparisons with "", String() to is_empty()
Also:
- Adds two stress tests to test_string.h
- Changes to .empty() on std::strings
2021-12-09 04:48:38 -06:00
kobewi
cb2bdcd286 Unexpose joy_connection_changed method 2021-12-06 13:10:17 +01:00
Lightning_A
e078f970db Rename remove() to remove_at() when removing by index 2021-11-23 18:58:57 -07:00
bruvzg
9877d91c4a
Add Input.is_physical_key_pressed method. 2021-11-23 11:14:19 +02:00
Hugo Locurcio
8fb7e622a6
Rename built-in SGN() macro to SIGN()
This matches the name of the GDScript function (except it's uppercase
here).
2021-11-16 20:40:49 +01:00
Aaron Franke
3c0fdcc8ac
Use "enum class" for input enums 2021-11-12 15:37:54 -06:00
Rémi Verschelde
4b247e7ffa
Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@322aac4bb7.

Also improve parser errors to allow identifying the problematic mappings.
2021-11-03 19:55:52 +01:00