1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

[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.
This commit is contained in:
Fabio Alessandrelli
2021-09-10 21:46:22 +02:00
parent e31a10da98
commit b7ac3c1aeb
7 changed files with 233 additions and 168 deletions

View File

@@ -710,15 +710,6 @@ const GodotDisplay = {
GodotRuntime.setHeapValue(p_height, GodotConfig.canvas.height, 'i32');
},
godot_js_display_compute_position: function (x, y, r_x, r_y) {
const canvas = GodotConfig.canvas;
const rect = canvas.getBoundingClientRect();
const rw = canvas.width / rect.width;
const rh = canvas.height / rect.height;
GodotRuntime.setHeapValue(r_x, (x - rect.x) * rw, 'i32');
GodotRuntime.setHeapValue(r_y, (y - rect.y) * rh, 'i32');
},
godot_js_display_has_webgl__sig: 'ii',
godot_js_display_has_webgl: function (p_version) {
if (p_version !== 1 && p_version !== 2) {