소스 검색

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

Lasse Öörni 10 년 전
부모
커밋
a7c488b1bc
2개의 변경된 파일3개의 추가작업 그리고 8개의 파일을 삭제
  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
 #endif
 
 
+#include <SDL/SDL.h>
+
 #include "../DebugNew.h"
 #include "../DebugNew.h"
 
 
 namespace Urho3D
 namespace Urho3D
@@ -123,11 +125,7 @@ void InitFPU()
 
 
 void ErrorDialog(const String& title, const String& message)
 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)
 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
     engine_->Exit(); // Close the rendering window
     exitCode_ = EXIT_FAILURE;
     exitCode_ = EXIT_FAILURE;
 
 
-    // Only for WIN32, otherwise the error messages would be double posted on Mac OS X and Linux platforms
     if (!message.Length())
     if (!message.Length())
     {
     {
-#ifdef WIN32
         ErrorDialog(GetTypeName(), startupErrors_.Length() ? startupErrors_ :
         ErrorDialog(GetTypeName(), startupErrors_.Length() ? startupErrors_ :
             "Application has been terminated due to unexpected error.");
             "Application has been terminated due to unexpected error.");
-#endif
     }
     }
     else
     else
         ErrorDialog(GetTypeName(), message);
         ErrorDialog(GetTypeName(), message);