include/SDL_main.h
changeset 8583 fb2933ca805f
parent 8149 681eb46b8ac4
parent 8582 c3e9a2b93517
child 8833 ae720d61d14d
     1.1 --- a/include/SDL_main.h	Sun Mar 09 10:38:30 2014 -0700
     1.2 +++ b/include/SDL_main.h	Sun Mar 09 11:36:47 2014 -0700
     1.3 @@ -39,6 +39,18 @@
     1.4   */
     1.5  #define SDL_MAIN_AVAILABLE
     1.6  
     1.7 +#elif defined(__WINRT__)
     1.8 +/* On WinRT, SDL provides a main function that initializes CoreApplication,
     1.9 +   creating an instance of IFrameworkView in the process.
    1.10 +
    1.11 +   Please note that #include'ing SDL_main.h is not enough to get a main()
    1.12 +   function working.  In non-XAML apps, the file,
    1.13 +   src/main/winrt/SDL_WinRT_main_NonXAML.cpp, or a copy of it, must be compiled
    1.14 +   into the app itself.  In XAML apps, the function, SDL_WinRTRunApp must be
    1.15 +   called, with a pointer to the Direct3D-hosted XAML control passed in.
    1.16 +*/
    1.17 +#define SDL_MAIN_NEEDED
    1.18 +
    1.19  #elif defined(__IPHONEOS__)
    1.20  /* On iOS SDL provides a main function that creates an application delegate
    1.21     and starts the iOS application run loop.
    1.22 @@ -115,6 +127,24 @@
    1.23  #endif /* __WIN32__ */
    1.24  
    1.25  
    1.26 +#ifdef __WINRT__
    1.27 +
    1.28 +/**
    1.29 + *  \brief Initializes and launches an SDL/WinRT application.
    1.30 + *
    1.31 + *  \param mainFunction The SDL app's C-style main().
    1.32 + *  \param xamlBackgroundPanel An optional, XAML-based, background panel.
    1.33 + *     For Non-XAML apps, this value must be set to NULL.  For XAML apps,
    1.34 + *     pass in a pointer to a SwapChainBackgroundPanel, casted to an
    1.35 + *     IInspectable (via reinterpret_cast).
    1.36 + *  \ret 0 on success, -1 on failure.  On failure, use SDL_GetError to retrieve more
    1.37 + *      information on the failure.
    1.38 + */
    1.39 +extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * xamlBackgroundPanel);
    1.40 +
    1.41 +#endif /* __WINRT__ */
    1.42 +
    1.43 +
    1.44  #ifdef __cplusplus
    1.45  }
    1.46  #endif