|
Size: 914
Comment: minor correction
|
← Revision 8 as of 2016-06-10 20:00:41 ⇥
Size: 1615
Comment: Fixed wiki include.
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 3: | Line 3: |
| ||<tablewidth="100%" style="color: #FF0000;" :> DRAFT|| | |
| Line 6: | Line 5: |
| Use this function to ,,clean up,, ^quit^ specific SDL subsystems. | Use this function to shut down specific SDL subsystems. |
| Line 20: | Line 19: |
| You can add your code example here | #include "SDL.h" /* ... */ int main(int argc, char **argv) { int sdl_initialized = 0; sdl_initialized = !SDL_Init(0); /* ... console stuff ... */ if (sdl_initialized && SDL_InitSubSystem(SDL_INIT_VIDEO)) { display_graph(); SDL_QuitSubSystem(SDL_INIT_VIDEO); } /* ... more console stuff ... */ if (sdl_initialized) SDL_Quit(); return 0; } |
| Line 24: | Line 42: |
| <<Anchor(flags)>>These are the flags which may be passed to [[SDL_QuitSubSystem]]() and may be OR'd together to quit multiple subsystems simultaneously. <<Include(SDL_Init, , , from="OR'd together.", to="== Return Value ==")>> |
<<Anchor(flags)>>These are the flags which may be passed to [[SDL_QuitSubSystem]]() and may be OR'd together to quit multiple subsystems simultaneously. <<Include(SDL_Init, , , from="OR'd together:", to="If you want to initialize")>> |
| Line 27: | Line 45: |
| ''You can add useful comments here'' | 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. You will need to use that subsystem's quit function ([[SDL_VideoQuit]]()) directly instead. You still need to call [[SDL_Quit]]() even if you close all open subsystems with [[SDL_QuitSubSystem]](). |
SDL_QuitSubSystem
Use this function to shut down specific SDL subsystems.
Syntax
void SDL_QuitSubSystem(Uint32 flags)
Function Parameters
Code Examples
#include "SDL.h"
/* ... */
int main(int argc, char **argv) {
int sdl_initialized = 0;
sdl_initialized = !SDL_Init(0);
/* ... console stuff ... */
if (sdl_initialized && SDL_InitSubSystem(SDL_INIT_VIDEO)) {
display_graph();
SDL_QuitSubSystem(SDL_INIT_VIDEO);
}
/* ... more console stuff ... */
if (sdl_initialized) SDL_Quit();
return 0;
}
Remarks
These are the flags which may be passed to SDL_QuitSubSystem() and may be OR'd together to quit multiple subsystems simultaneously.
SDL_INIT_TIMER |
timer subsystem |
SDL_INIT_AUDIO |
audio subsystem |
SDL_INIT_VIDEO |
video subsystem; automatically initializes the events subsystem |
SDL_INIT_JOYSTICK |
joystick subsystem; automatically initializes the events subsystem |
SDL_INIT_HAPTIC |
haptic (force feedback) subsystem |
SDL_INIT_GAMECONTROLLER |
controller subsystem; automatically initializes the joystick subsystem |
SDL_INIT_EVENTS |
events subsystem |
SDL_INIT_EVERYTHING |
all of the above subsystems |
SDL_INIT_NOPARACHUTE |
compatibility; this flag is ignored |
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. You will need to use that subsystem's quit function (SDL_VideoQuit()) directly instead.
You still need to call SDL_Quit() even if you close all open subsystems with SDL_QuitSubSystem().
