summaryrefslogtreecommitdiffstats
path: root/core/input/input.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix copyright headers referring to GodotSpartan3222024-10-271-2/+2
|
* Rebrand preambles to RedotSpartan3222024-10-131-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | (cherry picked from commit e8542b06acca3c1bdeee4b528411771f0819f084) Credits: Co-authored-by: Skogi <skogi.b@gmail.com> Co-authored-by: Spartan322 <Megacake1234@gmail.com> Co-authored-by: swashberry <swashdev@pm.me> Co-authored-by: Christoffer Sundbom <christoffer_karlsson@live.se> Co-authored-by: Dubhghlas McLaughlin <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: McDubh <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: Dubhghlas McLaughlin <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: radenthefolf <radenthefolf@gmail.com> Co-authored-by: John Knight <80524176+Tekisasu-JohnK@users.noreply.github.com> Co-authored-by: Adam Vondersaar <adam.vondersaar@uphold.com> Co-authored-by: decryptedchaos <nixgod@gmail.com> Co-authored-by: zaftnotameni <122100803+zaftnotameni@users.noreply.github.com> Co-authored-by: Aaron Benjamin <lifeartstudios@gmail.com> Co-authored-by: wesam <108880473+wesamdev@users.noreply.github.com> Co-authored-by: Mister Puma <MisterPuma80@gmail.com> Co-authored-by: Aaron Benjamin <lifeartstudios@gmail.com> Co-authored-by: SingleError <isaaconeoneone@gmail.com> Co-authored-by: Bioblaze Payne <BioblazePayne@gmail.com>
* Merge pull request #94413 from rburing/fix_action_press_tickRémi Verschelde2024-07-171-2/+4
|\ | | | | | | Fix physics tick count in `Input.action_press` and `Input.action_release`
| * Fix physics tick count in Input.action_press and Input.action_releaseRicardo Buring2024-07-161-2/+4
| | | | | | | | The physics tick count was not yet updated there.
* | Merge pull request #94052 from m4gr3d/clean_input_dispatch_settingsRémi Verschelde2024-07-171-5/+5
|\ \ | |/ |/| | | Cleanup Android input on render thread settings
| * Cleanup Android input on render thread settingsFredia Huya-Kouadio2024-07-091-5/+5
| | | | | | | | | | | | | | 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
* | Fix physics tick counterRicardo Buring2024-07-071-2/+3
|/ | | | | | The counter is now incremented at the start of a physics tick rather than at the end. Co-authored-by: lawnjelly <lawnjelly@gmail.com>
* Fix Steam input "crc" errors, and some other Coverity reports of ↵Rémi Verschelde2024-05-311-0/+1
| | | | | | | uninitialized scalar variable - Fixes #88630. - Fixes #92578.
* Merge pull request #92201 from bruvzg/input_flushRémi Verschelde2024-05-301-0/+8
|\ | | | | | | Clean `Input::frame_parsed_events` before de-initialising scripting languages to ensure no script created events exist at the exit.
| * Clean Input::frame_parsed_events before de-initialising scripting languages ↵bruvzg2024-05-301-0/+8
| | | | | | | | to ensure no script created events exist at the exit.
* | Add event_index to InputEventActionkobewi2024-05-301-1/+1
|/
* Merge pull request #88343 from Riteo/warped-mouse-floatRémi Verschelde2024-05-061-6/+6
|\ | | | | | | Handle warped mouse motion as floating point
| * Handle warped mouse motion as floating pointRiteo2024-02-141-6/+6
| | | | | | | | | | | | | | | | | | 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).
* | Implement `amplitude` to Input.vibrate_handheldRadiant2024-05-021-3/+4
| | | | | | | | | | Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Co-authored-by: m4gr3d <m4gr3d@users.noreply.github.com>
* | Fix action_press() by clamping strength to 0, 1Mark Wilson2024-03-271-1/+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().
* | Optimise Object's `get_argument_options`Micky2024-02-291-1/+3
| |
* | Add const lvalue ref to core/* container parametersMuller-Castro2024-02-141-7/+7
|/
* Add screen-related attributes to mouse input eventsMarkus Sauermann2024-02-051-4/+20
|
* Check action exists in `Input.action_press` and `action_release`jsjtxietian2024-01-181-0/+4
|
* Merge pull request #84445 from Rubonnek/add-const-references-clang-tidyRémi Verschelde2024-01-041-1/+1
|\ | | | | | | Add const references detected by clang-tidy
| * Add const references detected by clang-tidyWilson E. Alvarez2023-12-161-1/+1
| |
* | Fix missing autocompletion for inheriting classesMicky2024-01-031-0/+1
|/
* Add bindings for setting and getting emulation mouse from touch and touch ↵CaTaTo2023-12-131-0/+6
| | | | from mouse in input
* Rework action pressed state to support multiple controllersGilles Roudière2023-12-041-82/+91
|
* Rework input actions to be reliablekobewi2023-11-101-52/+67
|
* Merge pull request #81322 from johnnyw/android_fix_joypad_trigger_rangeRémi Verschelde2023-10-201-3/+5
|\ | | | | | | Android: Fix joypad trigger value range
| * Android: Fix joypad trigger value rangeJohn Watson2023-10-201-3/+5
| | | | | | | | | | | | `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
* | Fix `Input.is_action_just_pressed` flicker on joypad axesErezShahaf2023-10-161-8/+7
| | | | | | | | | | | | | | | | | | 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.
* | Prevent axis-based actions from getting stuckkobewi2023-09-041-5/+26
|/
* Remove debug printkobewi2023-08-291-2/+0
|
* Fix action state when multiple events are assignedkobewi2023-08-251-21/+36
|
* Ensure `joy_connection_changed` is emitted on the main threadRicardo Subtil2023-08-091-1/+2
|
* Add the ability to get per-platform information for joypads.Álex Román Núñez2023-08-021-1/+8
| | | | | | 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.
* Prevent double input events on gamepad when running through steam inputEoin O'Neill2023-07-101-0/+27
| | | | | | | | | | | | | | | | | | | | 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.
* Fix various typos with codespellRémi Verschelde2023-06-161-1/+1
| | | | And ignore some false positives introduced by recent versions of codespell.
* Merge pull request #77055 from lawnjelly/input_just_pressed_4Rémi Verschelde2023-06-121-23/+38
|\ | | | | | | Input - fix just pressed and released with short presses
| * Input - fix just pressed and released with short presseslawnjelly2023-06-121-23/+38
| | | | | | | | | | | | 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.
* | Skip error messages for buttons that don't existDevan OBoyle2023-06-111-2/+3
|/
* Merge pull request #76719 from m4gr3d/add_input_event_cancelled_state_mainRémi Verschelde2023-05-171-0/+2
|\ | | | | | | Augment the `InputEvent` class with a `CANCELED` state
| * Augment the `InputEvent` class with a `CANCELED` stateFredia Huya-Kouadio2023-05-151-0/+2
| | | | | | | | | | | | The `InputEvent` class currently supports the `pressed` and `released` states, which given the binary nature, is represented by a `bool` field. This commit introduced the `CANCELED` state, which signals that an ongoing input event has been canceled. To represent all the states, the `InputEventState` enum is added and the `InputEvent` logic is refactored accordingly.
* | Follow up to https://github.com/godotengine/godot/pull/76399 to fix input ↵Fredia Huya-Kouadio2023-05-111-0/+1
|/ | | | ANR in the Godot Android editor
* Allow concurrent buffering and dispatch of input eventsPedro J. Estébanez2023-05-081-1/+24
|
* Revert `Input.get_vector()` back to checking raw strengthMichael Alexsander2023-02-191-2/+2
|
* Change message of unknown joypad property from error to warningRicardo Subtil2023-02-131-2/+3
|
* Perform early exit in Input::is_anything_pressedNinni Pipping2023-02-091-3/+6
|
* Fix mouse/drag/touch InputEvents having no device idMarkus Sauermann2023-02-061-3/+6
| | | | | | | | Some internally created emulated/instantiated events didn't have a device id. This PR sets for these cases a device id. Also rename `DEVICE_ID_TOUCH_MOUSE` to the more generic `DEVICE_ID_EMULATION`.
* Fix various typos with codespellRémi Verschelde2023-02-011-1/+1
| | | | Finally do the childs -> children rename too.
* Merge pull request #64423 from RandomShaper/safe_input_synthRémi Verschelde2023-01-311-0/+25
|\ | | | | | | Warn users about unsafe usage of `InputEvent`
| * Warn users about unsafe usage of InputEventPedro J. Estébanez2023-01-311-0/+25
| |
* | Merge pull request #69028 from YeldhamDev/its_raw_you_donkeyRémi Verschelde2023-01-251-2/+2
|\ \ | | | | | | | | | Make `Input.get_vector()` check for plain `strength` instead of the raw one