emscripten: minor refactoring

- Remove the use of EXPORTED_FUNCTIONS in favor of EMSCRIPTEN_KEEPALIVE
- SDL_Delay is no longer aliased to emscripten_sleep
This commit is contained in:
kichikuou
2021-01-17 13:55:43 +09:00
parent 8519bc1a55
commit cbb40d0b67
6 changed files with 10 additions and 8 deletions
-1
View File
@@ -42,7 +42,6 @@ elseif (EMSCRIPTEN)
"SHELL:-s ALLOW_MEMORY_GROWTH=1"
"SHELL:-s NO_EXIT_RUNTIME=1"
"SHELL:-s ASYNCIFY_ADD=\"['NACT::execute()']\""
"SHELL:-s EXPORTED_FUNCTIONS=\"['_main','_ags_setAntialiasedStringMode']\""
"SHELL:-s EXTRA_EXPORTED_RUNTIME_METHODS=\"['getValue','addRunDependency','removeRunDependency']\"")
else() # NOT (ANDROID OR EMSCRIPTEN)
+3 -2
View File
@@ -12,9 +12,10 @@
#include <limits.h>
#include <stdio.h>
#ifdef EMSCRIPTEN
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#define SDL_Delay emscripten_sleep
#else
#define EMSCRIPTEN_KEEPALIVE
#endif
#define FONT_RESOURCE_NAME "MTLc3m.ttf"
-4
View File
@@ -13,10 +13,6 @@
#include <emscripten/html5.h>
#endif
extern "C" {
void ags_setAntialiasedStringMode(int on);
}
SDL_Window* g_window;
int main(int argc, char *argv[])
+1 -1
View File
@@ -543,7 +543,7 @@ uint16 AGS::convert_hankaku(uint16 code)
extern "C" {
void ags_setAntialiasedStringMode(int on) {
void EMSCRIPTEN_KEEPALIVE ags_setAntialiasedStringMode(int on) {
antialias = on != 0;
}
+4
View File
@@ -489,7 +489,11 @@ void NACT::wait_after_open_menu()
void NACT::sys_sleep(int ms) {
pump_events();
ags->update_screen();
#ifdef __EMSCRIPTEN__
emscripten_sleep(ms);
#else
SDL_Delay(ms);
#endif
}
// WinMainとのインターフェース
+2
View File
@@ -418,4 +418,6 @@ protected:
uint16 cali2() override;
};
extern "C" void ags_setAntialiasedStringMode(int on);
#endif // _NACT_H_