src/SDL.c
changeset 7281 cd5516b9263d
parent 7191 75360622e65f
child 7346 ff228f955a48
     1.1 --- a/src/SDL.c	Wed Jun 05 21:14:26 2013 -0700
     1.2 +++ b/src/SDL.c	Wed Jun 05 21:23:59 2013 -0700
     1.3 @@ -43,6 +43,11 @@
     1.4  
     1.5  
     1.6  /* The initialized subsystems */
     1.7 +#ifdef SDL_MAIN_NEEDED
     1.8 +static SDL_bool SDL_MainIsReady = SDL_FALSE;
     1.9 +#else
    1.10 +static SDL_bool SDL_MainIsReady = SDL_TRUE;
    1.11 +#endif
    1.12  static SDL_bool SDL_bInMainQuit = SDL_FALSE;
    1.13  static Uint8 SDL_SubsystemRefCount[ 32 ];
    1.14  
    1.15 @@ -88,9 +93,20 @@
    1.16      return SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit;
    1.17  }
    1.18  
    1.19 +void
    1.20 +SDL_SetMainReady(void)
    1.21 +{
    1.22 +    SDL_MainIsReady = SDL_TRUE;
    1.23 +}
    1.24 +
    1.25  int
    1.26  SDL_InitSubSystem(Uint32 flags)
    1.27  {
    1.28 +    if (!SDL_MainIsReady) {
    1.29 +        SDL_SetError("Application didn't initialize properly, did you include SDL_main.h in the file containing your main() function?");
    1.30 +        return -1;
    1.31 +    }
    1.32 +
    1.33  #if !SDL_TIMERS_DISABLED
    1.34      SDL_InitTicks();
    1.35  #endif