summaryrefslogtreecommitdiffstats
path: root/platform/javascript
Commit message (Collapse)AuthorAgeFilesLines
* Swtich HTML5 key detection from keyCode to code.Fabio Alessandrelli2020-06-042-394/+197
| | | | | | | The value of this, does not include the layout. The code has extra logic to map the unicode value to our keylist, supporting ASCII and Latin-1. Also add support for `physical_keycode` in HTML5 platform.
* Fix JS audioContext parameters.Fabio Alessandrelli2020-05-251-2/+2
| | | | | Were not passed along correctly. `latencyHint` is supposed to be in seconds, not milliseconds.
* Move mix_rate, ouput_latency to AudioDriverManagerFabio Alessandrelli2020-05-181-2/+2
| | | | | | | Each driver used to define the (same) project settings values `audio/mix_rate` and `audio/output_latency`, but the setting names are not driver specific. Overriding is still possible via platform tags.
* AudioDriverJavaScript now compute buffer size.Fabio Alessandrelli2020-05-182-15/+35
| | | | Based on mix rate and expected latency.
* Style: Enforce braces around if blocks and loopsRémi Verschelde2020-05-141-8/+14
| | | | | Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
* Style: Enforce separation line between function definitionsRémi Verschelde2020-05-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
* Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde2020-05-1412-144/+0
| | | | | | | | | | | | | | Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
* Style: Fix missing/invalid copyright headersRémi Verschelde2020-05-141-0/+30
|
* Port member initialization from constructor to declaration (C++11)Rémi Verschelde2020-05-142-17/+9
| | | | | | | | | | Using `clang-tidy`'s `modernize-use-default-member-init` check and manual review of the changes, and some extra manual changes that `clang-tidy` failed to do. Also went manually through all of `core` to find occurrences that `clang-tidy` couldn't handle, especially all initializations done in a constructor without using initializer lists.
* Update game controller enums.Marcel Admiraal2020-05-131-8/+1
|
* Add WebSocket debugger, use it for Javascript.Fabio Alessandrelli2020-05-122-4/+23
|
* Add drop files functionFabio Alessandrelli2020-05-104-2/+187
|
* Fix Closure compiler build, python style.Fabio Alessandrelli2020-05-109-44/+73
| | | | Move copyToFS into utils.js library included with '--pre-js'.
* DisplayServerJavaScript implementation.Fabio Alessandrelli2020-05-1010-1208/+1538
|
* [HTML5] Locale, input fix, context, exit.Fabio Alessandrelli2020-05-104-91/+112
| | | | | | | 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)
* Style: clang-format: Disable AllowShortCaseLabelsOnASingleLineRémi Verschelde2020-05-102-72/+149
| | | | Part of #33027.
* Merge pull request #37414 from Schroedi/fix_html_mouse_inputFabio Alessandrelli2020-05-011-1/+1
|\ | | | | Move wheel handlers from window to canvas element in HTML
| * Move mouse wheel handler from window to canvas element in HTMLChristoph Schröder2020-04-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Similar to https://github.com/godotengine/godot/pull/36557 At least in chrome, the following error is printed for each mouse wheel rotation: [Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. See https://www.chromestatus.com/features/6662647093133312 This PR moves the handler to the canvas and thereby fixes the error. Tested on: Chrome and Firefox (MacOS), Firefox, Chrome(Android), Safari (IPad + MacOS)
* | Rename InputFilter back to InputRémi Verschelde2020-04-281-1/+1
|/ | | | | | | | | | | | | | | | It changed name as part of the DisplayServer and input refactoring in #37317, with the rationale that input no longer goes through the main loop, so the previous Input singleton now only does filtering. But the gains in consistency are quite limited in the renaming, and it breaks compatibility for all scripts and tutorials that access the Input singleton via the scripting language. A temporary option was suggested to keep the scripting singleton named `Input` even if its type is `InputFilter`, but that adds inconsistency and breaks C#. Fixes godotengine/godot-proposals#639. Fixes #37319. Fixes #37690.
* Set the `title` tag in the HTML5 export immediatelyHugo Locurcio2020-04-221-0/+1
| | | | | This makes the project title display without having to wait for the project to finish loading.
* Replace NULL with nullptrlupoDharkael2020-04-027-24/+24
|
* SCons: Format buildsystem files with psf/blackRémi Verschelde2020-03-303-123/+122
| | | | | | | | | | | | | | | | | | | | | 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.
* Renaming of servers for coherency.Juan Linietsky2020-03-272-4/+4
| | | | | | | | | | VisualServer -> RenderingServer PhysicsServer -> PhysicsServer3D Physics2DServer -> PhysicsServer2D NavigationServer -> NavigationServer3D Navigation2DServer -> NavigationServer2D Also renamed corresponding files.
* Refactored input, goes all via windows now.Juan Linietsky2020-03-262-7/+7
| | | | Also renamed Input to InputFilter because all it does is filter events.
* 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.