Commit graph

572 commits

Author SHA1 Message Date
Fabio Alessandrelli c12fca57f4 [HTML5] Add option to focus canvas on start.
Enabled by default.
2021-06-25 19:07:17 +02:00
Haoyu Qiu 91477cd4a9 Strip query string when parsing HTTP request line for path 2021-06-25 00:20:28 +08:00
Fabio Alessandrelli b00c4a4360 [Net] Makes HTTPClient a custom instance class. 2021-06-23 14:10:45 +02:00
Fabio Alessandrelli 421e771012 [Net] Unify HTTPClient request and request_raw. 2021-06-23 13:53:43 +02:00
Aaron Franke 0ce49800ac
Use mouse and joypad enums instead of plain integers
Also MIDIMessage
2021-06-20 11:54:24 -04:00
Lightning_A e28fd07b2b Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
Marcel Admiraal 2bafcd3422 Consolidate JSON, JSONParseResults and JSONParser into JSON
Renames JSON.parse_string() to parse()
Renames JSON.decode_data() to stringify()
2021-06-19 08:01:40 +01:00
Fabio Alessandrelli ad5bdaf5aa [HTML5] JS callback functions now returns passed value.
JavaScript callbacks created via the `JavaScript.create_callback` method
used to always return void.

With this patch they return the value returned by the Godot function as
one would expect.
2021-06-18 17:47:48 +02:00
Rémi Verschelde 88e671e0b7
Merge pull request #49592 from Faless/js/4.x_fix_sigs
[HTML5] Fix build without eval, library functions signatures.
2021-06-15 00:01:54 +02:00
Fabio Alessandrelli a1cbb6daa6 [HTML5] Update eslint and jsdoc dependencies. 2021-06-14 13:42:03 +02:00
Fabio Alessandrelli 049b5159f1 [HTML5] Fix JS build without eval.
Also fix download_buffer return type.
2021-06-14 12:32:53 +02:00
Fabio Alessandrelli 9b7b0a28b9 [HTML5] Fix some JS library signature. 2021-06-14 12:32:32 +02:00
Pedro J. Estébanez 04688b92ff Rename Reference to RefCounted 2021-06-11 18:48:42 +02:00
Rémi Verschelde 9e328bb5b7
Core: Move DirAccess and FileAccess to core/io
File handling APIs are typically considered part of I/O, and we did have most
`FileAccess` implementations in `core/io` already.
2021-06-11 14:52:39 +02:00
Arthur Bikmullin ee2bea7a86
Fixed missed IDHandler dependency in GodotFetch 2021-06-08 00:20:24 +02:00
Aaron Franke 98aa3b669e
Add MOUSE_MODE_CONFINED_HIDDEN
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2021-06-03 11:44:28 -04:00
Fabio Alessandrelli 8cdef21d6c Move remaining dummy drivers to servers. 2021-06-01 16:50:32 +02:00
Fabio Alessandrelli 8594613f94 LinuxBSD now compiles without vulkan/x11. 2021-06-01 16:27:54 +02:00
reduz 0d2e02945b Implement shader caching
* Shader compilation is now cached. Subsequent loads take less than a millisecond.
* Improved game, editor and project manager startup time.
* Editor uses .godot/shader_cache to store shaders.
* Game uses user://shader_cache
* Project manager uses $config_dir/shader_cache
* Options to tweak shader caching in project settings.
* Editor path configuration moved from EditorSettings to new class, EditorPaths, so it can be available early on (before shaders are compiled).
* Reworked ShaderCompilerRD to ensure deterministic shader code creation (else shader may change and cache will be invalidated).
* Added shader compression with SMOLV: https://github.com/aras-p/smol-v
2021-05-31 10:13:09 +02:00
Marcel Admiraal da5d7db610 Rename File::get_len() get_length() 2021-05-25 11:54:28 +01:00
Hugo Locurcio 87f503310b
Tweak dozens of editor property hints for consistency
- Update Viewport MSAA property hints to match the currently
  exposed values.
- Add some performance hints to property hints.
2021-05-25 02:50:35 +02:00
Rémi Verschelde 2362a59a11
Merge pull request #48928 from Faless/js/4.x_fix_build_after_rename
[HTML5] Fix build after KEY_CTRL rename.
2021-05-21 18:33:15 +02:00
Fabio Alessandrelli 923131ec28 [HTML5] Fix build after KEY_CTRL rename. 2021-05-21 15:53:23 +02:00
Fabio Alessandrelli fdf66a21f1 [HTML5] Add easy to use download API.
New `JavaScript.download_buffer` method to create a prompt that let the
user download a file.
2021-05-21 15:31:23 +02:00
Rémi Verschelde aa5552278d
Merge pull request #48719 from Faless/js/4.x_interfaces
[HTML5] Implement Godot <-> JavaScript interface.
2021-05-20 17:13:02 +02:00
Fabio Alessandrelli 9811035ebf [HTML5] Implement Godot <-> JavaScript interface. 2021-05-20 14:33:18 +02:00
Rémi Verschelde 4219a4cb6f
Fix typos with codespell
Using codespell 2.0.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
GIRD
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2021-05-20 12:38:56 +02:00
Fabio Alessandrelli 14c057eab6 [HTML5] Fix GDNative compilation with emcc 2.0.19+
Add `WARN_ON_UNDEFINED_SYMBOLS=0` for the main module (which defines
`godot_js_main` as extern coming from the "side" module, i.e. the main
Godot binary).
2021-05-19 11:51:32 +02:00
Rémi Verschelde 6c367f8e0d
Merge pull request #48168 from LightningAA/control-to-ctrl-4.0 2021-05-17 17:38:02 +02:00
Pedro J. Estébanez 469fa47e06
Make all file access 64-bit (uint64_t)
This changes the types of a big number of variables.

General rules:
- Using `uint64_t` in general. We also considered `int64_t` but eventually
  settled on keeping it unsigned, which is also closer to what one would expect
  with `size_t`/`off_t`.
- We only keep `int64_t` for `seek_end` (takes a negative offset from the end)
  and for the `Variant` bindings, since `Variant::INT` is `int64_t`. This means
  we only need to guard against passing negative values in `core_bind.cpp`.
- Using `uint32_t` integers for concepts not needing such a huge range, like
  pages, blocks, etc.

In addition:
- Improve usage of integer types in some related places; namely, `DirAccess`,
  core binds.

Note:
- On Windows, `_ftelli64` reports invalid values when using 32-bit MinGW with
  version < 8.0. This was an upstream bug fixed in 8.0. It breaks support for
  big files on 32-bit Windows builds made with that toolchain. We might add a
  workaround.

Fixes #44363.
Fixes godotengine/godot-proposals#400.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2021-05-17 15:06:19 +02:00
Rémi Verschelde e743b6b24c
CI: Update JavaScript linter deps with known security vulnerabilities
jsdoc has no new release so I'm tracking this PR:
https://github.com/jsdoc/jsdoc/pull/1906
2021-05-12 10:32:38 +02:00
Fabio Alessandrelli 871d067aa9
Merge pull request #48543 from Faless/js/4.x_target_fps_fix
[HTML5] Fix target_fps when window loses focus.
2021-05-08 11:02:50 +02:00
Lightning_A 97fecd1b69 Rename "Control" key to "Ctrl" and add "_pressed" suffix to all InputEventWithModifiers properties/methods 2021-05-07 14:00:50 -06:00
Fabio Alessandrelli a1fe6d6899 [HTML5] Fix target_fps when window loses focus.
We don't get updates when the window is unfocused/minimized, so we must
detect the situation where the counted ticks start drifting away
resulting in more frames drawn than needed.
This commit adds a check to ensure that the target ticks do not drift
away more than one second.
2021-05-07 21:51:14 +02:00
Rémi Verschelde 35ec0e9be7
OS: Remove native video API only implemented on iOS
See discussion in #43811, it was only implemented on iOS and even that
implementation was fairly limited. This would best be provided as plugins
for Android and iOS without cluttering the shared OS API.
2021-05-07 20:40:24 +02:00
Fabio Alessandrelli 6243835619 [HTML5] Use 64KiB chunk size in JS HTTPClient.
For consistency with the native one, and the documentation.
2021-05-06 14:00:52 +02:00
Hugo Locurcio 3f078c99f6
Rename IP_Unix, IP_Address and TCP_Server to remove underscores 2021-05-06 02:52:01 +02:00
Aaron Franke 0de9a7d803
Rename doubleclick to double_click 2021-05-04 04:38:08 -04:00
Fabio Alessandrelli 8e2c237008 [HTML5] Fix builds with recent emscripten versions
Library suffix should be `.a`, the `EXTRA_` in
`EXTRA_EXPORTED_RUNTIME_METHODS` is deprecated.
2021-04-30 08:01:26 +02:00
Rémi Verschelde 5b16020846
Replace remaining uses of NULL with nullptr
Follow-up to #38736 (these uses were likely added after this PR was merged).
2021-04-29 11:53:27 +02:00
Rémi Verschelde 8247667a3e
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.
2021-04-27 16:26:27 +02:00
Fabio Alessandrelli 88c060b00d [HTML5] Export as Progressive Web App.
Adds possibility to export as a progressive web app.
Allows customizing base icons, display mode, orientation and offline
page.
2021-04-27 14:44:31 +02:00
Fabio Alessandrelli c9dcf2b37b [HTML5] HTTP server uses optional SSL.
Generates a key/cert snakeoil pair or use a custom SSL cert/key.
This is of course false security, and potentially detrimental for it.

But, so long, those are the requirements browser vendors agreed on to
use things like the Gamepad API, and more advanced topics like wasm
threads.

You don't need this if you run on localhost (at least!), but you do
need this (or a much safer nginx proxy) to try those things on your
local network (e.g. when debugging a phone, networking, etc).
2021-04-27 12:16:35 +02:00
Fabio Alessandrelli 5d095ed21d [HTML5] Optional icon generation, use export name for it.
We used to only generate the favicon if it was specified in the user
project settings, now it's optional, will export it to `NAME.icon.png`,
(falling back to the default project icon if none is set in project
settings), and the `<link>` tag is added using the `$HEAD_INCLUDE`
instead of being hardcoded in the template.
2021-04-27 11:50:11 +02:00
Fabio Alessandrelli b3971e1998 [HTML5] Debug HttpServer now runs in web cache subdir.
Serving all files in that folder and using a known list of mime types.
Makes it easy to add more exported files, while still playing safe.
2021-04-27 11:20:02 +02:00
bruvzg 7e557bbec6
[JS, Android] Re-add "no-exceptions" for export templates builds with ICU. 2021-04-20 21:50:48 +03:00
Fabio Alessandrelli 34fd48f68d [HTML5] Implement WebGL fallback.
According to project settings and when WebGL2 is not available.
This does nothing in current master, as we have no rendering yet!
2021-04-06 12:57:24 +02:00
Rémi Verschelde 9bbe51dc27
Style: Apply clang-tidy's modernize-use-nullptr 2021-04-05 14:05:07 +02:00
Fabio Alessandrelli 737ed0f66e [HTML5] Disable body_size in fetch.
We were using `Content-Length` from the server when `Content-Encoding`
was not set (i.e. response was not compressed).

Sadly, in CORS requests accessing headers is restricted, and while
`Content-Length` is enabled by default, `Content-Encoding` is not.

This results in the impossibility of knowing if the content was
compressed, unless the server explicitly enabled the encoding header
via `Access-Control-Expose-Headers`.

To keep maximum compatibility we must disable `body_size` completely.
2021-04-03 15:05:36 +02:00
Fabio Alessandrelli 01658adb30 [HTML5] Fix WM notifications not being called.
Regression from the library refactoring, binding and not calling is
pretty useless 'o_o.
2021-03-29 20:11:19 +02:00