include/SDL_main.h
changeset 8477 ad08f0d710f3
parent 8439 14d94a8a9fb6
parent 7335 13b67be8e3af
child 8480 733f78caa9cb
     1.1 --- a/include/SDL_main.h	Sat Jun 08 14:34:09 2013 -0400
     1.2 +++ b/include/SDL_main.h	Mon Aug 12 22:29:55 2013 -0400
     1.3 @@ -26,18 +26,40 @@
     1.4  
     1.5  /**
     1.6   *  \file SDL_main.h
     1.7 - *  
     1.8 + *
     1.9   *  Redefine main() on some platforms so that it is called by SDL.
    1.10   */
    1.11  
    1.12 -#if defined(__WIN32__) || defined(__WINRT__) || defined(__IPHONEOS__) || defined(__ANDROID__)
    1.13  #ifndef SDL_MAIN_HANDLED
    1.14 +#if defined(__WIN32__)
    1.15 +/* On Windows SDL provides WinMain(), which parses the command line and passes
    1.16 +   the arguments to your main function.
    1.17 +
    1.18 +   If you provide your own WinMain(), you may define SDL_MAIN_HANDLED
    1.19 + */
    1.20 +#define SDL_MAIN_AVAILABLE
    1.21 +
    1.22 +#elif defined(__IPHONEOS__)
    1.23 +/* On iOS SDL provides a main function that creates an application delegate
    1.24 +   and starts the iOS application run loop.
    1.25 +
    1.26 +   See src/video/uikit/SDL_uikitappdelegate.m for more details.
    1.27 + */
    1.28  #define SDL_MAIN_NEEDED
    1.29 +
    1.30 +#elif defined(__ANDROID__)
    1.31 +/* On Android SDL provides a Java class in SDLActivity.java that is the
    1.32 +   main activity entry point.
    1.33 +
    1.34 +   See README-android.txt for more details on extending that class.
    1.35 + */
    1.36 +#define SDL_MAIN_NEEDED
    1.37 +
    1.38  #endif
    1.39 -#endif
    1.40 +#endif /* SDL_MAIN_HANDLED */
    1.41  
    1.42  #ifdef __cplusplus
    1.43 -#define C_LINKAGE	"C"
    1.44 +#define C_LINKAGE   "C"
    1.45  #else
    1.46  #define C_LINKAGE
    1.47  #endif /* __cplusplus */
    1.48 @@ -57,8 +79,8 @@
    1.49   *  \endcode
    1.50   */
    1.51  
    1.52 -#ifdef SDL_MAIN_NEEDED
    1.53 -#define main	SDL_main
    1.54 +#if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE)
    1.55 +#define main    SDL_main
    1.56  #endif
    1.57  
    1.58  /**
    1.59 @@ -69,11 +91,18 @@
    1.60  
    1.61  #include "begin_code.h"
    1.62  #ifdef __cplusplus
    1.63 -/* *INDENT-OFF* */
    1.64  extern "C" {
    1.65 -/* *INDENT-ON* */
    1.66  #endif
    1.67  
    1.68 +/*
    1.69 + *  This is called by the real SDL main function to let the rest of the
    1.70 + *  library know that initialization was done properly.
    1.71 + *
    1.72 + *  Calling this yourself without knowing what you're doing can cause
    1.73 + *  crashes and hard to diagnose problems with your application.
    1.74 + */
    1.75 +extern DECLSPEC void SDL_SetMainReady(void);
    1.76 +
    1.77  #ifdef __WIN32__
    1.78  
    1.79  /**
    1.80 @@ -87,9 +116,7 @@
    1.81  
    1.82  
    1.83  #ifdef __cplusplus
    1.84 -/* *INDENT-OFF* */
    1.85  }
    1.86 -/* *INDENT-ON* */
    1.87  #endif
    1.88  #include "close_code.h"
    1.89