SDL_WasInit
Name
SDL_WasInit -- identifies which subsystems have been initialized.
Synopsis
#include "SDL.h" Uint32 SDL_WasInit (Uint32 flags);
Description
This function returns mask of the specified subsystems which have been initialized.
If flags is 0 or SDL_INIT_EVERYTHING, it returns a mask of all initialized subsystems.
This function uses the same SDL_INIT_* values as SDL_Init, except that SDL_INIT_NOPARACHUTE and SDL_INIT_EVENTTHREAD do nothing.
Return Value
Returns an OR'd combination of SDL_INIT_* values indicating which of the subsystems specified by flags is active, or 0 if none are active.
Note: If you start a subsystem using a call to that subsystem's init function (for example SDL_VideoInit) instead of SDL_Init or SDL_InitSubSystem, SDL_QuitSubSystem and SDL_WasInit will not work.
Example
#include <SDL.h>
#include <stdio.h>
int main(int argc, char** argv) {
/* Initialize SDL and required subsystems */
if (SDL_Init(SDL_INIT_TIMER|SDL_INIT_VIDEO) != 0) {
fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError());
return 1;
}
/* Initialize optional subsystems */
SDL_InitSubSystem(SDL_INIT_JOYSTICK);
SDL_InitSubSystem(SDL_INIT_HAPTIC);
SDL_InitSubSystem(SDL_INIT_AUDIO);
/* ... */
if (SDL_WasInit(SDL_INIT_AUDIO) != 0) {
play_sound(5);
}
/* ... */
SDL_Quit();
return 0;
}
