summaryrefslogtreecommitdiff
path: root/core/input
AgeCommit message (Collapse)Author
2021-02-18Added ability to override built-in actions for the editorEric M
This adds the ability to add overrides for built-in actions (i.e. ui_*) in the editor. Also added a number of additional built-in actions for various text-related actions, gui-generic actions (like copy and paste) and graph-related actions (duplicate nodes), etc. Moved the definition of input actions to input_map, rather than in project_settings so the editor can make use of these actions as well.
2021-02-18Added convenience create_reference methods for Key and JoyButton inputsEric M
2021-02-15Merge pull request #44355 from ↵Rémi Verschelde
EricEzaM/PR/fix-action-false-positives-and-allow-checking-exact-matches Allow checking for exact matches with Action events.
2021-02-08Sync controller mappings DB with SDL2 community repoRémi Verschelde
Synced with gabomdq/SDL_GameControllerDB@f72b68b8b090e689ed21f600e89db9a661edb696. Partial revert of #45790.
2021-02-08Merge pull request #45797 from madmiraal/add-new-sdl-keywordsRémi Verschelde
Add support for new SDL gamecontroller keywords.
2021-02-07Add support for new SDL gamecontroller keywords.Marcel Admiraal
2021-02-07Fix issues in last GameControllerDB syncRémi Verschelde
We don't support 'misc1' as an output string yet (seems used for PS5 controller). Yet another broken CSV line with 'CO.,LTD'.
2021-02-06Merge pull request #45756 from Faless/js/4.x_gamepads_dbRémi Verschelde
Add some HTML5 controllers mapping.
2021-02-06Add some HTML5 controllers mapping.Fabio Alessandrelli
2021-02-06Sync controller mappings DB with SDL2 community repoRémi Verschelde
Synced with gabomdq/SDL_GameControllerDB@c7cf1397c1e07182de936e72fa1bc5cc22ab8cc1.
2021-01-18[HTML5] Custom Gamepad library to allow remapping.Fabio Alessandrelli
No longer use emscripten functions for gamepads, implement them as library functions in library_godot_display.js instead. This allows us to do a better job at "guessing" vendorId, productId, OS, etc. thus allowing us to better find the remapping for the controller.
2021-01-18Better gamepad axis event injection.Fabio Alessandrelli
In the core input handling code we have checks to make sure that if axis rapidly change sign we inject mid-points to release any pending inputmap action. The function though, did not correctly insert the mid-point causing dpads mapped to an axis that behaves like tri-state buttons (-1,0,1) to not be released correctly. This commit fixes that by including in the check the case where the axis swtiches from abs(1) to 0.
2021-01-01Update copyright statements to 2021Rémi Verschelde
Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
2020-12-28Merge pull request #44593 from madmiraal/rename-mainloop-methodsRémi Verschelde
Rename MainLoop methods to match Node methods
2020-12-28Rename empty() to is_empty()Marcel Admiraal
2020-12-22Rename MainLoop methods to match Node methodsMarcel Admiraal
2020-12-15Allow checking for exact matches with Action events.EricEzaM
Added additional param to action related methods to test for exactness. If "p_exact_match" is true, then the action will only be "matched" if the provided input event *exactly* matches with the action event. Before: * Action Event = KEY_S * Input Event = KEY_CONTROL + KEY_S * Is Action Pressed = True Now: You can still do the above, however you can optionally check that the input is exactly what the action event is: * Action Event = KEY_S * Input Event = KEY_CONTROL + KEY_S * p_exact_match = True * Is Action Pressed = False * If the Input Event was only KEY_S, then the result would be true. Usage: ```gdscript Input.is_action_pressed(action_name: String, exact_match: bool) Input.is_action_pressed("my_action", true) InputMap.event_is_action(p_event, "my_action", true) func _input(event: InputEvent): event.is_action_pressed("my_action", false, true) # false = "allow_echo", true = "exact_match" event.is_action("my_action", true) ```
2020-12-14Fixed mistakes in InputEvent as_text and to_string implementations.EricEzaM
2020-12-03Merge pull request #43660 from EricEzaM/PR/INP1-inputevent_as_text_and_to_stringRémi Verschelde
InputEvent as_text now returns readable string. Added to_string for debug strings
2020-12-03Ignore hint entries in game controller mappingMarcel Admiraal
2020-11-27InputEvent as_text now returns readable string. Added to_string for debug ↵Eric M
strings Made InputEvent as_text() return a readable and presentable string. Added to_string() overrides for each which returns a 'debug-friendly' version which is not as presentable but provides more information and in a more structured fashion. Use as_text() for UI display scenarions and to_string() for debug cases
2020-11-19Merge pull request #43591 from madmiraal/fix-43520Rémi Verschelde
Update joy button and stick names, enums and documentation
2020-11-19Update joy button and stick names, enums and documentationMarcel Admiraal
2020-11-19Merge pull request #43662 from EricEzaM/PR/INP3-command_serialization_optionalRémi Verschelde
Made serialization of Command toggleable when saving InputEvents.
2020-11-19Made serialization of Command toggleable when saving InputEvents.Eric M
Made serialization of Command optional. If command is serialized, Control (On Win/Linux) or Meta (on Mac) are not. Example use case: You are on Windows and you set a shortcut to be Control + E. This would serialize as Command=true and Control=true. If you then run this project on Mac, you would need to press Command AND Control to activate the shortcut - which is not what is intended. Now, you can set store_command to true, and it will only serialize to Command = true (no Control serialized). On Windows, this means Control. On Mac, it means only command.
2020-11-19Merge pull request #43661 from EricEzaM/PR/INP2-rename_load_from_globalsRémi Verschelde
load_from_globals() -> load_from_project_settings()
2020-11-19load_from_globals() -> load_from_project_settings()Eric M
2020-11-16Remove empty lines around braces with the formatting scriptAaron Franke
2020-11-16Merge pull request #43233 from madmiraal/fix-42876Rémi Verschelde
Remove unneeded filter on joy_axis()
2020-11-16Merge pull request #42976 from aaronfranke/input-get-axisRémi Verschelde
Allow getting Input "axis" and "vector" values by specifying multiple actions
2020-11-12Release pressed action if event is removedTomasz Chabora
2020-11-11Allow getting Input axis/vector values by specifying multiple actionsAaron Franke
For get_vector, use raw values and handle deadzones appropriately
2020-11-11Add raw strength value for internal useAaron Franke
2020-11-07Reorganized core/ directory, it was too fatty alreadyreduz
-Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
2020-10-31Remove unneeded filter on joy_axis()Marcel Admiraal
2020-10-26Apply upstream gamecontrollerdb patch 391.Marcel Admiraal
Co-authored-by: SalvoB <salvob41@users.noreply.github.com>
2020-10-26Provide support for buttons and D-pads mapped to half axes, andMarcel Admiraal
fix axes mapped to buttons and D-pads.
2020-10-18Refactor MethodBind to use variadic templatesreduz
Removed make_binders and the old style generated binders.
2020-09-29Removed unnecessary keyword, fix comment styleCraig-Stoneham
The privacy here is already private
2020-09-23Check for null in InputMap::_find_eventTomasz Chabora
2020-09-10Remove unused Python imports.Marcel Admiraal
2020-09-01Fix invalid CSV in SDL2 controller mappings DBRémi Verschelde
Follow-up to a61cae14696732fca214902161f40450dec2f9cd.
2020-09-01Sync controller mappings DB with SDL2 community repoRémi Verschelde
Synced with gabomdq/SDL_GameControllerDB@d148c6ce4987e0cf58da8100c675eb5db8e43dfe.
2020-07-28SCons: Refactor running commands through buildersAndrii Doroshenko (Xrayez)
A new `env.Run` method is added which allows to control the verbosity of builders output automatically depending on whether the "verbose" option is set. It also allows to optionally run any SCons commands in a subprocess using the existing `run_in_subprocess` method, unifying the interface. `Action` objects wrap all builder functions to include a short build message associated with any action. Notably, this removes quite verbose output generated by `make_doc_header` and `make_editor_icons_action` builders.
2020-07-10Add override keywords.Marcel Admiraal
2020-06-15Renamed InputMap.get_action_list to InputMap.get_action_eventsLennard
2020-06-04Sync controller mappings DB with SDL2 community repoRémi Verschelde
Synced with gabomdq/SDL_GameControllerDB@6191f6333bd66644c6a208fabb9fd5dabf0a5d43.
2020-05-19Style: Remove unnecessary semicolons from `core`Rémi Verschelde
Semicolons are not necessary after function definitions or control flow blocks, and having some code use them makes things inconsistent (and occasionally can mess up `clang-format`'s formatting). Removing them is tedious work though, I had to do this manually (regex + manual review) as I couldn't find a tool for that. All other code folders would need to get the same treatment.
2020-05-14Style: Enforce braces around if blocks and loopsRémi Verschelde
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14Style: Enforce separation line between function definitionsRémi Verschelde
I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.