Initialize timers first so the tick counter is valid by the time the audio and video systems initialize.
--HG-- branch : SDL-1.2
This commit is contained in:
parent
672dd12b3e
commit
a83766faae
1 changed files with 25 additions and 25 deletions
50
src/SDL.c
50
src/SDL.c
|
@ -64,6 +64,25 @@ int surfaces_allocated = 0;
|
||||||
|
|
||||||
int SDL_InitSubSystem(Uint32 flags)
|
int SDL_InitSubSystem(Uint32 flags)
|
||||||
{
|
{
|
||||||
|
#if !SDL_TIMERS_DISABLED
|
||||||
|
/* Initialize the timer subsystem */
|
||||||
|
if ( ! ticks_started ) {
|
||||||
|
SDL_StartTicks();
|
||||||
|
ticks_started = 1;
|
||||||
|
}
|
||||||
|
if ( (flags & SDL_INIT_TIMER) && !(SDL_initialized & SDL_INIT_TIMER) ) {
|
||||||
|
if ( SDL_TimerInit() < 0 ) {
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
SDL_initialized |= SDL_INIT_TIMER;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if ( flags & SDL_INIT_TIMER ) {
|
||||||
|
SDL_SetError("SDL not built with timer support");
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !SDL_VIDEO_DISABLED
|
#if !SDL_VIDEO_DISABLED
|
||||||
/* Initialize the video/event subsystem */
|
/* Initialize the video/event subsystem */
|
||||||
if ( (flags & SDL_INIT_VIDEO) && !(SDL_initialized & SDL_INIT_VIDEO) ) {
|
if ( (flags & SDL_INIT_VIDEO) && !(SDL_initialized & SDL_INIT_VIDEO) ) {
|
||||||
|
@ -95,25 +114,6 @@ int SDL_InitSubSystem(Uint32 flags)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !SDL_TIMERS_DISABLED
|
|
||||||
/* Initialize the timer subsystem */
|
|
||||||
if ( ! ticks_started ) {
|
|
||||||
SDL_StartTicks();
|
|
||||||
ticks_started = 1;
|
|
||||||
}
|
|
||||||
if ( (flags & SDL_INIT_TIMER) && !(SDL_initialized & SDL_INIT_TIMER) ) {
|
|
||||||
if ( SDL_TimerInit() < 0 ) {
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
SDL_initialized |= SDL_INIT_TIMER;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if ( flags & SDL_INIT_TIMER ) {
|
|
||||||
SDL_SetError("SDL not built with timer support");
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !SDL_JOYSTICK_DISABLED
|
#if !SDL_JOYSTICK_DISABLED
|
||||||
/* Initialize the joystick subsystem */
|
/* Initialize the joystick subsystem */
|
||||||
if ( (flags & SDL_INIT_JOYSTICK) &&
|
if ( (flags & SDL_INIT_JOYSTICK) &&
|
||||||
|
@ -185,12 +185,6 @@ void SDL_QuitSubSystem(Uint32 flags)
|
||||||
SDL_initialized &= ~SDL_INIT_JOYSTICK;
|
SDL_initialized &= ~SDL_INIT_JOYSTICK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if !SDL_TIMERS_DISABLED
|
|
||||||
if ( (flags & SDL_initialized & SDL_INIT_TIMER) ) {
|
|
||||||
SDL_TimerQuit();
|
|
||||||
SDL_initialized &= ~SDL_INIT_TIMER;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#if !SDL_AUDIO_DISABLED
|
#if !SDL_AUDIO_DISABLED
|
||||||
if ( (flags & SDL_initialized & SDL_INIT_AUDIO) ) {
|
if ( (flags & SDL_initialized & SDL_INIT_AUDIO) ) {
|
||||||
SDL_AudioQuit();
|
SDL_AudioQuit();
|
||||||
|
@ -203,6 +197,12 @@ void SDL_QuitSubSystem(Uint32 flags)
|
||||||
SDL_initialized &= ~SDL_INIT_VIDEO;
|
SDL_initialized &= ~SDL_INIT_VIDEO;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if !SDL_TIMERS_DISABLED
|
||||||
|
if ( (flags & SDL_initialized & SDL_INIT_TIMER) ) {
|
||||||
|
SDL_TimerQuit();
|
||||||
|
SDL_initialized &= ~SDL_INIT_TIMER;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Uint32 SDL_WasInit(Uint32 flags)
|
Uint32 SDL_WasInit(Uint32 flags)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue