summaryrefslogtreecommitdiffstats
path: root/platform/javascript
Commit message (Collapse)AuthorAgeFilesLines
* Only emit the JavaScript support code for Web when building for HTML5Hugo Locurcio2020-01-311-0/+5
| | | | | Excluding other unused environments like Node.js makes the support code about 4 KB smaller.
* Revert "Fix audio capture naming in Javascript"Rémi Verschelde2020-01-201-2/+4
| | | | | | This reverts commit 69f7263cd8990b39e4c1cc678b2d0f57686b07b7. Follow-up to #35359.
* HTML5 callbacks rework.Fabio Alessandrelli2020-01-171-31/+37
| | | | | | | | | | | | | | Fixes compatibility with emscripten 1.39.5+ . Most input callbacks now require a target and no longer support NULL defaults. This commit changes all required null targets to the expected default in the binding phase. Since for canvas-related callbacks there is no default, the "#canvas" selector is used instead. Additionally, since canvasX and canvasY event properties are no longer supported, event positions are computed from "clientX" and "clientY" and the "#canvas" bounding client rect.
* HTML5: Address removal of 'timestamp' in Emscripten 1.39.5Rémi Verschelde2020-01-172-2/+3
| | | | | | | | | | | | | | | It was removed as noted in the changelog: https://github.com/emscripten-core/emscripten/blob/1.39.5/ChangeLog.md#v1395-12202019 > Removed `timestamp` field from mouse, wheel, devicemotion and > deviceorientation events. The presence of a `timestamp` on these > events was slightly arbitrary, and populating this field caused > a small profileable overhead that all users might not care about. > It is easy to get a timestamp of an event by calling > `emscripten_get_now()` or `emscripten_performance_now()` inside > the event handler function of any event. Fixes #34648.
* Properly close files served by debug HTTP server.Fabio Alessandrelli2020-01-141-2/+9
|
* Add mime type to responses from debug HTTP server.Fabio Alessandrelli2020-01-141-0/+7
| | | | | Get rid of warnings in firefox mentioning performance loss when no mime type is given for wasm files.
* Export: Improve usability of command line interfaceRémi Verschelde2020-01-071-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm barely scratching the surface of the changes needed to make the --export command line interface easy to use, but this should already improve things somewhat. - Streamline `can_export()` templates check in all platforms, checking first for the presence of official templates, then of any defined custom template, and reporting on the absence of any. Shouldn't change the actual return value much which is still true if either release or debug is usable - we might want to change that eventually and better validate against the requested target. - Fix discrepancy between platforms using `custom_package/debug` and `custom_template/debug` (resp. `release`). All now use `custom_template`, which will break compatibility for `export_presets.cfg` with earlier projects (but is easy to fix). - Use `can_export()` when attempting a command line export and report the same errors that would be shown in the editor. - Improve error reporting after a failed export attempt, handling missing template and invalid path more gracefully. - Cleanup of unused stuff in EditorNode around the export workflow. - Improve --export documentation in --help a bit. Fixes #16949 (at least many of the misunderstandings listed there). Fixes #18470.
* Update copyright statements to 2020Rémi Verschelde2020-01-0117-33/+33
| | | | | | | | | | | Happy new year to the wonderful Godot community! We're starting a new decade with a well-established, non-profit, free and open source game engine, and tons of further improvements in the pipeline from hundreds of contributors. Godot will keep getting better, and we're looking forward to all the games that the community will keep developing and releasing with it.
* Emscripten: Re-add BINARYEN_TRAP_MODE='clamp' for fastcompRémi Verschelde2019-12-031-0/+7
| | | | | | | | The option is needed when using the 'fastcomp' backend (default before 1.39.0), and must not be defined when using 'upstream' (new default). So we define it conditionally to support both backends. Follow-up to #30751.
* iOS modular build and export implementation.bruvzg2019-12-012-6/+0
|
* Add download_chunk_size property to HTTPRequest.Fabio Alessandrelli2019-11-241-0/+4
| | | | | | This allows setting the `read_chunk_size` of the internal HTTPClient. This is important to reduce the allocation overhead and number of file writes when downloading large files, allowing for better download speed.
* pcre2: Use scons option to disable JIT on some platformsRémi Verschelde2019-11-201-0/+1
| | | | | | | | Third-party platforms (e.g. console ports) need to be able to disable JIT support in the regex module too, so it can't be hardcoded in the module SCsub. This is cleaner this way anyway. Fixes #19316.
* HTML5: Explicitly link idbfs.js for IDBFS supportRémi Verschelde2019-11-191-0/+4
| | | | | | | | | | Upstream Emscripten changed this in 1.39.1+, so IDBFS is no longer included by default and has to be linked manually. The explicit linking doesn't seem to be problematic on earlier versions (tested `1.38.47-upstream`). Fixes #33724.
* HTML5: Fix support for Emscripten 1.39.1+Rémi Verschelde2019-11-151-4/+1
| | | | | | | | | | | | | | | | | | | | | A change in upstream Emscripten 1.39.1+ made our buildsystem error out where it was previously only issuing a warning: ``` [ 5%] Linking Static Library ==> main/libmain.javascript.opt.bc shared:WARNING: Assuming object file output in the absence of `-c`, based on output filename. Please add with `-c` or `-r` to avoid this warning Ranlib Library ==> main/libmain.javascript.opt.bc /opt/emsdk/upstream/bin/llvm-ranlib: error: unable to load 'main/libmain.javascript.opt.bc': file too small to be an archive ``` As advised on emscripten-core/emscripten#9806, we should be using `emar` here to create the static library and not `emcc`. This was apparently done to workaround Emscripten issues in the past, but evidently this is no longer necessary. The rest of the `env` redefinitions should probably be re-assessed against the current state of Emscripten. Fixes #33374.
* Remove ECMAScript 6 "arrow operator".Fabio Alessandrelli2019-10-241-1/+1
| | | | | We don't need it, it's not well supported by compilers, and it was a mistake in the first place.
* Implement HTTP server for HTML5 exportFabio Alessandrelli2019-10-231-8/+220
| | | | | | | | Since most browsers no longer allow making async requests from a page loaded from `file://`, we now need a proper HTTP server to load the exported HTML5 game. This should also allow us to get the debugger to work over a WebSocket connection.
* Improve EditorExportPlatform interface.Fabio Alessandrelli2019-10-231-8/+8
| | | | | Convert all get_device* methods to get_option* and normalize their usage as icon, label, tooltip.
* Optimize images losslessly using `oxipng -o6 --strip all --zopfli`Hugo Locurcio2019-10-121-0/+0
|
* Remove dependency on the editor directory being in the build's include path.Marcel Admiraal2019-10-101-1/+1
| | | | | | | - Add or remove the necessary subdirectorires to the includes to remove dependency on the editor directory being in the build's include path. - Ensure includes in modified files conform to style guideline. - Remove editor from the build include path.
* Properly revert cursor when using set_custom_mouse_cursor with nullPouleyKetchoupp2019-10-031-0/+2
| | | | Fixes #32486
* Fixed running the export templates with newer emscripten versions.Relintai2019-10-011-8/+5
|
* Added some obvious errors explanationsqarmin2019-09-251-1/+1
|
* https://github.com/godotengine/godot/issues/31297 - HTML5: ↵mellondill2019-08-121-0/+3
| | | | | | this.rtenv.callMain is not a function when using latest-upstream backend Added needed changed for normal compiling with emscripten 1.38.41 and later
* Export: Remove temp files from cache after exportRémi Verschelde2019-08-121-2/+11
| | | | | | | | | So far we left most temporary files lying around, so this attempts to fix that. I added a helper method to DirAccess to factor out the boilerplate of creating a DirAccess, checking if the file exists, remove it or print an error on failure.
* Fix audio capture naming in JavascriptSaracen2019-08-091-4/+2
|
* Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in "platform", ↵Robin Hübner2019-08-092-26/+14
| | | | "modules/gdnative", "modules/gdscript" directories.
* Emscripten: Do not define BINARYEN_TRAP_MODE='clamp'Rémi Verschelde2019-07-221-1/+0
| | | | | | | | It is not supported in Emscripten's `latest-upstream` LLVM backend, and doesn't seem necessary in the `latest` backend either. It was initially added in #22857 to solve a compilation error with the latter. Part of #30270.
* Merge pull request #30465 from guilhermefelipecgs/cursor_blinkingRémi Verschelde2019-07-102-0/+18
|\ | | | | Fix cursor blinking in integrated GPUs
| * Fix cursor blinking in integrated GPUsGuilherme Felipe2019-07-092-0/+18
| | | | | | | | | | Optimization for Input::set_custom_mouse_cursor when used inside _process function. (Avoids cursor blinking in low end devices)
* | Better detect Emscripten toolchain.Fabio Alessandrelli2019-07-091-2/+7
|/ | | | | | | | | | | | | | | | | Emscripten is apparently changing the variables in its config file, causing potential breakage of our build system. Binaries of the latest/latest-upstream releases are located in a subfolder of BINARYEN_ROOT called emscripten. Binaries of the other releases (e.g. sdk-1.38.31-64bit) are instead placed under the EMSCRIPTEN_ROOT folder. This PR checks if BINARYEN_ROOT has a subfolder called emscripten, if that does not exists, it falls back to checking the EMSCRIPTEN_ROOT. This way we give precedence to the new releases, given that activating multiple releases sequentially might result in having mismatching BINARYEN_ROOT and EMSCRIPTEN_ROOT.
* Merge pull request #29482 from Calinou/html5-fix-emscripten-rootRémi Verschelde2019-07-011-3/+3
|\ | | | | Fix Emscripten root directory detection when building for HTML5
| * Fix Emscripten root directory detection when building for HTML5Hugo Locurcio2019-06-191-3/+3
| | | | | | | | | | | | Recent Emscripten SDK versions seem to only include the `BINARYEN_ROOT` variable in the Emscripten configuration file, whereas the platform's `detect.py` only looked at `EMSCRIPTEN_ROOT`.
* | Made use of semicolons more consitent, fixed formattingJohnJLight2019-06-191-1/+1
| |
* | Add script to fix style issues and copyright headersRémi Verschelde2019-06-171-1/+1
| | | | | | | | | | This is only meant to check the validity of the whole codebase every now and then, or to apply clang-format config changes when relevant.
* | Merge pull request #10643 from BastiaanOlij/camera_serverRémi Verschelde2019-06-162-0/+6
|\ \ | | | | | | CameraServer class
| * | Adding a new Camera Server implementation to Godot.BastiaanOlij2019-06-152-0/+6
| | | | | | | | | | | | | | | | | | This is a new singleton where camera sources such as webcams or cameras on a mobile phone can register themselves with the Server. Other parts of Godot can interact with this to obtain images from the camera as textures. This work includes additions to the Visual Server to use this functionality to present the camera image in the background. This is specifically targetted at AR applications.
* | | Merge pull request #29786 from dotdigitalgroup/hidpi-javascript-fix-masterRémi Verschelde2019-06-151-4/+18
|\ \ \ | | | | | | | | Fix pointer position in hidpi-corrected resolutions on web
| * | | Fix pointer position in hidpi-corrected resolutions on webLeonardo Giovanni Scur2019-06-141-4/+18
| |/ /
* / / Fix compilation warnings in JS and Windows buildsRémi Verschelde2019-06-151-1/+1
|/ / | | | | | | | | | | | | | | | | | | Warnings raised by Emscripten 1.38.0 and MinGW64 5.0.4 / GCC 8.3.0. JS can now build with `werror=yes warnings=extra`. MinGW64 still has a few warnings to resolve with `warnings=extra`, and only one with `warnings=all`. Part of #29033 and #29801.
* / Fix error macro calls not ending with semicolonRémi Verschelde2019-06-111-1/+1
|/ | | | | | | It's not necessary, but the vast majority of calls of error macros do have an ending semicolon, so it's best to be consistent. Most WARN_DEPRECATED calls did *not* have a semicolon, but there's no reason for them to be treated differently.
* Implement Clipboard API read when supported.Fabio Alessandrelli2019-05-292-0/+18
| | | | | | | Being async, the first time a value is pasted GUI elements will still return the previous one. This at least until 'clipboardchange' window event gets implemented by user agents.
* Kinda working HTML5 clipboard paste.Fabio Alessandrelli2019-05-291-0/+10
| | | | | | | | | | | | | | | | Listen to paste events to update local clipboard. CTRL+V still not working out of the box. To do that, We would need to change how we handle keypress, most likely making it worse and less safe. In the end, I'm not sure we can fix it properly for now. Maybe in the future, with the Clipboard API, support of which is still pretty limited on chrome, and only available to extensions in Firefox. For now, you can paste via: - Browser bar -> Edit -> Paste. - Middle mouse click (Linux only, copies secondary clipboard). And THEN press CTRL+V
* Add OS clipboard set support to OS JavascriptFabio Alessandrelli2019-05-282-0/+21
|
* Merge pull request #29032 from akien-mga/tools-exceptions-rttiRémi Verschelde2019-05-211-4/+6
|\ | | | | SCons: Keep exceptions and rtti on Android, iOS and HTML5 tools build
| * SCons: Keep exceptions and rtti on Android, iOS and HTML5 tools buildRémi Verschelde2019-05-201-4/+6
| | | | | | | | | | | | | | | | | | | | Those were disable to keep size small, and on Android avoid the dependency on the STL, but for tools build (editor) this is not really a concern. Note: as of today it's not possible to build tools=yes for those platforms, but this change is one of the necessary steps to enable it. Fixes #25262.
* | added a const keyword for a methods that return constant literal...hbina0852019-05-212-2/+2
|/
* Fix OS_Javascript execute methodFabio Alessandrelli2019-05-152-2/+2
| | | | | | Signature was changed in OS via: cd4449e7abe97b2bc883e2d182db2cc41eb35f8c
* SCons: Always use env.Prepend for CPPPATHRémi Verschelde2019-04-301-1/+1
| | | | | | Include paths are processed from left to right, so we use Prepend to ensure that paths to bundled thirdparty files will have precedence over system paths (e.g. `/usr/include` should have lowest priority).
* Move IDHandler JS module to platform from WebsockFabio Alessandrelli2019-04-122-0/+69
|
* Remove unused importsHendrikto2019-04-061-1/+0
|