pub unsafe extern "C" fn SDL_Init(flags: Uint32) -> c_int
Expand description
Initialize the SDL library.
SDL_Init() simply forwards to calling SDL_InitSubSystem(). Therefore, the two may be used interchangeably. Though for readability of your code SDL_InitSubSystem() might be preferred.
The file I/O (for example: SDL_RWFromFile) and threading (SDL_CreateThread) subsystems are initialized by default. Message boxes (SDL_ShowSimpleMessageBox) also attempt to work without initializing the video subsystem, in hopes of being useful in showing an error dialog when SDL_Init fails. You must specifically initialize other subsystems if you use them in your application.
Logging (such as SDL_Log) works without initialization, too.
flags
may be any of the following OR’d together:
SDL_INIT_TIMER
: timer subsystemSDL_INIT_AUDIO
: audio subsystemSDL_INIT_VIDEO
: video subsystem; automatically initializes the events subsystemSDL_INIT_JOYSTICK
: joystick subsystem; automatically initializes the events subsystemSDL_INIT_HAPTIC
: haptic (force feedback) subsystemSDL_INIT_GAMECONTROLLER
: controller subsystem; automatically initializes the joystick subsystemSDL_INIT_EVENTS
: events subsystemSDL_INIT_EVERYTHING
: all of the above subsystemsSDL_INIT_NOPARACHUTE
: compatibility; this flag is ignored
Subsystem initialization is ref-counted, you must call SDL_QuitSubSystem() for each SDL_InitSubSystem() to correctly shutdown a subsystem manually (or call SDL_Quit() to force shutdown). If a subsystem is already loaded then this call will increase the ref-count and return.
\param flags subsystem initialization flags \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.
\since This function is available since SDL 2.0.0.
\sa SDL_InitSubSystem \sa SDL_Quit \sa SDL_SetMainReady \sa SDL_WasInit