#pragma section-numbers off #pragma disable-camelcase = SDL_InitSubSystem = Use this function to initialize specific SDL subsystems. <> == Syntax == {{{#!highlight cpp int SDL_InitSubSystem(Uint32 flags) }}} == Function Parameters == ||'''flags'''||any of the flags used by [[SDL_Init]](); see [[#flags|Remarks]] for details|| == Return Value == Returns 0 on success or a negative error code on failure; call [[SDL_GetError]]() for more information. == Code Examples == {{{#!highlight cpp /* Separating Joystick and Video initialization. */ SDL_Init(SDL_INIT_VIDEO); SDL_Window* window = SDL_CreateWindow("A Window", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_FULLSCREEN); SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, 0); /* Do Some Video stuff */ /* Initialize the joystick subsystem */ SDL_InitSubSystem(SDL_INIT_JOYSTICK); /* Do some stuff with video and joystick */ /* Shut them both down */ SDL_Quit(); }}} == Remarks == After SDL has been initialized with [[SDL_Init]]() you may initialize uninitialized subsystems with [[SDL_InitSubSystem]](). <>These are the flags which may be passed to [[SDL_InitSubSystem]]() and may be OR'd together to initialize multiple subsystems simultaneously. <> [[SDL_Init]]() initializes assertions and crash protection and then calls [[SDL_InitSubSystem]](). If you want to bypass those protections you can call [[SDL_InitSubSystem]]() directly. 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. == Related Functions == .[[SDL_Init]] .[[SDL_Quit]] .[[SDL_QuitSubSystem]] ---- [[CategoryAPI]], [[CategoryInit]]