diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-09-15 03:11:44 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-09-15 04:19:24 +0300 |
commit | b8609879ee683da6a6cc15222b7d0d7f075095db (patch) | |
tree | 2ede597ac7d2b8a8d14b6a9bebb8d4c500da281a | |
parent | fa5e367a09f3a32376706798c27f46e403900d3a (diff) | |
download | plus-b8609879ee683da6a6cc15222b7d0d7f075095db.tar.gz plus-b8609879ee683da6a6cc15222b7d0d7f075095db.tar.bz2 plus-b8609879ee683da6a6cc15222b7d0d7f075095db.tar.xz plus-b8609879ee683da6a6cc15222b7d0d7f075095db.zip |
If critical error happened, show message box (SDL2)
-rw-r--r-- | src/logger.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/logger.cpp b/src/logger.cpp index 455cc8621..8582d0b4b 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -42,6 +42,10 @@ #include <sstream> +#ifdef USE_SDL2 +#include <SDL_messagebox.h> +#endif // USE_SDl2 + #ifdef ENABLEDEBUGLOG #if defined(__ANDROID__) #include <android/log.h> @@ -369,6 +373,12 @@ void Logger::flush() void Logger::safeError(const std::string &error_text) { log("Error: %s", error_text.c_str()); +#ifdef USE_SDL2 + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, + "Error", + error_text.c_str(), + nullptr); +#else // USE_SDL2 #ifdef WIN32 MessageBox(nullptr, error_text.c_str(), "Error", MB_ICONERROR | MB_OK); #elif defined __APPLE__ @@ -391,6 +401,7 @@ void Logger::safeError(const std::string &error_text) std::cerr << "Error: " << error_text << std::endl; #endif // WIN32 +#endif // USE_SDL2 exit(1); } @@ -399,6 +410,12 @@ void Logger::safeError(const std::string &error_text) void Logger::error(const std::string &error_text) { log("Error: %s", error_text.c_str()); +#ifdef USE_SDL2 + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, + "Error", + error_text.c_str(), + nullptr); +#else // USE_SDL2 #ifdef WIN32 MessageBox(nullptr, error_text.c_str(), "Error", MB_ICONERROR | MB_OK); #elif defined __APPLE__ @@ -421,6 +438,7 @@ void Logger::error(const std::string &error_text) std::cerr << "Error: " << error_text << std::endl; #endif // WIN32 +#endif // USE_SDL2 exit(1); } |