Commit graph

618 commits

Author SHA1 Message Date
Rémi Verschelde
f706a3bd54
Web: Clarify that OS.get_unique_id is not supported
Remove the base error message in `OS`, we no longer really error out this
way for not implemented methods. Instead, each platform should override them
to provide the context they want.

Fixes #82439.

(cherry picked from commit 0a10f09ce4)
2024-01-18 16:19:43 +01:00
Bastien JAUNY
d214867a7e
Fix unitialized variables in core 2024-01-05 11:47:46 +01:00
Rémi Verschelde
dfed698ee3
Merge pull request #79706 from puzzud/3.x
[3.x] Prevent double input events on gamepad when running through steam input
2023-08-02 17:29:55 +02:00
lawnjelly
5162efbfe9 2D Fixed Timestep Interpolation
Adds support to canvas items and Camera2D.
2023-08-01 16:07:48 +01:00
puzzud
140440ee82 [3.x] Prevent double input events on gamepad when running through steam input #79706
Co-authored-by: Eoin O'Neill <eoinoneill1991@gmail.com>
2023-07-20 16:35:44 -04:00
Rémi Verschelde
1538b870f1
Merge pull request #76715 from m4gr3d/add_input_event_cancelled_state_3x
[3.x] Augment the `InputEvent` class with a `CANCELED` state
2023-05-17 18:21:42 +02:00
Rémi Verschelde
4cc2229a52
Merge pull request #72251 from RandomShaper/robust_sync_3.x
[3.x] Backport some multi-threading goodies
2023-05-16 13:16:25 +02:00
Fredia Huya-Kouadio
94d6c3dcc6 Augment the InputEvent class with a CANCELED state
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.
2023-05-12 15:22:54 -07:00
Fredia Huya-Kouadio
f3cdff46fc Add benchmark logic
Add benchmarking measuring methods to `OS` to allow for platform specific overrides (e.g: can be used to hook into platform specific benchmarking and tracing capabilities).
2023-03-20 23:29:36 -07:00
Pedro J. Estébanez
32a9227f5b Robustify multi-threading primitives 2023-02-17 19:16:10 +01:00
Pedro J. Estébanez
7d135cb962 Fix code style and consistency of RWLock and Semaphore 2023-01-28 14:17:51 +01:00
Hugo Locurcio
badcfa2523
Expose OS.read_string_from_stdin() to the scripting API
This can be used in scripts to read user input in a blocking manner.

This also removes the unused `block` argument, which is always `true`.
2023-01-16 11:39:53 +01:00
Rémi Verschelde
1426cd3b3a
One Copyright Update to rule them all
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".

Backported from #70885.
2023-01-10 15:26:54 +01:00
Hugo Locurcio
be3017114f Silence Input.vibrate_handheld() warning as it's already documented
The warning causes messages to be spammed if you are calling this
method in a game that runs on both desktop and mobile platforms,
unless you guard all calls to `Input.vibrate_handheld()` with
`OS.has_feature("mobile") or OS.has_feature("web")`.

Since the limitation is already documented (and is obvious enough
given the method's name), the warning message is redundant.

(cherry picked from commit 4a991887bf)
2022-12-18 10:32:04 +08:00
Rémi Verschelde
b0b759e6da
SCons: Cleanup DEBUG, _DEBUG and NDEBUG defines
- `_DEBUG` is MSVC specific so it didn't make much sense to define for
  Android and iOS builds.
- iOS was the only platform to define `DEBUG`. We don't use it anywhere
  outside thirdparty code, which we usually don't intend to debug, so it
  seems better to be consistent with other platforms.
- Consistently define `NDEBUG` to disable assert behavior in both `release`
  and `release_debug` targets. This used to be set for `release` for all
  platforms, and `release_debug` for Android and iOS only.
- Due to the above, I removed the only use we made of `assert()` in Godot
  code, which was only implemented for Unix anyway, should have been
  `DEV_ENABLED`, and is in PoolAllocator which we don't actually use.
- The denoise and recast modules keep defining `NDEBUG` even for the `debug`
  target as we don't want OIDN and Embree asserting all over the place.

(cherry picked from commit 26e9145c26)
2022-12-12 14:49:21 +01:00
Pedro J. Estébanez
0873cf0656 Keep a single, portable implementation of OS::get_processor_count()
(cherry picked from commit 6bf02c0162)
2022-12-12 14:47:37 +08:00
Emmanouil Papadeas
0754c7ee1a Fix InputEventAction's is_action method ignoring exact_match parameter
(cherry picked from commit 38b51942d6)
2022-12-12 14:44:20 +08:00
voidshine
7284230ebe
Fix MIDI note-on events being converted to note-off events
Update documentation with note about MIDI velocity interpretation

(cherry picked from commit f0f72b3132)
2022-11-30 15:36:03 +01:00
Rafał Mikrut
e359ba3733
Fix exporting big templates
(cherry picked from commit 86fa3ba560)
2022-11-30 15:34:26 +01:00
Fredia Huya-Kouadio
be4b07c3e4 Add double_tap attribute to InputEventScreenTouch
This provides parity with the `InputEventMouseButton` allowing for proper conversion between the two events.
2022-10-20 11:56:11 -07:00
lawnjelly
d60eae3dbc Fix uninitialized data reads in Input
Found by Valgrind.
2022-09-06 14:21:01 +01:00
Rémi Verschelde
4196cc0c00
Merge pull request #64445 from timothyqiu/action-completion-3.x
[3.x] Fix action name completion for `Input.get_{axis,vector}`
2022-09-01 08:20:40 +02:00
Fredia Huya-Kouadio
9910d4681d Additional fixes to the Android get_current_dir() implementation. 2022-08-30 10:08:30 -07:00
Pedro J. Estébanez
29e235b341 Add FileAccess::get_access_type()
(cherry picked from commit 8c6b2fbb90)
2022-08-29 15:44:29 +02:00
Haoyu Qiu
e6dd71d227 Fix action name completion for Input.get_{axis,vector} 2022-08-15 23:44:11 +08:00
Rémi Verschelde
6eee83579a
Merge pull request #64101 from timothyqiu/subsecond 2022-08-08 16:31:49 +02:00
Rémi Verschelde
7dc8ec0c61
Merge pull request #63643 from aaronfranke/3.x-mouse-mode-ch 2022-08-08 14:36:45 +02:00
Haoyu Qiu
1be078ebcb Fix Time.get_unix_time_from_system() not including msecs 2022-08-08 20:31:51 +08:00
Rémi Verschelde
0bed7ea63f
Merge pull request #61316 from bruvzg/tts_3x
[3.x] Backport text-to-speech support.
2022-08-05 23:45:51 +02:00
Rémi Verschelde
daa5b542b4
Merge pull request #56765 from madmiraal/fix-45592-2-3.x
[3.x] Fix mouse speed not changing fast enough
2022-08-05 22:37:44 +02:00
Rémi Verschelde
26762a71b6
Merge pull request #58537 from winterpixelgames/feature/virtual-keyboard-types-3.x 2022-08-05 19:37:13 +02:00
Fabio Alessandrelli
4e33610fb0 [Core] Use std type traits to check operations triviality.
(cherry picked from commit 6f02183f8c)
2022-08-04 15:20:28 +02:00
Rémi Verschelde
751b16a285 File: Re-add support to skip CR (\r) in File::get_as_text
This was removed in #63481, and we confirmed that it's better like this,
but we add back the possibility to strip CR as an option, to optionally
restore the previous behavior.

For performance this is done directly in `String::parse_utf8`.

Also fixes Android `FileAccess::get_line()` as this one _should_ strip CR.

Supersedes #63717.

(cherry picked from commit 1418f97c70)
2022-08-01 00:40:55 +02:00
Aaron Franke
0d6e2d1090
Add MOUSE_MODE_CONFINED_HIDDEN to MouseMode enum 2022-07-29 13:46:04 -05:00
pattlebass
fb7ecc748f [3.x] HTML5: Add support for Input.vibrate_handheld() 2022-07-28 13:20:05 +03:00
Rémi Verschelde
818f1eed31 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 14:53:37 +02:00
Fredia Huya-Kouadio
aab26ad7d2 Address slow copy performance when using the FileAccessFilesystemJAndroid implementation.
Read/write ops for this implementation are done through the java layer via jni, and so for good performance, it's key to avoid numerous repeated small read/write ops due the jni overhead.

The alternative is to allocate a (conversatively-sized) large buffer to reduce the number of read/write ops over the jni boundary.
2022-07-21 08:21:12 -07:00
Rémi Verschelde
101cbe5d5b
Merge pull request #62723 from hansemro/eraser-detect-3.x 2022-07-15 00:13:15 +02:00
Brian Semrau
ce24b48e50 Add support for multiple virtual keyboard types 2022-07-07 14:22:28 -04:00
Hansem Ro
193d5c11f3 [3.x, macOS, Windows, X11] Add stylus inverted/eraser support to InputEventMouseMotion event 2022-07-04 16:12:11 -07:00
Estelle Linkpy Reid
7a2d3b04a5 Corrected InputEventKey::as_text to return a non-empty string for physical keys. 2022-07-02 15:34:15 +02:00
bruvzg
6489fe890e
Backport text-to-speech support. 2022-07-01 11:04:50 +03:00
ne0fhyk
24e3b3b88d Add full support for Android scoped storage.
This was done by refactoring directory and file access handling for the Android platform so that any general filesystem access type go through the Android layer.
This allows us to validate whether the access is unrestricted, or whether it falls under scoped storage and thus act appropriately.
2022-06-26 16:53:02 -07:00
bruvzg
11a7997a67 [Windows, 3.x] Add support for handling network share paths. 2022-06-13 09:24:35 +03:00
FireForge
53c01540d9 Make Input mouse_mode and use_accumulated_input properties
Co-authored-by: Haoyu Qiu <timothyqiu32@gmail.com>
2022-06-10 17:33:12 +08:00
Aaron Franke
0470392930
[3.x] Improve architectures in OS::has_feature and make it work on MSVC 2022-06-05 23:16:13 -05:00
Nicholas Huelin
5cedb395dc Fix inconsistent naming in Time
(cherry picked from commit 8409d92282)
2022-05-16 15:58:36 +02:00
mdavisprog
53fb0440d3 Add OS::is_process_running function.
Adds the is_process_running function to the native OS class and exposes it to script.

This is implemented on Windows and Unix platforms. A stub is provided for other platforms that do not support this function.

Documentation is updated to reflect new API function.

(cherry picked from commit f3c1232c59)
2022-05-05 15:02:46 +02:00
lawnjelly
df7fab51a3 Physics Interpolation - Flush transforms after physics tick
Leftover transforms from the physics tick were being flushed during idle, which was causing problems for physics interpolation.

This PR flushes the transforms at the end of the physics tick when physics interpolation is active.
2022-05-04 20:30:46 +01:00
Rémi Verschelde
d8e702b010
Merge pull request #60552 from madmiraal/implement-3466-3.x
[3.x] Add a method for obtaining display cutouts on Android
2022-05-02 07:58:05 +02:00