src/SDL.c
changeset 6128 2804d71badce
parent 5535 96594ac5fd1a
child 6138 4c64952a58fb
     1.1 --- a/src/SDL.c	Thu Dec 29 13:54:22 2011 -0500
     1.2 +++ b/src/SDL.c	Fri Dec 30 06:41:41 2011 -0500
     1.3 @@ -49,6 +49,25 @@
     1.4  int
     1.5  SDL_InitSubSystem(Uint32 flags)
     1.6  {
     1.7 +#if !SDL_TIMERS_DISABLED
     1.8 +    /* Initialize the timer subsystem */
     1.9 +    if (!ticks_started) {
    1.10 +        SDL_StartTicks();
    1.11 +        ticks_started = 1;
    1.12 +    }
    1.13 +    if ((flags & SDL_INIT_TIMER) && !(SDL_initialized & SDL_INIT_TIMER)) {
    1.14 +        if (SDL_TimerInit() < 0) {
    1.15 +            return (-1);
    1.16 +        }
    1.17 +        SDL_initialized |= SDL_INIT_TIMER;
    1.18 +    }
    1.19 +#else
    1.20 +    if (flags & SDL_INIT_TIMER) {
    1.21 +        SDL_SetError("SDL not built with timer support");
    1.22 +        return (-1);
    1.23 +    }
    1.24 +#endif
    1.25 +
    1.26  #if !SDL_VIDEO_DISABLED
    1.27      /* Initialize the video/event subsystem */
    1.28      if ((flags & SDL_INIT_VIDEO) && !(SDL_initialized & SDL_INIT_VIDEO)) {
    1.29 @@ -79,25 +98,6 @@
    1.30      }
    1.31  #endif
    1.32  
    1.33 -#if !SDL_TIMERS_DISABLED
    1.34 -    /* Initialize the timer subsystem */
    1.35 -    if (!ticks_started) {
    1.36 -        SDL_StartTicks();
    1.37 -        ticks_started = 1;
    1.38 -    }
    1.39 -    if ((flags & SDL_INIT_TIMER) && !(SDL_initialized & SDL_INIT_TIMER)) {
    1.40 -        if (SDL_TimerInit() < 0) {
    1.41 -            return (-1);
    1.42 -        }
    1.43 -        SDL_initialized |= SDL_INIT_TIMER;
    1.44 -    }
    1.45 -#else
    1.46 -    if (flags & SDL_INIT_TIMER) {
    1.47 -        SDL_SetError("SDL not built with timer support");
    1.48 -        return (-1);
    1.49 -    }
    1.50 -#endif
    1.51 -
    1.52  #if !SDL_JOYSTICK_DISABLED
    1.53      /* Initialize the joystick subsystem */
    1.54      if ((flags & SDL_INIT_JOYSTICK) && !(SDL_initialized & SDL_INIT_JOYSTICK)) {
    1.55 @@ -175,12 +175,6 @@
    1.56          SDL_initialized &= ~SDL_INIT_HAPTIC;
    1.57      }
    1.58  #endif
    1.59 -#if !SDL_TIMERS_DISABLED
    1.60 -    if ((flags & SDL_initialized & SDL_INIT_TIMER)) {
    1.61 -        SDL_TimerQuit();
    1.62 -        SDL_initialized &= ~SDL_INIT_TIMER;
    1.63 -    }
    1.64 -#endif
    1.65  #if !SDL_AUDIO_DISABLED
    1.66      if ((flags & SDL_initialized & SDL_INIT_AUDIO)) {
    1.67          SDL_AudioQuit();
    1.68 @@ -193,6 +187,12 @@
    1.69          SDL_initialized &= ~SDL_INIT_VIDEO;
    1.70      }
    1.71  #endif
    1.72 +#if !SDL_TIMERS_DISABLED
    1.73 +    if ((flags & SDL_initialized & SDL_INIT_TIMER)) {
    1.74 +        SDL_TimerQuit();
    1.75 +        SDL_initialized &= ~SDL_INIT_TIMER;
    1.76 +    }
    1.77 +#endif
    1.78  }
    1.79  
    1.80  Uint32