summaryrefslogtreecommitdiff
path: root/platform/javascript/SCsub
AgeCommit message (Collapse)Author
2021-11-26[HTML5] Use absolute path for JS lib/pre/externs.Fabio Alessandrelli
Ensure better compatibility when emcc which may run some tools from different paths (e.g. closure compiler). This fixes externs include issues with modern emcc using the closure compiler.
2021-10-05[HTML5] Implement mouse/touch/key events in JS library.Fabio Alessandrelli
This makes us more independent from emscripten libraries, giving us more control on the application lifecycle.
2021-05-21[HTML5] Add easy to use download API.Fabio Alessandrelli
New `JavaScript.download_buffer` method to create a prompt that let the user download a file.
2021-05-20Merge pull request #48719 from Faless/js/4.x_interfacesRémi Verschelde
[HTML5] Implement Godot <-> JavaScript interface.
2021-05-20[HTML5] Implement Godot <-> JavaScript interface.Fabio Alessandrelli
2021-05-19[HTML5] Fix GDNative compilation with emcc 2.0.19+Fabio Alessandrelli
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-03-08[HTML5] Add PWA support to the editor page.Fabio Alessandrelli
This allows to install it as an app, and provide offline support (after the first run). Practically, this boils down to adding a JSON file as a manifest, an offline page to be displayed when the cached files are not avaialble, and a JS file to cache resources and return them. The reason for the "first run requirements" is that some browsers, will emit an "install" by just visiting the page (to see if the JS code is compatibile), and we do not want to force casual visitors to just download the 10 MiB+ compressed editor WebAssembly file without pressing the start button. Special thanks to Hugo Locurcio (Calinou) for the initial work.
2021-03-06[HTML5] Replace XMLHttpRequest with Fetch.Fabio Alessandrelli
This has some advantages: - Streaming/chunked response support. - Broader headers support.
2021-02-26Merge pull request #46446 from Faless/js/4.x_jsdocRémi Verschelde
[HTML5] Document Engine and EngineConfig (jsdoc).
2021-02-26[HTML5] Make editor HTML build tag scons4-proof.Fabio Alessandrelli
We used to have it like `$GODOT_VERSION` which caused inconsistencies between different scons versions when substituting it. It's now `@GODOT_VERSION@`, which is safe on both scons3 and scons4.
2021-02-26[HTML5] Document Engine and EngineConfig (jsdoc).Fabio Alessandrelli
This commit also removes the utils.js engine file, moving some of it's content to config.js and some to engine.js .
2021-02-19[HTML5] Easier HTML templates, better deinit/cleanup.Fabio Alessandrelli
2021-01-25[HTML5] Better editor HTML, small refactor.Fabio Alessandrelli
Side and GDNative libraries are now added by engine.js , the dynlink pre js had been deleted.
2021-01-10[HTML5] Reorganize build script.Fabio Alessandrelli
Simplify helper functions, fix env/sys_env confusion and depends for externs and pre-js.
2021-01-04Add support for WebXRDavid Snopek
2020-12-09[HTML5] Add logo and favicon to editor html.Fabio Alessandrelli
2020-12-05[HTML5] Make GDNative support feature-based.Fabio Alessandrelli
This is suboptimal as it requires adding an extra compile flag, but rewriting how feature tags work is beyond the scope of this work.
2020-12-05[HTML5] GDNative support via SIDE_MODULE.Fabio Alessandrelli
Working with emscripten >= 2.0.10
2020-11-21[HTML5] Libraries refactor for linting.Fabio Alessandrelli
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-10[HTML5] AudioWorklet API implementation.Fabio Alessandrelli
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 downloaded) in the thread build.
2020-11-10[HTML5] Port JavaScript inline code to libraries.Fabio Alessandrelli
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-10-14[HTML5] Add JavaScriptToolsEditorPlugin.Fabio Alessandrelli
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-14Add JavaScript editor html file.Fabio Alessandrelli
2020-10-02[HTML5] Run Audio process in thread when availableFabio Alessandrelli
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-09-18Fix typos with codespellRémi Verschelde
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-05-10Fix Closure compiler build, python style.Fabio Alessandrelli
Move copyToFS into utils.js library included with '--pre-js'.
2020-05-10DisplayServerJavaScript implementation.Fabio Alessandrelli
2020-05-10[HTML5] Locale, input fix, context, exit.Fabio Alessandrelli
Add missing semicolumns in engine.js Add optional extra args to JS Engine.startGame Remove loader.js, explicit noExitRuntime. Also add onExit callback (undocumented in emscripten)
2020-03-30SCons: Format buildsystem files with psf/blackRémi Verschelde
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-11[HTML5] Refactor JS, threads support, closures.Fabio Alessandrelli
- Refactored the Engine code, splitted across files. - Use MODULARIZE option to build emscripten code into it's own closure. - Enable lto support (saves ~2MiB in release). - Enable optional closure compiler pass for JS and generated code. - Enable optional pthreads support. - Can now build with tools=yes (not much to see yet). - Dropped some deprecated code for older toolchains.
2019-04-12Move IDHandler JS module to platform from WebsockFabio Alessandrelli
2018-08-23Add responsive HTML5 export page with full-size canvas as new defaultLeon Krause
2018-05-14Small refactoring in HTML5 build scriptsLeon Krause
Drop logic for non-existent 'profile' target
2018-03-26Refactor JavaScript platform build scriptLeon Krause
2018-01-13Wrap Emscripten module into JS Engine singleton per SConsLeon Krause
Emscripten's meta DCE changes in 1.37.27(/28?) make it impossible to keep using --pre-js for this
2017-11-28disable caching for targets using helper functionsRhody Lugo
2017-11-18Remove asm.js support from HTML5 platformLeon Krause
Since WebGL 2.0 is required, requiring WebAssembly support as well has little impact on compatibility.
2017-11-13Implement HTTPClient in HTML5 platformLeon Krause
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-06Fix WebAudio and HTML5 buildLeon Krause
2017-09-25Use BoolVariable in platform-specific options.Elliott Sales de Andrade
2017-09-11HTML5 start-up overhaulLeon Krause
- 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-07-22Implement input focus behavior in HTML5L. Krause
- 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-17Fix zipping HTML5 templates when using implicit cacheL. Krause
2017-03-10Fix web export buildeska
2017-02-21Fix WebAssembly builds on Windowseska
2017-02-20Automatically zip web export templateseska
Also fix web builds on Windows and clean up
2017-01-12Relink web build when HTML shell changeseska
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.
2016-11-01style: Fix PEP8 whitespace issues in Python filesRémi Verschelde
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-01style: Start applying PEP8 to Python files, indentation issuesRémi Verschelde
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-10-31Add option 'wasm' to compile to WebAssembly in web exporteska
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.