Skip to content

Commit

Permalink
WinRT: Move Windows::Foundation::Initialize to SDL2.dll, from SDL_main.
Browse files Browse the repository at this point in the history
This allows C# UWP applications to use SDL2's SDL_WinRTRunApp function.

Kudos to Ethan Lee (flibitijibibo@flibitijibibo.com) for the patch.  Thanks!
  • Loading branch information
DavidLudwig committed Oct 24, 2017
1 parent 6d23ea4 commit 0e032d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/core/winrt/SDL_winrtapp_common.cpp
Expand Up @@ -24,6 +24,8 @@
#include "SDL_winrtapp_direct3d.h"
#include "SDL_winrtapp_xaml.h"

#include <wrl.h>

int (*WINRT_SDLAppEntryPoint)(int, char **) = NULL;

extern "C" DECLSPEC int
Expand All @@ -32,6 +34,9 @@ SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * xamlBackgroundPanel)
if (xamlBackgroundPanel) {
return SDL_WinRTInitXAMLApp(mainFunction, xamlBackgroundPanel);
} else {
if (FAILED(Windows::Foundation::Initialize(RO_INIT_MULTITHREADED))) {
return 1;
}
return SDL_WinRTInitNonXAMLApp(mainFunction);
}
}
7 changes: 1 addition & 6 deletions src/main/winrt/SDL_winrt_main_NonXAML.cpp
Expand Up @@ -50,10 +50,5 @@

int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
if (FAILED(Windows::Foundation::Initialize(RO_INIT_MULTITHREADED))) {
return 1;
}

SDL_WinRTRunApp(SDL_main, NULL);
return 0;
return SDL_WinRTRunApp(SDL_main, NULL);
}

0 comments on commit 0e032d5

Please sign in to comment.