mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-02-01 02:56:43 +01:00
PrintConsole: use emscripten_log; don't use printf on Android and Emscripten; unify outputs
This commit is contained in:
parent
d55fbebe4d
commit
8c7068b48d
1 changed files with 14 additions and 3 deletions
17
src/utils.c
17
src/utils.c
|
@ -438,14 +438,25 @@ SYMBOL_EXPORT void PrintConsoleWithContext(struct Game* game, int line, const ch
|
||||||
if (game->config.debug.enabled)
|
if (game->config.debug.enabled)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
#ifdef ALLEGRO_ANDROID
|
||||||
|
if (game->config.debug.verbose) {
|
||||||
|
__android_log_print(ANDROID_LOG_DEBUG, al_get_app_name(), "%s:%d [%s] %s", file, line, func, text);
|
||||||
|
} else {
|
||||||
|
__android_log_print(ANDROID_LOG_DEBUG, al_get_app_name(), "[%s] %s", func, text);
|
||||||
|
}
|
||||||
|
#elif defined(__EMSCRIPTEN__)
|
||||||
|
if (game->config.debug.verbose) {
|
||||||
|
emscripten_log(EM_LOG_CONSOLE, "%s:%d [%s] %s", file, line, func, text);
|
||||||
|
} else {
|
||||||
|
emscripten_log(EM_LOG_CONSOLE, "[%s] %s", func, text);
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (game->config.debug.verbose) {
|
if (game->config.debug.verbose) {
|
||||||
printf("%s:%d ", file, line);
|
printf("%s:%d ", file, line);
|
||||||
}
|
}
|
||||||
printf("[%s] %s\n", func, text);
|
printf("[%s] %s\n", func, text);
|
||||||
#ifdef ALLEGRO_ANDROID
|
|
||||||
__android_log_print(ANDROID_LOG_DEBUG, al_get_app_name(), "[%s] %s", func, text);
|
|
||||||
#endif
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
game->_priv.console_pos++;
|
game->_priv.console_pos++;
|
||||||
if (game->_priv.console_pos >= (sizeof(game->_priv.console) / sizeof(game->_priv.console[0]))) {
|
if (game->_priv.console_pos >= (sizeof(game->_priv.console) / sizeof(game->_priv.console[0]))) {
|
||||||
|
|
Loading…
Reference in a new issue