summaryrefslogtreecommitdiffstats
path: root/platform/javascript
Commit message (Collapse)AuthorAgeFilesLines
* Refactored Input, create DisplayServer and DisplayServerX11Juan Linietsky2020-03-261-1/+1
|
* Adding missing include guards to header files identified by LGTM.Rajat Goswami2020-03-231-0/+5
| | | | This addresses the issue godotengine/godot#37143
* Style: Set clang-format Standard to Cpp11Rémi Verschelde2020-03-172-3/+3
| | | | | | | | | | 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`.
* [HTML5] Refactor JS, threads support, closures.Fabio Alessandrelli2020-03-1113-482/+567
| | | | | | | | | | - 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.
* AudioDriverJavascript uses IDHandler.Fabio Alessandrelli2020-03-112-40/+54
| | | | | This makes closure compiler happy, avoiding globals and potentially undefined variables.
* OS_Javascript temporarly uses dummy rasterizer.Fabio Alessandrelli2020-03-081-1/+5
|
* Fix Javascript platform after PoolVector removal.Fabio Alessandrelli2020-03-084-39/+20
| | | | Eval should be rechecked.
* Merge pull request #36557 from Schroedi/fix_html_touchFabio Alessandrelli2020-03-031-4/+4
|\ | | | | Fixes touch events for HTML
| * Fixes touch events for HTMLChristoph Schroeder2020-02-261-4/+4
| | | | | | | | | | | | | | | | | | | | | | Without this patch, the following exception is thrown when the touch screen is used: TypeError: e.getBoundingClientRect is not a function. No touch events arrive in the engine. From my testing, this PR fixes the issue and behaves as expected. Tested with godot-demo-projects/misc/multitouch_view/, emscripten 1.39.8 and Firefox mobile emulator as well as FF on Android
* | Merge pull request #18020 from bruvzg/input_fix_non_latin_and_add_hw_scancodesRémi Verschelde2020-03-012-4/+5
|\ \ | | | | | | Fix non-latin layout scancodes on Linux, adds access to physical scancodes.
| * | Rename `scancode` to `keycode`.bruvzg2020-02-252-4/+5
| | | | | | | | | | | | | | | Add `physical_keycode` (keyboard layout independent keycodes) to InputEventKey and InputMap. Fix non-latin keyboard layout keycodes on Linux/X11 (fallback to physical keycodes).
* | | Reimplement Mutex with C++'s <mutex>Pedro J. Estébanez2020-02-261-14/+13
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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`.
* | Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.Juan Linietsky2020-02-251-2/+2
|/ | | | | | | | | | | | | | | | | | | | | - 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.
* PoolVector is gone, replaced by VectorJuan Linietsky2020-02-183-34/+34
| | | | | Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are sugar for `Vector<Type>`.
* Remove incomplete battery status/power APIRémi Verschelde2020-02-142-22/+0
| | | | | | | | | | | 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.
* Remove obsolete GLES3 backendRémi Verschelde2020-02-132-43/+10
| | | | | | | | | | | | | | 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!
* Fix startGame's logic in engine.js.Relintai2020-02-121-4/+2
|
* Custom material support seems complete.Juan Linietsky2020-02-111-1/+1
|
* Texture refactorJuan Linietsky2020-02-113-6/+6
| | | | | | | | -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
* Allow per pixel transparency in javascript platformmuiroc2020-02-102-1/+24
|
* Merge pull request #35381 from Calinou/html5-export-faviconFabio Alessandrelli2020-02-081-15/+40
|\ | | | | Export and reference the icon as favicon when exporting to HTML5
| * Export and reference the icon as favicon when exporting to HTML5Hugo Locurcio2020-02-011-15/+40
| | | | | | | | | | | | This makes the project icon display immediately as a favicon when opening the page, without having to wait for the project to finish loading.
* | Fix javascript platform buildmuiroc2020-02-071-1/+1
| |
* | Remove duplicate ERR_PRINT macro.Marcel Admiraal2020-02-051-1/+1
| |
* | Merge pull request #35451 from Calinou/html5-web-environment-onlyRémi Verschelde2020-01-311-0/+5
|\ \ | | | | | | Only emit the JavaScript support code for Web when building for HTML5
| * | 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.
* | | Fix some URLs to use HTTPS when availableRémi Verschelde2020-01-292-3/+5
| | |
* | | Make `OS.execute()` blocking by default if not specifiedHugo Locurcio2020-01-231-1/+1
|/ / | | | | | | | | This makes `OS.execute()` calls quicker to set up when calling programs in a blocking fashion.
* / 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