1.1 --- a/src/video/windowsrt/SDL_WinRTApp.cpp Sat Oct 27 21:26:01 2012 -0400
1.2 +++ b/src/video/windowsrt/SDL_WinRTApp.cpp Sat Oct 27 22:03:31 2012 -0400
1.3 @@ -2,6 +2,13 @@
1.4 #include "SDL_WinRTApp.h"
1.5 #include "BasicTimer.h"
1.6
1.7 +// HACK, DLudwig: The C-style main() will get loaded via the app's
1.8 +// WinRT-styled main(), which is part of SDLmain_for_WinRT.cpp.
1.9 +// This seems wrong on some level, but does seem to work.
1.10 +typedef int (*SDL_WinRT_MainFunction)(int, char **);
1.11 +static SDL_WinRT_MainFunction SDL_WinRT_main = nullptr;
1.12 +
1.13 +
1.14 using namespace Windows::ApplicationModel;
1.15 using namespace Windows::ApplicationModel::Core;
1.16 using namespace Windows::ApplicationModel::Activation;
1.17 @@ -59,6 +66,15 @@
1.18
1.19 void SDL_WinRTApp::Run()
1.20 {
1.21 + if (SDL_WinRT_main)
1.22 + {
1.23 + // TODO, WinRT: pass the C-style main() a reasonably realistic
1.24 + // representation of command line arguments.
1.25 + int argc = 0;
1.26 + char **argv = NULL;
1.27 + SDL_WinRT_main(argc, argv);
1.28 + }
1.29 +
1.30 BasicTimer^ timer = ref new BasicTimer();
1.31
1.32 while (!m_windowClosed)
1.33 @@ -140,9 +156,10 @@
1.34 return ref new SDL_WinRTApp();
1.35 }
1.36
1.37 -__declspec(dllexport) int SDL_WinRT_RunApplication(/*Platform::Array<Platform::String^>^*/)
1.38 +__declspec(dllexport) int SDL_WinRT_RunApplication(SDL_WinRT_MainFunction mainFunction)
1.39 {
1.40 - auto direct3DApplicationSource = ref new Direct3DApplicationSource();
1.41 + SDL_WinRT_main = mainFunction;
1.42 + auto direct3DApplicationSource = ref new Direct3DApplicationSource();
1.43 CoreApplication::Run(direct3DApplicationSource);
1.44 return 0;
1.45 }