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

[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).
This commit is contained in:
Fabio Alessandrelli
2020-10-23 18:33:20 +02:00
parent 54cda5c3b8
commit e2083871eb
33 changed files with 1995 additions and 1461 deletions

View File

@@ -42,13 +42,14 @@ class OS_JavaScript : public OS_Unix {
MainLoop *main_loop = nullptr;
AudioDriverJavaScript *audio_driver_javascript = nullptr;
bool finalizing = false;
bool idb_is_syncing = false;
bool idb_available = false;
bool idb_needs_sync = false;
static void main_loop_callback();
static void file_access_close_callback(const String &p_file, int p_flags);
static void fs_sync_callback();
protected:
void initialize() override;
@@ -61,15 +62,12 @@ protected:
bool _check_internal_feature_support(const String &p_feature) override;
public:
bool idb_is_syncing = false;
// Override return type to make writing static callbacks less tedious.
static OS_JavaScript *get_singleton();
void initialize_joypads() override;
MainLoop *get_main_loop() const override;
void finalize_async();
bool main_loop_iterate();
Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking = true, ProcessID *r_child_id = nullptr, String *r_pipe = nullptr, int *r_exitcode = nullptr, bool read_stderr = false, Mutex *p_pipe_mutex = nullptr) override;
@@ -88,11 +86,9 @@ public:
String get_data_path() const override;
String get_user_data_dir() const override;
void set_idb_available(bool p_idb_available);
bool is_userfs_persistent() const override;
void resume_audio();
bool is_finalizing() { return finalizing; }
OS_JavaScript();
};