summaryrefslogtreecommitdiff
path: root/platform/javascript/js/engine/engine.js
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2020-12-05 00:37:41 +0100
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2020-12-05 00:55:07 +0100
commit611c4998e8ffcc891d562f18428b5c8d9211751e (patch)
tree789e6802376674d9660c36a6c83266ae4ab1d092 /platform/javascript/js/engine/engine.js
parentca34b5e57a79d843bb5a57f13fb2f674e1d801e7 (diff)
[HTML5] EditorRunNative works with GDNative.
This "breaks" our loading bar logic (libraries are not counted). Fixing it is non trivial and probably deserves investigating a different strategy.
Diffstat (limited to 'platform/javascript/js/engine/engine.js')
-rw-r--r--platform/javascript/js/engine/engine.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/platform/javascript/js/engine/engine.js b/platform/javascript/js/engine/engine.js
index f0abdff640..4b8a7dde69 100644
--- a/platform/javascript/js/engine/engine.js
+++ b/platform/javascript/js/engine/engine.js
@@ -34,6 +34,7 @@ const Engine = (function () {
this.onExecute = null;
this.onExit = null;
this.persistentPaths = ['/userfs'];
+ this.gdnativeLibs = [];
}
Engine.prototype.init = /** @param {string=} basePath */ function (basePath) {
@@ -61,6 +62,7 @@ const Engine = (function () {
// Emscripten configuration.
config['thisProgram'] = me.executableName;
config['noExitRuntime'] = true;
+ config['dynamicLibraries'] = me.gdnativeLibs;
Godot(config).then(function (module) {
module['initFS'](me.persistentPaths).then(function (fs_err) {
me.rtenv = module;
@@ -249,6 +251,10 @@ const Engine = (function () {
this.persistentPaths = persistentPaths;
};
+ Engine.prototype.setGDNativeLibraries = function (gdnativeLibs) {
+ this.gdnativeLibs = gdnativeLibs;
+ };
+
Engine.prototype.requestQuit = function () {
if (this.rtenv) {
this.rtenv['request_quit']();
@@ -277,6 +283,7 @@ const Engine = (function () {
Engine.prototype['setOnExit'] = Engine.prototype.setOnExit;
Engine.prototype['copyToFS'] = Engine.prototype.copyToFS;
Engine.prototype['setPersistentPaths'] = Engine.prototype.setPersistentPaths;
+ Engine.prototype['setGDNativeLibraries'] = Engine.prototype.setGDNativeLibraries;
Engine.prototype['requestQuit'] = Engine.prototype.requestQuit;
return Engine;
}());