mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 08:23:29 +00:00
Move request_quit to javascript_main.
This commit is contained in:
parent
c8859f0463
commit
c610ad3739
2 changed files with 13 additions and 6 deletions
|
@ -50,6 +50,12 @@ extern "C" EMSCRIPTEN_KEEPALIVE void _drop_files_callback(char *p_filev[], int p
|
|||
os->get_main_loop()->drop_files(files);
|
||||
}
|
||||
|
||||
extern "C" EMSCRIPTEN_KEEPALIVE void _request_quit_callback(char *p_filev[], int p_filec) {
|
||||
if (os && os->get_main_loop()) {
|
||||
os->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
void exit_callback() {
|
||||
emscripten_cancel_main_loop(); // After this, we can exit!
|
||||
Main::cleanup();
|
||||
|
@ -132,6 +138,12 @@ extern "C" EMSCRIPTEN_KEEPALIVE void main_after_fs_sync(char *p_idbfs_err) {
|
|||
ResourceLoader::set_abort_on_missing_resources(false);
|
||||
Main::start();
|
||||
os->get_main_loop()->init();
|
||||
// Expose method for requesting quit.
|
||||
EM_ASM({
|
||||
Module['request_quit'] = function() {
|
||||
ccall("_request_quit_callback", null, []);
|
||||
};
|
||||
});
|
||||
// Immediately run the first iteration.
|
||||
// We are inside an animation frame, we want to immediately draw on the newly setup canvas.
|
||||
main_loop_callback();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue