Not using SDLmain on Windows is just fine, don't fail the initialization if the program implements WinMain() and then doesn't call SDL_SetMainReady().
This broke Steam's Big Picture game controller support. I also added some more documentation so people know why main() is overridden on various platforms.
This commit is contained in:
parent
324a14d847
commit
78a7a1b54e
1 changed files with 25 additions and 3 deletions
|
@ -30,11 +30,33 @@
|
|||
* Redefine main() on some platforms so that it is called by SDL.
|
||||
*/
|
||||
|
||||
#if defined(__WIN32__) || defined(__IPHONEOS__) || defined(__ANDROID__)
|
||||
#ifndef SDL_MAIN_HANDLED
|
||||
#if defined(__WIN32__)
|
||||
/* On Windows SDL provides WinMain(), which parses the command line and passes
|
||||
the arguments to your main function.
|
||||
|
||||
If you provide your own WinMain(), you may define SDL_MAIN_HANDLED
|
||||
*/
|
||||
#define SDL_MAIN_AVAILABLE
|
||||
|
||||
#elif defined(__IPHONEOS__)
|
||||
/* On iOS SDL provides a main function that creates an application delegate
|
||||
and starts the iOS application run loop.
|
||||
|
||||
See src/video/uikit/SDL_uikitappdelegate.m for more details.
|
||||
*/
|
||||
#define SDL_MAIN_NEEDED
|
||||
|
||||
#elif defined(__ANDROID__)
|
||||
/* On Android SDL provides a Java class in SDLActivity.java that is the
|
||||
main activity entry point.
|
||||
|
||||
See README-android.txt for more details on extending that class.
|
||||
*/
|
||||
#define SDL_MAIN_NEEDED
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#endif /* SDL_MAIN_HANDLED */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define C_LINKAGE "C"
|
||||
|
@ -57,7 +79,7 @@
|
|||
* \endcode
|
||||
*/
|
||||
|
||||
#ifdef SDL_MAIN_NEEDED
|
||||
#if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE)
|
||||
#define main SDL_main
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue