Commit graph

1034 commits

Author SHA1 Message Date
Pedro J. Estébanez 99fe462452 Modernize Thread
- Based on C++11's `thread` and `thread_local`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed (except for the few cases of non-portable functions)
- Simpler for `NO_THREADS`
- Thread ids are now the same across platforms (main is 1; others follow)
2021-01-29 12:02:13 +01:00
Sergey Minakov 7990c2c5e8 [Plugins] Rename 'PluginConfig' struct to platform specific name 2021-01-15 17:54:35 +03:00
Rémi Verschelde af878716f2
CI: Update to clang-format 11 and apply ternary operator changes 2021-01-12 19:32:53 +01:00
Marcel Admiraal 2a74b388d0 Split OS::execute into two methods
1. execute(): Executes a command and returns the results.
2. create_process(): Creates a new process and returns the new process' id.
2021-01-09 10:03:23 +00:00
Fredia Huya-Kouadio eee213e01a Improve the logic to compile for Android by automatically detecting and setting up the Android NDK if needed. 2021-01-05 15:07:17 -08:00
Rémi Verschelde 3433780c49
Merge pull request #44645 from m4gr3d/update_apk_signing_logic
Update the logic to sign prebuilt Godot Android apks
2021-01-01 22:58:11 +01:00
Fredia Huya-Kouadio 49969de221 Update the logic to sign prebuilt Godot Android apks.
The previously used tool, `jarsigner` has been deprecated in favor of `apksigner` which is bundled with the Android SDK.
The logic is refactored accordingly and a few editor settings have been deprecated in the process as they're no longer necessary.

Note: As a side effect, specifying the Android SDK path is now required. The docs will be updated to reflect that change.
2021-01-01 13:36:27 -08:00
Rémi Verschelde b5334d14f7
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 🎆
2021-01-01 20:19:21 +01:00
Rémi Verschelde 72c13c2631
Merge pull request #44638 from m4gr3d/export_format_util_method
Hardcode the export format for the editor 'run' feature
2020-12-30 09:11:31 +01:00
Fredia Huya-Kouadio de64b783b4 Add utility method to export the project using a preset format and sign parameter. 2020-12-29 09:04:01 -08:00
Rémi Verschelde e4c0572385
Merge pull request #44593 from madmiraal/rename-mainloop-methods
Rename MainLoop methods to match Node methods
2020-12-28 14:44:28 +01:00
Marcel Admiraal 5b937d493f Rename empty() to is_empty() 2020-12-28 10:39:56 +00:00
Fredia Huya-Kouadio 2d492ff8ba Fix invalid invocation of get_class_loader.
The call was made on a `Godot` instance instead of an `Activity` instance.
2020-12-23 02:08:27 -08:00
Marcel Admiraal d9e9eb8d04 Rename MainLoop methods to match Node methods 2020-12-22 12:34:57 +00:00
Rémi Verschelde c7b53c03ae
SCons: Add explicit dependencies on thirdparty code in cloned env
Since we clone the environments to build thirdparty code, we don't get an
explicit dependency on the build objects produced by that environment.

So when we update thirdparty code, Godot code using it is not necessarily
rebuilt (I think it is for changed headers, but not for changed .c/.cpp files),
which can lead to an invalid compilation output (linking old Godot .o files
with a newer, potentially ABI breaking version of thirdparty code).

This was only seen as really problematic with bullet updates (leading to
crashes when rebuilding Godot after a bullet update without cleaning .o files),
but it's safer to fix it everywhere, even if it's a LOT of hacky boilerplate.
2020-12-18 10:29:34 +01:00
Marcel Admiraal fa435a550a Add override keywords to core/os.h derived classes. 2020-12-17 18:02:31 +00:00
Marcel Admiraal 8ef5e3201c Don't handle BaseException in build scripts 2020-12-12 10:05:42 +00:00
Fabio Alessandrelli 09a9712a6a Remove unused FileAccessJAndroid. 2020-12-09 10:58:36 +01:00
Rémi Verschelde e5e1277ecd
Merge pull request #44161 from Faless/fix/fa_buffered_remove
Remove unused FileAccessBuffered
2020-12-09 09:14:14 +01:00
thebestnom d543917c03 Android: fix mouse capture relative wrong 2020-12-08 23:51:45 +02:00
thebestnom e7f259c366 Android: Allow Mouse Capture 2020-12-08 22:14:08 +02:00
Rémi Verschelde 90bdba576a
Merge pull request #43742 from qarmin/editor_modules_default_values
Initialize class/struct variables with default values in platform/ and editor/
2020-12-08 15:53:42 +01:00
Fabio Alessandrelli 781efc26e0 Remove now unused FileAccessBuffered. 2020-12-06 19:37:11 +01:00
reduz 2787ad65be RenderingServer reorganization 2020-12-04 18:39:46 -03:00
alan-w-255 7fa803fa2c
fix android wrong multi-touch pointerid
Fixes #43519.
2020-12-03 13:34:04 +01:00
Rafał Mikrut e1811b689b Initialize class/struct variables with default values in platform/ and editor/ 2020-12-02 16:09:11 +01:00
bruvzg 99666de00f
[Complex Text Layouts] Refactor Font class, default themes and controls to use Text Server interface.
Implement interface mirroring.
Add TextLine and TextParagraph classes.
Handle UTF-16 input on macOS and Windows.
2020-11-26 14:25:48 +02:00
bruvzg b9f441e81e
[Complex Text Layouts] Add third-party TextServer dependencies (ICU, HarfBuzz, Graphite). 2020-11-26 13:55:27 +02:00
Fredia Huya-Kouadio 918b218b55 Update gradle build files to automatically perform signing and zipalign tasks for custom builds. 2020-11-22 18:11:54 -08:00
Rémi Verschelde 504efc5f9b
Export: Reorder options for consistency across platforms 2020-11-20 11:17:50 +01:00
Fredia Huya-Kouadio c4f2d87747 Fix zipalign command name on Windows machines. 2020-11-18 23:30:45 -08:00
Aaron Franke 02161aad5a
Remove empty lines around braces with the formatting script 2020-11-16 23:38:11 -05:00
Rémi Verschelde 484c3d5e27
Merge pull request #43248 from HEAVYPOLY/master
Change android orientations from sensor to user
2020-11-16 22:12:53 +01:00
Fredia Huya-Kouadio 46cc3233d8 Update the logic to query for the 'scons' command executable path. 2020-11-14 14:36:53 -08:00
Rémi Verschelde 9e7348f788
Merge pull request #43526 from m4gr3d/address_new_custom_build_logic_issues
Address new custom build logic issues
2020-11-14 22:58:16 +01:00
Fredia Huya-Kouadio 5f6a44f0bb Add missing zip alignment step for generated apks. 2020-11-14 13:10:38 -08:00
Fredia Huya-Kouadio 3de720c11d Fix issue causing Export all to fail. 2020-11-14 13:10:38 -08:00
Fredia Huya-Kouadio 3c1a1a760e Clear unneeded assets when generating an apk expansion.
Clean up export wording to account for the different export formats.
2020-11-14 13:07:32 -08:00
Marcus Brummer e1b9be4a6b Added the .jks file extension as valid preset for Android keystore files 2020-11-14 00:29:23 +01:00
Fredia Huya-Kouadio 597d9409f3 Remove duplicate Android orientation settings. 2020-11-13 12:20:06 -08:00
reduz 127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
Vaughan Ling d658063833 Change android orientations from sensor to user
# Conflicts:
#	platform/android/java/lib/src/org/godotengine/godot/GodotIO.java
2020-10-31 17:14:32 -07:00
Rémi Verschelde 41f66761fd
Merge pull request #37158 from thebestnom/android-click-support
Support mouse events on Android
2020-10-30 16:00:03 +01:00
Fredia Huya-Kouadio edf762fba6 Add a separate nativeSrcsConfigs module to handle Android Studio constraints for native code editor support. 2020-10-29 00:01:14 -07:00
Fredia Huya-Kouadio aff7cf4390 Update the gradle plugins 2020-10-28 23:59:33 -07:00
Rémi Verschelde 2eaedcf14e
Merge pull request #42361 from akien-mga/vulkan-layers-opt-in
Vulkan: Make validation layers optional
2020-10-28 21:43:22 +01:00
Rémi Verschelde 45da7d579a
Merge pull request #43153 from nekomatata/android-build-version-close
Release .build_version file handle in Android custom build export
2020-10-28 10:03:18 +01:00
PouleyKetchoupp b271315bac Release .build_version file handle in Android custom build export 2020-10-28 09:07:20 +01:00
Mark Riedesel 96e22bd9fb Implement OS.get_window_safe_area() for Android 2020-10-27 13:14:00 -04:00
Rémi Verschelde 54e6338c9b
Vulkan: Make validation layers optional
They're now disabled by default, and can be enabled with the command line
argument `--vk-layers`.

When enabled, the errors about them being missing are now warnings, as
users were confused and thought this meant Vulkan is broken for them.

Fix crash in `~VulkanContext` when validation layers are disabled (exposed by
this PR since before they could not be disabled without source modification).

Also moved VulkanContext member initializations to header.

Fixes #37102.
2020-10-27 16:19:15 +01:00
Mark Riedesel 5fe902244a Fix android apk contents having mtime 1 month in future
minizip documentation describes tm_mon as expecting the number of months
since January - [0, 11], but the month returned by OS.get_date() is in
the range of [1, 12].
2020-10-23 15:05:48 -04:00
thebestnom 42513f2f47 Android: Mouse Implementation
Implement mouse
Move touch to inputManager
Change to use android/input.h
2020-10-09 04:14:56 +03:00
Rémi Verschelde 4e19e3603b
Merge pull request #41385 from m4gr3d/fix_splash_loading_master
Fix splash screen loading on Android
2020-09-28 20:45:53 +02:00
Fredia Huya-Kouadio 79c1cf600b Add overridable init method for the Godot fragment instance. 2020-09-18 16:59:09 -07:00
bruvzg f043eabdd8
Adds PCK encryption support (using script encryption key for export).
Change default encryption mode from ECB to CFB.
2020-09-05 14:53:39 +03:00
bruvzg 80b8eff6aa
[Complex Test Layouts] Change String to use UTF-32 encoding on all platforms. 2020-09-03 19:56:24 +03:00
Fredia Huya-Kouadio b8d5ced8cd Fix issue causing the textedit to move upward 2020-08-30 10:42:38 -07:00
Rémi Verschelde c59e9399e7
Merge pull request #41550 from godotengine/revert-40671-virtual-keyboard-height-fix
Revert "Fix virtual keyboard height regression"
2020-08-27 08:55:51 +02:00
Rémi Verschelde f98b32ff51
Merge pull request #41549 from godotengine/revert-40484-android-virtual-keyboard-adjustment
Revert "Disable virtual keyboard focus adjustment on Android"
2020-08-26 23:48:09 +02:00
Fredia Huya-Kouadio db35a008f6
Revert "Fix virtual keyboard height regression" 2020-08-26 14:38:02 -07:00
Fredia Huya-Kouadio ffd0bb1d02
Revert "Disable virtual keyboard focus adjustment on Android" 2020-08-26 13:27:25 -07:00
Fredia Huya-Kouadio 04b402b6f1
Revert "Move PopupWindow logic to GodotEditText on Android" 2020-08-26 13:24:18 -07:00
Fredia Huya-Kouadio 2717891141 Fix splash screen loading on Android 2020-08-19 16:16:37 -07:00
Rémi Verschelde 33b2070d2e Remove obsolete GLES2 backend code
This code currently isn't compiled (and cannot compile).

We plan to re-add OpenGL ES-based renderer(s) in Godot 4.0 alongside Vulkan
(probably ES 3.0, possibly also a low-end ES 2.0), but the code will be quite
different so it's not relevant to keep this old Godot 3.2 code.

The `drivers/gles2` code from the `3.2` branch can be used as a reference for
a potential new implementation.
2020-08-13 10:04:53 +02:00
Rémi Verschelde 7e19f217bd
Merge pull request #41000 from amanj120/forward_port_bundle_pr_export
Add 'Export App Bundle' to Android Export Options
2020-08-11 19:03:40 +02:00
Aman Jain 2b89944a3d Add 'Export App Bundle' to Android Export Options 2020-08-05 12:55:02 -04:00
Christopher Davis 41d8c0c818 platform: Update metadata for export platforms
Updates the logos of for macOS, Android, and iOS; Also
changes "Mac OSX" to "macOS"

Addresses https://github.com/godotengine/godot-proposals/issues/1161
2020-08-01 23:43:14 -07:00
PouleyKetchoupp cac7eb3a64 Move PopupWindow logic to GodotEditText on Android 2020-07-28 21:19:17 +02:00
Aman Jain e906ac4d3b refactor apk signing into it's own method 2020-07-27 14:24:57 -04:00
Rémi Verschelde bd9fc75768
Merge pull request #40706 from akien-mga/style-fix-file_format-macos
Fix code format scripts compat with non-GNU Unices
2020-07-27 13:27:56 +02:00
Rémi Verschelde c71e189efd Style: Fix code format scripts compat with non-GNU Unices
It's too hard to get compatibility between GNU and BSD sed,
so let's just use perl oneliners.

And improve it to also remove trailing tabs, not just spaces.
2020-07-27 13:11:44 +02:00
Rémi Verschelde 6de86946ea
Merge pull request #40671 from nekomatata/virtual-keyboard-height-fix
Fix virtual keyboard height regression
2020-07-27 08:57:19 +02:00
Rémi Verschelde b19b896e06
Merge pull request #40487 from nekomatata/virtual-keyboard-enter-fixes
Fix Return key events in LineEdit & TextEdit on Android
2020-07-26 20:25:53 +02:00
PouleyKetchoupp 8c05dadcff Fix Return key events in LineEdit & TextEdit on Android
Depending on the device implementation, editor actions could be
received with different action ids or not at all for multi-line.

Added a parameter to virtual keyboards to properly handle single-line
and multi-line cases in all situations.

Single-line:
Input type set to text without multiline to make sure actions are sent.
IME options are set to DONE action to force action id consistency.

Multi-line:
Input type set to text and multiline to make sure enter triggers new lines.
Actions are disabled by the multiline flag, so '\n' characters are
handled in text changed callbacks.
2020-07-26 20:06:07 +02:00
Rémi Verschelde f940e5e000 CI: Install master version of psf/black
Until https://github.com/psf/black/pull/1328 makes it in a stable release,
we have to use the latest from Git.

Apply new style fixes done by latest black.
2020-07-26 19:48:25 +02:00
PouleyKetchoupp a2dd966301 Fix virtual keyboard height regression
Disabling virtual keyboard focus adjustement caused get_keyboard_height
to always return 0 because it was calculated when the view is resized.

In order to fix it, a PopupWindow is now created on top of the main view
and is set for focus adjustments so the keyboard size can be calculated
based on this popup without affecting the main view.
2020-07-24 19:54:06 +02:00
Aman Jain e53067c42e Write an AndroidManifest.xml file to be merged with app module's manifest. 2020-07-24 12:53:27 -04:00
Rémi Verschelde 1dc00ce7b9
Merge pull request #40348 from amanj120/forward_port_bundle_pr_icons
Copy project icons to Gradle project directory during Android Custom Build.
2020-07-23 18:03:08 +02:00
Aman Jain 4a5ddcbad2 Copy icons to Gradle project 2020-07-23 11:37:33 -04:00
Rémi Verschelde dcf902df85 SCons: Remove unused DEBUG_MEMORY_ENABLED define
Its last use was removed in Godot 3.0, so it no longer makes sense to define.

Also removed `D3D_DEBUG_INFO` for Windows as it's likely a left over from a
long time ago pre-opensourcing when Godot had some form of Direct3D 9 support?
2020-07-23 09:39:10 +02:00
thebestnom 166103c759 Android: Keyboard modifier and arrow key support 2020-07-21 22:13:24 +03:00
Rémi Verschelde b7aa474680
Merge pull request #40422 from amanj120/forward_port_bundle_pr_resources
Create strings.xml files in the Gradle project to handle localization
2020-07-20 22:26:44 +02:00
PouleyKetchoupp d7aaec8ffe Disable virtual keyboard focus adjustment on Android
Fixes #37190

The default adjustment setting was causing the view to pan down in order
to adjust the focus on the text content.

We don't need any focus adjustment since we're using a fixed size window
for our application.

Documentation:
https://developer.android.com/reference/android/view/WindowManager.LayoutParams#SOFT_INPUT_ADJUST_NOTHING
2020-07-20 12:04:02 +02:00
Aman Jain 5ff6f7a86b Create strings.xml files in the gradle project to handle localization 2020-07-15 13:02:59 -04:00
thebestnom 4dc94e93bb Android: fix display server always alerting no Vulkan support 2020-07-14 19:37:36 +03:00
Rémi Verschelde 28e8347d6c
Merge pull request #40354 from bruvzg/add_vulkan_init_message
Display error popup instead of crashing if Vulkan init failed.
2020-07-14 09:03:25 +02:00
Aaron Franke 9986439352
Commit other files changed by file_format.sh 2020-07-13 14:14:11 -04:00
bruvzg 996910b627
Add error messages if Vulkan init failed, prevent Vulkan context freeing uninitialized device and instance. 2020-07-13 19:24:21 +03:00
Marcel Admiraal 26fcf2b04c Add override keywords. 2020-07-10 13:56:54 +01:00
Rémi Verschelde dc856481ff
Merge pull request #40244 from amanj120/forward_port_bundle_pr_permissions
Refactor permissions and command line flags into separate methods
2020-07-10 13:19:37 +02:00
Aman Jain f579057748 Refactor permissions and command line flags into separate methods 2020-07-09 16:34:08 -04:00
Aman Jain 78e003951a Utility methods for writing files to Gradle project. 2020-07-09 13:57:15 -04:00
Stijn Hinlopen 929b98d24b Remove String::find_last (same as rfind) 2020-07-03 15:26:22 +02:00
Juan Linietsky 438c380458 Add a separate application focus/in notification out from Window focus notification. 2020-06-30 10:40:06 -03:00
Fredia Huya-Kouadio 2d53b8173e Fix the logic to enable focus awareness 2020-06-27 16:43:08 -07:00
Fredia Huya-Kouadio 175d43738a Enable the ability to use Godot as a subview within an Android app 2020-06-25 19:52:40 -07:00
Fredia Huya-Kouadio 206cbd960b Follow up cleanup for the godotpayment project module 2020-06-22 12:53:25 -07:00
Timo Schwarzer 83a966f0d8
Remove GodotPayment android plugin
This is now available in a separate repository
at https://github.com/godotengine/godot-google-play-billing
2020-06-22 09:21:05 +02:00
Rémi Verschelde 35414f1dec
Merge pull request #39053 from timoschwarzer/static-assert-variant-arg-max
Add static_assert checks where code assumes VARIANT_ARG_MAX == 5
2020-06-19 23:51:22 +02:00
Fredia Huya-Kouadio 6daf9b78af Clean up the GodotPlugin public API. 2020-06-16 09:25:09 -07:00
Fredia Huya-Kouadio 2bf1f8e4b3 Add support for focus awareness 2020-06-04 15:49:55 -07:00
Marcus Brummer 21263a65a9 Check if the specified Android release keystore exists 2020-06-04 13:37:14 +02:00
PouleyKetchoupp be22a1f9bc Fix inconsistent error messages with Android custom export templates 2020-06-01 23:13:31 +02:00
volzhs c227733bd8 Add missing consumePurchase plugin method for GodotPayment 2020-05-28 22:48:48 +09:00
Fredia Huya-Kouadio c948d25b6e Validate that Use Custom Build is enabled when Plugins are selected
Remove `GodotPayment` from the default build template
2020-05-27 12:07:53 -07:00
Rémi Verschelde 7b7b872d94
Merge pull request #39080 from m4gr3d/fix_emit_signal
Use compile-time constant for the size of the signal parameters
2020-05-27 13:05:32 +02:00
Fredia Huya-Kouadio 63286ebba4 Use compile-time constant for the size of the signal parameters 2020-05-27 03:40:26 -07:00
Fredia Huya-Kouadio 75100e5644 Provide the ability for clients of the Godot library to add their own command line arguments 2020-05-27 02:13:52 -07:00
Rémi Verschelde 24ad4894cc
Merge pull request #39050 from timoschwarzer/google-play-billing-4.0
(4.0) Re-implement GodotPayment Android plugin using the Google Play Billing library
2020-05-26 15:34:06 +02:00
Timo Schwarzer 4b00bf8e83
Re-implement GodotPayment Android plugin using the Google Play Billing library 2020-05-25 22:24:17 +02:00
Rémi Verschelde 242b715144
Merge pull request #38996 from mbrlabs/android-plugin-fix
Perform a clean Gradle build if android plugins changed
2020-05-25 22:18:41 +02:00
Rémi Verschelde 072646f5dd
Merge pull request #39047 from m4gr3d/fix_emit_signal
Fix parameters passing when emitting signal
2020-05-25 22:13:49 +02:00
Timo Schwarzer 05b32fc01d
Add static_assert checks where code assumes VARIANT_ARG_MAX == 5 2020-05-25 21:55:03 +02:00
Fredia Huya-Kouadio bf76d2afcf Stop ignoring hidden files and directories in the assets directory 2020-05-25 12:03:35 -07:00
Fredia Huya-Kouadio e7e736c03b Fix parameters passing when emitting signal
The issue was caused because we were using variables local to the `for` loop block.
2020-05-25 11:50:36 -07:00
Marcus Brummer abd66c1bb0 Perform a clean Gradle build if android plugins changed
Fixes #38986
2020-05-25 19:18:02 +02:00
Rémi Verschelde 3ecdc27f49
Merge pull request #39004 from nekomatata/android-reset-surface
Proper surface reset when resuming app on Android
2020-05-24 22:31:03 +02:00
PouleyKetchoupp b987677cc0 Proper surface reset when resuming app on Android
Just re-creating the window instead of restarting the app entirely.
2020-05-24 20:42:21 +02:00
PouleyKetchoupp 39f59786fa Use long instead of int for object id in Android java wrapper
Using int for 64-bit values might cause issues with objects not found
in ObjectDB when the id is truncated.
2020-05-24 13:26:18 +02:00
Rémi Verschelde aec07538f4
Merge pull request #38309 from SkyLucilfer/AndroidLineEdit
Fix Android LineEdit editing bugs
2020-05-20 11:45:59 +02:00
Rémi Verschelde ca3192d18a Style: Fix unnecessary semicolons that confused clang-format 2020-05-19 11:24:58 +02:00
Fredia Huya-Kouadio 6e2988f26a Update the permission string for the Oculus hand tracking to match the latest api update 2020-05-18 15:28:18 -07:00
Fabio Alessandrelli 90c7102b51 Move mix_rate, ouput_latency to AudioDriverManager
Each driver used to define the (same) project settings values
`audio/mix_rate` and `audio/output_latency`, but the setting names are
not driver specific.
Overriding is still possible via platform tags.
2020-05-18 13:02:06 +02:00
Fredia Huya-Kouadio 14e6696c8e Implementation of the Godot Android Plugin configuration file 2020-05-17 11:11:26 -07:00
SkyJJ cc473b948f Fix Android LineEdit editing bugs 2020-05-16 17:55:27 +02:00
Rémi Verschelde d999071edf
Merge pull request #37924 from thebestnom/migrate-to-androidX
Android: Migrate deprecated support library to AndroidX
2020-05-16 09:03:17 +02:00
Rémi Verschelde 0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00
Rémi Verschelde 07bc4e2f96 Style: Enforce separation line between function definitions
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.
2020-05-14 16:54:55 +02:00
Rémi Verschelde 0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
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-14 16:54:55 +02:00
Rémi Verschelde 1f6f364a56 Port member initialization from constructor to declaration (C++11)
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-14 10:01:56 +02:00
thebestnom d0ced7a481 Android: Migrate deprecated support library to AndroidX 2020-05-10 19:03:44 +03:00
Rémi Verschelde 69de7ce38c Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine
Part of #33027.
2020-05-10 13:13:54 +02:00
Rémi Verschelde e956e80c1f Style: clang-format: Disable AllowShortIfStatementsOnASingleLine
Part of #33027, also discussed in #29848.

Enforcing the use of brackets even on single line statements would be
preferred, but `clang-format` doesn't have this functionality yet.
2020-05-10 13:12:16 +02:00
Rémi Verschelde 03b13e0c69 Style: Add missing copyright headers 2020-05-10 13:12:16 +02:00
Rémi Verschelde 6038325470 clang-format: Add JavaImportGroups for Java code 2020-05-06 23:26:43 +02:00
Fredia Huya-Kouadio ef62506e5c Address OS.request_permissions() bug when non-platform permission(s) is included 2020-05-05 10:33:46 +02:00
Rémi Verschelde fdf58a5858 Rename InputFilter back to Input
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.
2020-04-28 15:19:49 +02:00
Rémi Verschelde e71b05d365
Merge pull request #37193 from madmiraal/fix-android-export-unicode-errors
Fix Android export throwing Unicode errors.
2020-04-28 14:27:56 +02:00
Fredia Huya-Kouadio 328354f878 Fix detection logic for the Android sdk path
The previous logic used the 'tools' directory within the Android sdk to validate it. That directory was recently deprecated and removed from the Android sdk folder (https://developer.android.com/studio/releases/sdk-tools)
2020-04-24 04:21:36 -07:00
Fredia Huya-Kouadio 2f38cfd9ab Fix Android templates size regression
The issue was caused by PR #36906 which changes prevented the generated shared libraries from being stripped.
Since the change is only needed for development (debugging) purposes, it's commented out by default.
2020-04-23 00:21:39 -07:00
fhuya c591cb8fda Migrate legacy apache dependency to the GodotPayment plugin
This is the only location in the codebase where it's being used, so no need to make the main lib have a dependency on it.
2020-04-15 22:36:58 -07:00
Rémi Verschelde ca896ddbf0 Android: Bump build tools to 29.0.3 2020-04-14 13:47:13 +02:00
fhuya 73d4e2eefb Delete unused drawable resources. 2020-04-13 16:15:37 -07:00
SkyJJ 7fcd13575e Validate supported architectures when exporting to Android 2020-04-13 12:16:08 +02:00
fhuya 948c3cbb88 Add signal support to Godot Android plugin:
Supports registering and emitting signal from a Godot Android plugin
2020-04-10 09:22:21 -07:00
Rémi Verschelde 35c8ec065c
Merge pull request #37256 from m4gr3d/add_custom_build_gradle_settings
Update Android custom template build configuration
2020-04-10 13:57:56 +02:00
PouleyKetchoupp 802bbe87ad Fix extra warnings in Android build 2020-04-10 11:06:11 +02:00
PouleyKetchoupp e167af3737 Display Server support 2020-04-08 01:47:09 +02:00
fhuya 9c11076a20 Update Android custom template build configuration. 2020-04-07 09:07:44 -07:00
PouleyKetchoupp af424b1c7c Vulkan rendering for Android 2020-04-03 11:18:59 +02:00
Rémi Verschelde ba2ec53a26 Android: Downgrade gradle plugin to 3.5.3
With the NDK installed locally, gradle plugin 3.6.0 seems to enforce
a specific older NDK version, and will fail building if you don't have
it installed with:

```
No version of NDK matched the requested version 20.0.5594570.
Versions available locally: 21.0.6113669
```

Upstream issue: https://github.com/gradle/gradle/issues/12440
2020-04-02 23:16:54 +02:00
lupoDharkael 95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Rémi Verschelde cd4e46ee65 SCons: Format buildsystem files with psf/black
Configured for a max line length of 120 characters.

psf/black is very opinionated and purposely doesn't leave much room for
configuration. The output is mostly OK so that should be fine for us,
but some things worth noting:

- Manually wrapped strings will be reflowed, so by using a line length
  of 120 for the sake of preserving readability for our long command
  calls, it also means that some manually wrapped strings are back on
  the same line and should be manually merged again.

- Code generators using string concatenation extensively look awful,
  since black puts each operand on a single line. We need to refactor
  these generators to use more pythonic string formatting, for which
  many options are available (`%`, `format` or f-strings).

- CI checks and a pre-commit hook will be added to ensure that future
  buildsystem changes are well-formatted.
2020-03-30 09:05:53 +02:00
Rémi Verschelde 60d486acc8 Fix copyright headers for recently added files 2020-03-28 13:29:29 +01:00
Juan Linietsky a6f3bc7c69 Renaming of servers for coherency.
VisualServer -> RenderingServer
PhysicsServer -> PhysicsServer3D
Physics2DServer -> PhysicsServer2D
NavigationServer -> NavigationServer3D
Navigation2DServer -> NavigationServer2D

Also renamed corresponding files.
2020-03-27 15:21:27 -03:00
Juan Linietsky 8e6960a69e Refactored input, goes all via windows now.
Also renamed Input to InputFilter because all it does is filter events.
2020-03-26 15:49:39 +01:00
Juan Linietsky 4396e98834 Refactored Input, create DisplayServer and DisplayServerX11 2020-03-26 15:49:32 +01:00
Rémi Verschelde cbbe0743a9
Merge pull request #37219 from RajatGoswami/missing-include-guards
Adding missing include guards to header files identified by LGTM
2020-03-23 11:17:24 +01:00
Rajat Goswami 2ecf928ae3 Adding missing include guards to header files identified by LGTM.
This addresses the issue godotengine/godot#37143
2020-03-23 04:52:36 -04:00
Aaron Franke 7dbe8b65ae
Make file formatting comply with POSIX and Unix standards
UTF-8, LF, no BOM, and newlines at the end of files
2020-03-21 17:41:03 -04:00
Marcel Admiraal e74f8aaaf1 Fix Android export throwing Unicode errors. 2020-03-20 17:23:40 +00:00
fhuya d7b10beb1b Update the naming scheme for the GodotPlugin's methods in preparate of the vulkan integration. 2020-03-19 15:28:33 -07:00
unknown 90cdacd741 Removed unused code in android detect.py and SCsub 2020-03-18 18:12:50 +05:30
fhuya 99173c5fc4 Complete the implementation of the GodotPayment plugin.
Move the remaining plugin components within the plugin source code.
2020-03-17 17:43:09 -07:00
Rémi Verschelde 6c74f38f0b
Merge pull request #36906 from m4gr3d/enable_android_studio_debugging
Enable Android Studio debugging
2020-03-17 16:31:04 +01:00
Rémi Verschelde b8577ecce1
Merge pull request #37106 from akien-mga/clang-format-cpp11
Style: Set clang-format Standard to Cpp11
2020-03-17 08:42:39 +01:00
Rémi Verschelde cb282c6ef0 Style: Set clang-format Standard to Cpp11
For us, it practically only changes the fact that `A<A<int>>` is now
used instead of the C++03 compatible `A<A<int> >`.

Note: clang-format 10+ changed the `Standard` arguments to fully
specified `c++11`, `c++14`, etc. versions, but we can't use `c++17`
now if we want to preserve compatibility with clang-format 8 and 9.
`Cpp11` is still supported as deprecated alias for `Latest`.
2020-03-17 07:36:24 +01:00
PouleyKetchoupp c169367e83 Fix text_entered signal when max_length is used in LineEdit on Android
Fixes #35954
2020-03-13 17:04:40 +01:00
fhuya 7aa1c3e490 Fix initialization of the GodotPayment plugin
The `onGLRegisterPluginWithGodotNative()` method is supposed to be invoked only by `Godot`.
2020-03-09 10:32:23 +01:00
fhuya 41dadb2b2b Enable Android studio debugger. 2020-03-08 12:37:46 +01:00
fhuya 7dea2ad1de Trim the whitespace around the plugins names. 2020-03-06 17:22:04 -08:00
fhuya f097defba1 Re-architecture of the Godot Android plugin. 2020-03-05 10:00:19 -08:00
fhuya c090caa58b Provides a base implementation of the Vulkan surface view (VkSurfaceView.kt) and its accompanying components.
The implementation is meant to be extended and updated in order to integrate it with the existing Godot java and native codebase.
2020-03-05 08:01:42 -08:00
fhuya b38283a6b7 Miscellaneous cleanup for the Android codebase:
- update gradle plugins versions
- add formatting rules for AndroidManifest and gradle build files
- cleanup java_godot_lib_jni

Note: logic was mostly moved around and no new logic/functionality was added.
2020-03-04 12:16:17 -08:00
Rémi Verschelde 080b5df625
Merge pull request #36682 from nekomatata/android-compilation-fix
Compilation fixes on Android
2020-03-04 16:22:16 +01:00
PouleyKetchoupp ed0655cdfb Compilation fixes on Android 2020-03-04 13:15:37 +01:00
Pedro J. Estébanez aee586553a Improve UX of drive letters
Namely, move the drive dropdown to just the left of the path text box and don't include the former
in the latter.

This improves the UX on Windows.

In the UNIX case, since its concept of drives is (ab)used to provide shortcuts to useful paths, its
dropdown is kept at the original location.
2020-03-03 10:38:34 +01:00
Rémi Verschelde e2b66cacf7
Merge pull request #18020 from bruvzg/input_fix_non_latin_and_add_hw_scancodes
Fix non-latin layout scancodes on Linux, adds access to physical scancodes.
2020-03-01 23:00:42 +01:00
Pedro J. Estébanez 18fbdbb456 Reimplement Mutex with C++'s <mutex>
Main:
- It's now implemented thanks to `<mutex>`. No more platform-specific implementations.
- `BinaryMutex` (non-recursive) is added, as an alternative for special cases.
- Doesn't need allocation/deallocation anymore. It can live in the stack and be part of other classes.
- Because of that, it's methods are now `const` and the inner mutex is `mutable` so it can be easily used in `const` contexts.
- A no-op implementation is provided if `NO_THREADS` is defined. No more need to add `#ifdef NO_THREADS` just for this.
- `MutexLock` now takes a reference. At this point the cases of null `Mutex`es are rare. If you ever need that, just don't use `MutexLock`.
- Thread-safe utilities are therefore simpler now.

Misc.:
- `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same.
- Every case of lock, do-something, unlock is replaced by `MutexLock` (complex cases where it's not straightfoward are kept as as explicit lock and unlock).
- `ShaderRD` contained an `std::mutex`, which has been replaced by `Mutex`.
2020-02-26 20:40:10 +01:00
Juan Linietsky 33b5c57199 Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.

Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.

For Variant, the float datatype is always 64 bits, and exposed as `float`.

We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.

Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-25 12:55:53 +01:00
bruvzg 1af06d3d46
Rename scancode to keycode.
Add `physical_keycode` (keyboard layout independent keycodes) to InputEventKey and InputMap.
Fix non-latin keyboard layout keycodes on Linux/X11 (fallback to physical keycodes).
2020-02-25 12:30:33 +02:00
Rafał Mikrut d0621b954b Fix suspicious | and + operators 2020-02-23 09:28:54 +01:00
Juan Linietsky 69c95f4b4c Reworked signal connection system, added support for Callable and Signal objects and made them default. 2020-02-20 08:24:50 +01:00
Juan Linietsky 3205a92ad8 PoolVector is gone, replaced by Vector
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are
sugar for `Vector<Type>`.
2020-02-18 10:10:36 +01:00
Rémi Verschelde 3dea5fd631 Remove incomplete battery status/power API
It was initially implemented in #5871 for Godot 3.0, but never really
completed or thoroughly tested for most platforms. It then stayed in
limbo and nobody seems really keen to finish it, so it's better to
remove it in 4.0, and re-add eventually (possibly with a different API)
if there's demand and an implementation confirmed working on all
platforms.

Closes #8770.
2020-02-14 13:43:32 +01:00
Rémi Verschelde 386968ea97 Remove obsolete GLES3 backend
Due to the port to Vulkan and complete redesign of the rendering backend,
the `drivers/gles3` code is no longer usable in this state and is not
planned to be ported to the new architecture.

The GLES2 backend is kept (while still disabled and non-working) as it
will eventually be ported to serve as the low-end renderer for Godot 4.0.

Some GLES3 features might be selectively ported to the updated GLES2
backend if there's a need for them, and extensions we can use for that.

So long, OpenGL driver bugs!
2020-02-13 10:36:44 +01:00
Juan Linietsky 0586e18449 Custom material support seems complete. 2020-02-11 11:53:29 +01:00
Juan Linietsky 3f335ce3d4 Texture refactor
-Texture renamed to Texture2D
-TextureLayered as base now inherits 2Darray, cubemap and cubemap array
-Removed all references to flags in textures (they will go in the shader)
-Texture3D gone for now (will come back later done properly)
-Create base rasterizer for RenderDevice, RasterizerRD
2020-02-11 11:53:26 +01:00
Rémi Verschelde 8e674ea70c
Merge pull request #35701 from AlexHolly/fix-double_tap-pressed-regression
Fix double tap pressed event regression
2020-02-09 13:12:16 +01:00
Hugo Locurcio 2dd3a01d11
Remove per-file progress reporting when exporting to Android
Calling `step()` on EditorProgress too often will slow down the
rest of the editor, so it's best avoided. This is also more consistent
with other exporters, as most of them don't report per-file progress
either.

Exporting a 2D project with ~1,100 files to Android now takes
about 10 seconds from a debug editor build instead of 65 seconds.

This closes #30850.
2020-02-05 22:24:39 +01:00
Marcel Admiraal 5af3b4ca27 Remove duplicate ERR_PRINT macro. 2020-02-05 11:13:24 +01:00
PouleyKetchoupp 196860508a Fixed LineEdit virtual keyboard inputs on Android
Changed the condition to add a length filter to make it consistent with the documentation (0 means no character limit). Otherwise the default value in LineEdit causes the virtual keyboard to be non-fonctional on Android.
2020-01-31 16:24:09 +01:00
Alexander Holland d2a5b7367b Fix double tap pressed event regression 2020-01-29 16:24:40 +01:00
Rémi Verschelde 096bf873bc
Merge pull request #35632 from godotengine/revert-32854-fix-wireless-adb-debugging
Revert "Fix Android deploy with Remote Debug or Network FS over Wi-Fi"
2020-01-27 21:13:37 +01:00
Rémi Verschelde c317ac89bf
Revert "Fix Android deploy with Remote Debug or Network FS over Wi-Fi" 2020-01-27 19:59:24 +01:00
fhuya 9bd841b86d Address crash caused by missing dependency. 2020-01-27 10:45:25 -08:00
fhuya e41caac7db Address crash caused by missing dependency. 2020-01-27 10:26:01 -08:00
Mark Wynn Garcia 141230192c Check if can export before exporting; show error message if can't export. 2020-01-26 11:45:17 +08:00
Bruno Lourenço a3bcdbeb78 Android virtual keyboard respecting LineEdit max length. 2020-01-23 01:52:49 +00:00
Rémi Verschelde 837adb30fd Revert "Exposes capture methods to AudioServer + documentation" #30468
Reverts the following commits:

- c81ec6f26d:
  "Exposes capture methods to AudioServer, variable renames for
  consistency, added documentation."
- 47c558b98a:
  "Expose audio callbacks as signals."
- dabaa11b3c:
  "Fix to make sure the capture buffers are deallocated at shutdown.
  Silences warnings."

Some documentation improvements were kept for pre-existing methods.

See rationale for reverting these changes in #30468.
2020-01-20 13:18:01 +01:00