From c1e491a4b104ffdbc77449761b8272f5e2a559f0 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 28 Jun 2013 22:44:49 -0700 Subject: [PATCH] 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. --- include/SDL_main.h | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/include/SDL_main.h b/include/SDL_main.h index 7a766d24c..bbb7e859b 100644 --- a/include/SDL_main.h +++ b/include/SDL_main.h @@ -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