Browse Source

Use SDL message box for ErrorDialog() function for cross-platform support.

Lasse Öörni 10 years ago
parent
commit
a7c488b1bc
2 changed files with 3 additions and 8 deletions
  1. 3 5
      Source/Urho3D/Core/ProcessUtils.cpp
  2. 0 3
      Source/Urho3D/Engine/Application.cpp

+ 3 - 5
Source/Urho3D/Core/ProcessUtils.cpp

@@ -74,6 +74,8 @@ inline void SetFPUState(unsigned control)
 
 #endif
 
+#include <SDL/SDL.h>
+
 #include "../DebugNew.h"
 
 namespace Urho3D
@@ -123,11 +125,7 @@ void InitFPU()
 
 void ErrorDialog(const String& title, const String& message)
 {
-#ifdef WIN32
-    MessageBoxW(0, WString(message).CString(), WString(title).CString(), 0);
-#else
-    PrintLine(message, true);
-#endif
+    SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, title.CString(), message.CString(), 0);
 }
 
 void ErrorExit(const String& message, int exitCode)

+ 0 - 3
Source/Urho3D/Engine/Application.cpp

@@ -111,13 +111,10 @@ void Application::ErrorExit(const String& message)
     engine_->Exit(); // Close the rendering window
     exitCode_ = EXIT_FAILURE;
 
-    // Only for WIN32, otherwise the error messages would be double posted on Mac OS X and Linux platforms
     if (!message.Length())
     {
-#ifdef WIN32
         ErrorDialog(GetTypeName(), startupErrors_.Length() ? startupErrors_ :
             "Application has been terminated due to unexpected error.");
-#endif
     }
     else
         ErrorDialog(GetTypeName(), message);