Commit graph

21 commits

Author SHA1 Message Date
Fabio Alessandrelli 7d6c1fdb32 [HTML5] Implement window blur in JS library.
Removes more emscripten HTML5 library dependencies.
2021-10-05 14:15:07 +02:00
Fabio Alessandrelli b6315afc9a [HTML5] Implement fullscreenchange in JS library.
Removes more emscripten HTML5 library dependencies.
2021-10-05 14:15:07 +02:00
Fabio Alessandrelli b2d30c725d [HTML5] Implement mouse/touch/key events in JS library.
This makes us more independent from emscripten libraries, giving us more
control on the application lifecycle.
2021-10-05 14:15:07 +02:00
Selgesel 5d1d9f23de Release pressed events when the window is blurred on HTML5 platform 2021-09-23 16:44:31 +03:00
bruvzg 618eb27e8b Move alert function from DisplayServer to OS. 2021-07-22 21:50:35 +03:00
Hendrik Brucker 38578a8095 Modernize Display server to use override keyword 2021-07-16 21:39:13 +02:00
Fabio Alessandrelli 3d8acc7a54 [HTML5] Fix build (with module_webxr_enabled=no).
The XR API changed a bit, and it's not just a rename, though probably an
easy update for someone who is qualified :).
2021-07-15 14:37:21 +02:00
Fabio Alessandrelli 3416f7b521 [HTML5] Opt-in virtual keyboard support.
Added as an export option "Experimental Virtual Keyboard".
There is no zoom, so text/line edit must be in the top part of the
screen, or it will get hidden by the virtual keyboard.
UTF8/Latin-1 only (I think regular UTF-8 should work out of the box in
4.0 but I can't test it).
It uses an hidden textarea or input, based on the multiline variable,
and only gets activated if the device has a touchscreen.
This could cause problems on devices with both touchscreen and a real
keyboard (although input should still work in general with some minor
focus issues). I'm thinking of a system to detect the first physical
keystroke and disable it in case, but it might do more harm then good,
so it must be well thought.
2021-03-11 23:08:08 +01:00
Fabio Alessandrelli 65abf94675 [HTML5] Better fullscreen, canvas resizing.
Three canvas resize policies:
- `None`: Godot window settings are ignored.
- `Project`: Godot handles the canvas like a native app (resizing it
  when setting the window size).
- `Adaptive`: Canvas size will always adapt to browser window size.

Use `None` if you want to control the canvas size with custom JavaScript
code.
2021-02-19 05:12:32 +01:00
Fabio Alessandrelli 6cff589b5b [HTML5] Detect screen scale and DPI.
`OS.get_screen_scale` will now return the `window.devicePixelRatio`
value, `OS.get_screen_dpi` uses CSS media queries to find approximate
DPI value for the current display.
`OS.get_screen_size` also return the actual screen size (not the CSS
pixel size).
2021-02-12 12:01:44 +01:00
Fabio Alessandrelli bab20c6e09 [HTML5] Custom Gamepad library to allow remapping.
No longer use emscripten functions for gamepads, implement them as
library functions in library_godot_display.js instead.
This allows us to do a better job at "guessing" vendorId, productId, OS,
etc. thus allowing us to better find the remapping for the controller.
2021-01-18 12:30:38 +01:00
Rémi Verschelde b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
Fabio Alessandrelli e2083871eb [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 11:42:51 +01:00
Fabio Alessandrelli 27ab97501b [HTML5] Add override keyword, cleanup methods. 2020-09-18 18:48:59 +02:00
Fabio Alessandrelli 0b286a287c Implement HTML5 cancel/ok button swap on Windows.
Platform is detected on init via the `navigator.platform` string.
2020-07-27 14:17:10 +02:00
Fabio Alessandrelli 07d4513886 [JS] Check canvas size each loop, force redraw.
Fix compatibility issues, achieve smoother resizing.
2020-07-01 17:16:13 +02:00
Fabio Alessandrelli a1c4c1d318 More static methods in DisplayServerJavaScript.
Were static functions in cpp file, polluting global namespace.
2020-07-01 17:16:03 +02:00
Fabio Alessandrelli fd92270b0a Refactor canvas ID and locale handling. 2020-07-01 13:10:05 +02:00
Rémi Verschelde 0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
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.
2020-05-14 16:54:55 +02:00
Fabio Alessandrelli 6a49b83e39 Add drop files function 2020-05-10 18:22:48 +02:00
Fabio Alessandrelli 7411e7fd37 DisplayServerJavaScript implementation. 2020-05-10 18:22:48 +02:00