Commit graph

65 commits

Author SHA1 Message Date
EricEzaM 0e5c6e0d55 Allow checking for exact matches with Action events.
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)
```

Co-authored-by: Eric M <itsjusteza@gmail.com>
2021-07-30 15:35:39 +02:00
Aaron Franke afa89c9eea
[3.x] Add raw strength value for internal use 2021-07-23 19:09:53 -04:00
Marcel Admiraal 18825ad4ff Fix game controllers ignoring the last listed button 2021-06-03 15:45:05 +01:00
bruvzg dab4cf3ed6
Add physical_scancode (keyboard layout independent keycodes) to InputEventKey and InputMap.
Fix non-latin keyboard layout keycodes on Linux/X11 (fallback to physical keycodes).
2021-05-06 23:19:45 +03:00
Rémi Verschelde b5e1e05ef2
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks 2021-05-04 14:45:16 +02:00
Rémi Verschelde 70ae90e0e8
Core: Drop custom copymem/zeromem defines
We've been using standard C library functions `memcpy`/`memset` for these since
2016 with 67f65f6639.

There was still the possibility for third-party platform ports to override the
definitions with a custom header, but this doesn't seem useful anymore.

Backport of #48239.
2021-04-29 12:34:11 +02:00
Marcel Admiraal 3dd57a22df Add support for new SDL gamecontroller keywords. 2021-02-07 16:41:23 +00:00
Rémi Verschelde 49646383f1
Update copyright statements to 2021
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 🎆

(cherry picked from commit b5334d14f7)
2021-01-13 16:17:06 +01:00
Marcel Admiraal ebff150680 Support SDL2 half axes and inverted axes mappings. 2020-06-26 06:28:56 +01:00
Tobias Mansfield-Williams 8b33b08c29 Add const to InputEventMouseButton::get_factor
(cherry picked from commit 982efb1864)
2020-04-27 10:16:21 +02:00
Rémi Verschelde a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
Rémi Verschelde 31f327a4a9
Merge pull request #33052 from KoBeWi/naughty_sliders
Fix analog input in sliders
2019-11-08 09:55:11 +01:00
Tomasz Chabora a7b202ef18 Fix analog input in sliders 2019-11-07 16:39:14 +01:00
bruvzg f675621725
[macOS, Windows, X11] Add graphic tablet pen pressure and tilt support to InputEventMouseMotion event. 2019-10-30 14:42:21 +02:00
IAmActuallyCthulhu 82b9557803
Remove redundant author doc comments 2019-08-12 04:26:38 -05:00
JohnJLight 38d3bfe971 Made use of semicolons more consitent, fixed formatting 2019-06-19 15:24:31 +02:00
Bastiaan Olij a9581d2b3f Added constants for the main buttons and axis used in VR 2019-06-13 22:54:08 +10:00
Gilles Roudiere f247832832 Add configurable strength value to InputEventAction 2019-06-02 14:31:34 +02:00
Pedro J. Estébanez f757460ec8 Fix fake null-motion mouse event flood
This commit also improves a bit the code quality by making the intent of fake events (and themselves) more explicit.

Fixes #26460.
2019-03-09 22:04:17 +01:00
Juan Linietsky a1e73dcc94 Add support for event accumlation (off by default, on for editor), fixes #26536 2019-03-03 19:53:13 -03:00
Hugo Locurcio b54910eb05
Make Button shortcuts triggerable by gamepads
This closes #25741.
2019-02-16 00:29:23 +01:00
Rémi Verschelde b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Rémi Verschelde c9df3fbfdb
Merge pull request #21954 from isaacremnant/fix_inputs
Fix is_action_pressed for InputEventActions
2018-09-14 18:06:11 +02:00
Rémi Verschelde 277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
isaacremnant bf16f89a30 Fix is_action_pressed for InputEventAction. 2018-09-10 15:15:06 -04:00
Aaron Franke cf136a91d6 [Core] Completely kill math_2d.h, change includes 2018-08-11 03:08:34 -05:00
Rémi Verschelde e6aec27428
Merge pull request #20511 from maksloboda/InputEventActionFix
Fixed shortcuts not working with InputEventActions
2018-07-28 09:48:44 +02:00
Max c2be1a75a0 Fixed shortcuts not working with InputEventActions 2018-07-27 15:09:41 +03:00
Marcelo Fernandez 7a5f9fc08e Added a new MIDIDriver class 2018-07-21 09:09:42 -03:00
unknown 9cc41a59ac Added support for extra mouse buttons. 2018-07-09 14:34:19 +03:00
Gilles Roudiere ebfa731012 Allow actions to provide an analog value 2018-04-16 23:20:43 +02:00
Poommetee Ketson 67e20dc2b6 (Magnify|Pan)Gesture: implement as_text 2018-02-24 10:35:25 +07:00
Ariel Manzur 81426ff0a8 - Improves portability in joystick buttons enum
- Fixes linking bug in modules split library
2018-01-24 19:12:54 -03:00
Rémi Verschelde e4213e66b2 Add missing copyright headers and fix formatting
Using `misc/scripts/fix_headers.py` on all Godot files.
Some missing header guards were added, and the header inclusion order
was fixed in the Bullet module.
2018-01-05 01:22:23 +01:00
Rémi Verschelde b50a9114b1 Update copyright statements to 2018
Happy new year to the wonderful Godot community!
2018-01-01 14:40:47 +01:00
Juan Linietsky 4a2eef4ad8 Removed the InputEvent ID field, which was unused and can cause bugs. 2017-12-26 09:49:31 -03:00
Andreas Haas c76a9b99b0
Core: Bind InputEventGesture events. 2017-11-24 19:23:04 +01:00
Bernhard Liebl 80ad8afc85 Native pan and zoom for macOS 2017-11-21 09:11:39 +01:00
Bastiaan Olij 2a230d571d Increase joystick axis from 8 to 10 2017-11-08 19:56:30 +11:00
jagt 4e94292573 move button/joy constants to enums 2017-10-23 13:36:50 +08:00
Rémi Verschelde bd282ff43f Use HTTPS URL for Godot's website in the headers 2017-08-27 14:16:55 +02:00
volzhs 62bb600b5c Show proper string with InputEvent.as_text() 2017-08-25 01:14:36 +09:00
Andreas Haas 5052cb2b91
InputEventJoypadMotion: Add missing is_pressed() method. 2017-08-12 13:04:14 +02:00
Juan Linietsky 3f2cd75c6f Fix shortcuts, make them visible again and work. 2017-06-22 19:57:59 -03:00
Andreas Haas 9bc5348961
InputEvent: Renamed "pos" property to "position"
Make the naming consistent with other classes.
2017-06-03 11:26:39 +02:00
Andreas Haas 3744d9fd55
Fix virtual methods in InputEventKey.
This fixes a lot of problems with key input in the engine.
2017-05-25 21:56:54 +02:00
George Marques 452caf3f80
Change InputEventScreenTouch from struct to class 2017-05-24 16:06:07 -03:00
Juan Linietsky 5b3709d309 Removal of InputEvent as built-in Variant type..
this might cause bugs I haven't found yet..
2017-05-20 17:05:38 -03:00
toger5 304a1f5b5a Implemented scrolling factor for smooth trackpad scrolling
Working platforms platform: OSX, Windows.
Support for almost all ui elements, including project list.
2017-05-07 14:23:56 +02:00
Rémi Verschelde df61dc4b2b Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00