Commit graph

41 commits

Author SHA1 Message Date
Fabio Alessandrelli
276b831c45 [HTML5] Better editor HTML, small refactor.
Side and GDNative libraries are now added by engine.js , the dynlink pre
js had been deleted.
2021-01-25 20:16:44 +01:00
Fabio Alessandrelli
6988b21d00 [HTML5] Reorganize build script.
Simplify helper functions, fix env/sys_env confusion and depends for
externs and pre-js.
2021-01-10 12:34:03 +01:00
David Snopek
22cfa90ef5 Add support for WebXR 2021-01-04 17:01:42 -06:00
Fabio Alessandrelli
6936ac9d5d [HTML5] Add logo and favicon to editor html. 2020-12-09 18:09:30 +01:00
Fabio Alessandrelli
79a1418e7d [HTML5] Make GDNative support feature-based.
This is suboptimal as it requires adding an extra flag, but rewriting
how feature tags work is beyond the scope of this work.
2020-12-05 01:14:03 +01:00
Fabio Alessandrelli
4d1ebaad0f [HTML5] GDNative support via SIDE_MODULE.
Working, with emscripten > 2.0.9
Yes, the unreleased version. 2.0.9 works, but throws and error due to a
bug in emscripten with the thirdparty ENet library.
The issue is fixed upstream so newer releases will work.
2020-12-05 01:00:02 +01:00
Fabio Alessandrelli
e4cdae3624 [HTML5] Libraries refactor for linting.
Initial work to make liniting easier.

This includes:
- Rename http_request.js to library_godot_http_request.js.
- Rename externs.js to engine.externs.js.
- New library_godot_runtime.js (GodotRuntime) wraps around emscripten
  functions.
- Refactor of XMLHttpRequest handler in engine/preloader.js.
- Few fixes to bugs spotted by early stage linting.
2020-11-21 14:23:32 +01:00
Fabio Alessandrelli
6d939b72f0 [HTML5] AudioWorkletAPI implementation.
Rewrote AudioDriverJavaScript to support multiple processor nodes.
The old (and deprecated) ScriptProcessorNode when threads are not
available, and the new AudioWorklet API when threads are enabled.

The new implementation uses two ring buffers and a shared state to
communicated with the AudioWorklet thread.

The audio.worklet.js JavaScript file is always added to the export
template, but only really used (and download) in the thread build.
2020-11-10 11:05:15 +01:00
Fabio Alessandrelli
e52ed6d89e [HTML5] Port JavaScript inline code to libraries.
The API is implemented in javascript, and generates C functions that can
be called from godot.
This allows much cleaner code replacing all `EM_ASM` calls in our C++
code with plain C function calls.
This also gets rid of few hacks and comes with few optimizations (e.g.
custom cursor shapes should be much faster now).
2020-11-10 10:56:13 +01:00
Fabio Alessandrelli
55f04952c5 [HTML5] Add JavaScriptToolsEditorPlugin.
A new editor plugin, specific to HTML5, that provide some extra features
needed to make the editor usable on that platform.

For now, it adds a "Download project sources" option in the "Tool" menu,
so the user can download the work done as a zip file (from the browser
storage).
2020-10-14 11:20:20 +02:00
Fabio Alessandrelli
294e9752bd Add JavaScript editor html file. 2020-10-14 11:20:20 +02:00
Fabio Alessandrelli
61d4b8045c [HTML5] Run Audio process in thread when available
This should fix some of the audio stuttering issues when the HTML5
export is compiled with threads support.
The API should be ported to AudioWorklet to (hopefully) be perfect.
That though, cannot be backported to 3.2 due to extra restriction of
AudioWorklet (which only runs in SecureContext, and needs a polyfill for
Safari).
2020-10-02 16:25:19 +02:00
Rémi Verschelde
c8859f0463
Fix typos with codespell
Using codespell 1.17.1.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
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
```
2020-09-18 14:09:51 +02:00
Fabio Alessandrelli
21c9f37757 [HTML5] Refactor JS, threads support, closures.
- Refactored the Engine code, splitted across files.
- Use MODULARIZE option to build emscripten code into it's own closure.
- Optional closure compiler run for JS and generated code.
- Enable lto support (saves ~2MiB in release).
- Can now build with tools=yes (not much to see yet).
- Dropped some deprecated code for older toolchains.
- Add onExit, and onExecute JS function.
- Add files drag and drop support.
- Add support for low precessor usage mode (via offscreen render, swap).
2020-06-18 09:21:14 +02:00
Rémi Verschelde
7bf9787921 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.

(cherry picked from commit cd4e46ee65)
2020-06-10 15:30:52 +02:00
Fabio Alessandrelli
6a1bf006a3 Move IDHandler JS module to platform from Websock 2019-04-12 12:41:49 +02:00
Leon Krause
86d9e67d7a Add responsive HTML5 export page with full-size canvas as new default 2018-08-23 21:28:09 +02:00
Leon Krause
504ffda8d7 Small refactoring in HTML5 build scripts
Drop logic for non-existent 'profile' target
2018-05-14 15:30:27 +02:00
Leon Krause
d8d9eea722 Refactor JavaScript platform build script 2018-03-26 19:46:56 +02:00
Leon Krause
bd1750c076 Wrap Emscripten module into JS Engine singleton per SCons
Emscripten's meta DCE changes in 1.37.27(/28?) make it impossible to
keep using --pre-js for this
2018-01-13 19:40:59 +01:00
Rhody Lugo
a65c0939fd disable caching for targets using helper functions 2017-11-28 23:24:12 -04:00
Leon Krause
ddf21ca016 Remove asm.js support from HTML5 platform
Since WebGL 2.0 is required, requiring WebAssembly support as well has
little impact on compatibility.
2017-11-18 05:52:14 +01:00
Leon Krause
2970061a73 Implement HTTPClient in HTML5 platform
Limitations:

 - Subject to same-origin policy
 - No persistent connection (but simulated for compatibility)
 - No blocking mode
 - No StreamPeer access
 - No chunked responses
 - Cannot disable host verification
2017-11-13 00:58:29 +01:00
Leon Krause
1a5d3c26db Fix WebAudio and HTML5 build 2017-11-06 00:25:57 +01:00
Elliott Sales de Andrade
3e69d19116 Use BoolVariable in platform-specific options. 2017-09-25 14:36:30 -04:00
Leon Krause
4db801aaea HTML5 start-up overhaul
- Implement promise-based JS interface for custom HTML page
   integration
 - Add download progress callback
 - Add progress bar and indeterminate spinner to default HTML page
 - Try downloading files multiple times when failing
 - Get rid of godotfs.js
 - Separate steps for engine initialization, game initialization and game
   start
 - Allow multiple games on one HTML page
 - Substitution placeholders only used in .html file
 - Placeholders renamed: $GODOT_BASE => $GODOT_BASENAME,
   $GODOT_TMEM -> $GODOT_TOTAL_MEMORY
 - Emscripten Module is now Engine.RuntimeEnvironment (no longer a global)
2017-09-11 20:56:29 +02:00
L. Krause
ca28c068c0 Implement input focus behavior in HTML5
- Key and mouse events are only consumed if canvas is focused
 - NOTIFICATION_WM_MOUSE_ENTER, _MOUSE_EXIT, _FOCUS_IN and _FOCUS_OUT are
   emitted
2017-07-22 17:25:15 +02:00
L. Krause
69e0dee983 Fix zipping HTML5 templates when using implicit cache 2017-07-17 03:53:31 +02:00
eska
1abf478eb9 Fix web export build 2017-03-10 05:09:54 +01:00
eska
6e1828c958 Fix WebAssembly builds on Windows 2017-02-21 23:21:28 +01:00
eska
6e2bf31e5a Automatically zip web export templates
Also fix web builds on Windows and clean up
2017-02-20 06:59:19 +01:00
eska
68422c5dd6 Relink web build when HTML shell changes
Emscripten injects its loader script when linking, so force relinking
whenever the HTML shell changes.

Also remove useless FULL_ES2 flag, which should be a linker flag, but
would impact performance too much.
2017-01-12 01:05:07 +01:00
Rémi Verschelde
d4c17700aa style: Fix PEP8 whitespace issues in Python files
Done with `autopep8 --select=E2,W2`, fixes:

- E201 - Remove extraneous whitespace.
- E202 - Remove extraneous whitespace.
- E203 - Remove extraneous whitespace.
- E211 - Remove extraneous whitespace.
- E221 - Fix extraneous whitespace around keywords.
- E222 - Fix extraneous whitespace around keywords.
- E223 - Fix extraneous whitespace around keywords.
- E224 - Remove extraneous whitespace around operator.
- E225 - Fix missing whitespace around operator.
- E226 - Fix missing whitespace around operator.
- E227 - Fix missing whitespace around operator.
- E228 - Fix missing whitespace around operator.
- E231 - Add missing whitespace.
- E231 - Fix various deprecated code (via lib2to3).
- E241 - Fix extraneous whitespace around keywords.
- E242 - Remove extraneous whitespace around operator.
- E251 - Remove whitespace around parameter '=' sign.
- E261 - Fix spacing after comment hash.
- E262 - Fix spacing after comment hash.
- E265 - Format block comments.
- E271 - Fix extraneous whitespace around keywords.
- E272 - Fix extraneous whitespace around keywords.
- E273 - Fix extraneous whitespace around keywords.
- E274 - Fix extraneous whitespace around keywords.
- W291 - Remove trailing whitespace.
- W293 - Remove trailing whitespace.
2016-11-01 00:35:16 +01:00
Rémi Verschelde
97c8508f5e style: Start applying PEP8 to Python files, indentation issues
Done with `autopep8 --select=E1`, fixes:

- E101 - Reindent all lines.
- E112 - Fix under-indented comments.
- E113 - Fix over-indented comments.
- E115 - Fix under-indented comments.
- E116 - Fix over-indented comments.
- E121 - Fix a badly indented line.
- E122 - Fix a badly indented line.
- E123 - Fix a badly indented line.
- E124 - Fix a badly indented line.
- E125 - Fix indentation undistinguish from the next logical line.
- E126 - Fix a badly indented line.
- E127 - Fix a badly indented line.
- E128 - Fix a badly indented line.
- E129 - Fix a badly indented line.
2016-11-01 00:33:51 +01:00
eska
d6f2862429 Add option 'wasm' to compile to WebAssembly in web export
WebAssembly is still experimental, so disabled by default.

The HTML shell file now uses $GODOT_BASE, a placeholder for the
base filename, instead of $GODOT_JS, $GODOT_MEM and $GODOT_FS.
2016-10-31 01:28:01 +01:00
Rémi Verschelde
fc8ccd5b8c SCsub: Add python shebang as a hint for syntax highlighting
Also switch existing shebangs to "better" /usr/bin/env python.
2016-10-17 20:10:46 +02:00
eska
913361928f Add JavaScript eval interface 2016-06-30 15:45:40 +02:00
Juan Linietsky
a88f67821c HTML5 exporter seems to be fully functional
-user:// filesystem implemented
-default template page could look prettier, help appreciated
2015-09-12 10:54:47 -03:00
Juan Linietsky
0fb7b5aa0c HTML5 exporter Improvements
-Better template handling
-Voice support
-Stream support
2015-09-10 00:10:54 -03:00
Juan Linietsky
0fa94a9690 Build System Changes
-=-=-=-=-=-=-=-=-=-=

Build System:
-Big clean up of SCons, changed how builds are done to a much cleaner method (check the Github Wiki for instructions).
-Deactivated BlackBerry10 (sorry), if no mantainer found (or BlackBerry does not send us a Passort ;), platform will be removed as we have no longer devices to test.

Engine:
-Removed deprecated object and scene format (was in there just for compatibility, not in use since a long time).
-Added ability to open scenes even if a node type was removed (will try to guess the closest type).
-Removed deprecated node types.
2014-10-07 01:31:49 -03:00
Juan Linietsky
0b806ee0fc GODOT IS OPEN SOURCE 2014-02-09 22:10:30 -03:00