summaryrefslogtreecommitdiff
path: root/core/input/input.h
AgeCommit message (Collapse)Author
2023-01-08Use BitField<> in core type masksJuan Linietsky
* All core types masks are now correctly marked as bitfields. * The enum hacks in MouseButtonMask and many other types are gone. This ensures that binders to other languages non C++ can actually implement type safe bitmasks. * Most bitmask operations replaced by functions in BitField<> * Key is still a problem because its enum and mask at the same time. While it kind of works in C++, this most likely can't be implemented safely in other languages and will have to be changed at some point. Mostly left as-is. * Documentation and API dump updated to reflect bitfields in core types.
2023-01-05One Copyright Update to rule them allRémi Verschelde
As many open source projects have started doing it, we're removing the current year from the copyright notice, so that we don't need to bump it every year. It seems like only the first year of publication is technically relevant for copyright notices, and even that seems to be something that many companies stopped listing altogether (in a version controlled codebase, the commits are a much better source of date of publication than a hardcoded copyright statement). We also now list Godot Engine contributors first as we're collectively the current maintainers of the project, and we clarify that the "exclusive" copyright of the co-founders covers the timespan before opensourcing (their further contributions are included as part of Godot Engine contributors). Also fixed "cf." Frenchism - it's meant as "refer to / see".
2022-08-22Consolidate the fact that `Input` is meant to be finalPedro J. Estébanez
This reverts #38034 and removes the `iteration()` method.
2022-07-03Input: Re-enable input accumulation by defaultRémi Verschelde
I turned it off by mistake in #38697. See also #62664 for details on this boolean's complex history :)
2022-06-04Merge pull request #61669 from fire-forge/inputRémi Verschelde
Make Input `mouse_mode` and `use_accumulated_input` properties
2022-06-03Make Input mouse_mode and use_accumulated_input propertiesFireForge
2022-06-03Add array element type to `get_connected_joypads`Raul Santos
2022-05-20Add a new HashSet templatereduz
* Intended to replace RBSet in most cases. * Optimized for iteration speed
2022-05-16Replace most uses of Map by HashMapreduz
* 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-03Remove `RES` and `REF` typedefs in favor of spelled out `Ref<>`Hugo Locurcio
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-02Style: Partially apply clang-tidy's `cppcoreguidelines-pro-type-member-init`Rémi Verschelde
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-04-22Use Input::push_input for tests plus extra mouse testingPaulb23
2022-04-06Fix some issues found by cppcheck.bruvzg
2022-03-27Rename warp mouse functions to warp_mouseMarkus Sauermann
2022-02-03Merge pull request #56764 from madmiraal/fix-45592-2Rémi Verschelde
2022-01-20Add `Input.is_anything_pressed` methodAndrii Doroshenko (Xrayez)
2022-01-14Fix Actions mapped to triggers not using the full rangeMarcel Admiraal
2022-01-13Fix mouse velocity not changing fast enoughMarcel Admiraal
- Uses all accumulated movements when calculating velocity - Discards old accumulated movements - Sets last mouse velocity to zero when there is no movement
2022-01-11Merge pull request #56322 from madmiraal/fix-42450Rémi Verschelde
2022-01-03Update copyright statements to 2022Rémi Verschelde
Happy new year to the wonderful Godot community!
2021-12-29Rename speed to velocity when it's a directional VectorMarcel Admiraal
2021-11-23Add Input.is_physical_key_pressed method.bruvzg
2021-11-12Use "enum class" for input enumsAaron Franke
2021-10-21Remove unimplemented methodsMarcel Admiraal
2021-08-13Add input buffering frameworkPedro J. Estébanez
Input buffering is implicitly used by event accumulation, but this commit makes it more generic so it can be enabled for other uses. For desktop OSs it's currently not feasible given main and UI threads are the same).
2021-08-13Improve input event accumulationPedro J. Estébanez
- API has been simplified: all events now go through `parse_input_event()`. Whether they are accumulated or not depends on the `use_accumulated_input` flag. - Event accumulation is now thread-safe (it was not needed so far, but it prepares the ground for the following changes). - Touch drag events now support accumulation.
2021-08-10Use Key enum instead of plain integersAaron Franke
2021-06-20Use mouse and joypad enums instead of plain integersAaron Franke
Also MIDIMessage
2021-06-20Move many input enums to their own fileAaron Franke
2021-06-03Add MOUSE_MODE_CONFINED_HIDDENAaron Franke
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2021-03-23Rename some more global enums (Key, Joy, MIDI)Aaron Franke
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-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-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-11-19Update joy button and stick names, enums and documentationMarcel Admiraal
2020-11-16Merge pull request #43233 from madmiraal/fix-42876Rémi Verschelde
Remove unneeded filter on joy_axis()
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-26Provide support for buttons and D-pads mapped to half axes, andMarcel Admiraal
fix axes mapped to buttons and D-pads.
2020-07-10Add override keywords.Marcel Admiraal
2020-05-14Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
2020-05-14Port member initialization from constructor to declaration (C++11)Rémi Verschelde
Using `clang-tidy`'s `modernize-use-default-member-init` check and manual review of the changes, and some extra manual changes that `clang-tidy` failed to do. Also went manually through all of `core` to find occurrences that `clang-tidy` couldn't handle, especially all initializations done in a constructor without using initializer lists.
2020-05-13Implement half axis and inverted axis mapping.Marcel Admiraal
2020-05-13Update game controller enums.Marcel Admiraal
2020-05-13Parse SDL game controller half axis and inverted axis entries.Marcel Admiraal
2020-04-29Input: make VibrationInfo protected to allow implementors to use itpunto-
2020-04-28Rename InputFilter back to InputRémi Verschelde
It changed name as part of the DisplayServer and input refactoring in #37317, with the rationale that input no longer goes through the main loop, so the previous Input singleton now only does filtering. But the gains in consistency are quite limited in the renaming, and it breaks compatibility for all scripts and tutorials that access the Input singleton via the scripting language. A temporary option was suggested to keep the scripting singleton named `Input` even if its type is `InputFilter`, but that adds inconsistency and breaks C#. Fixes godotengine/godot-proposals#639. Fixes #37319. Fixes #37690.