Wiki Page Content

Differences between revisions 4 and 5
Revision 4 as of 2010-07-21 03:57:54
Size: 1386
Editor: SheenaSmith
Comment: remove 'draft' note
Revision 5 as of 2013-07-13 22:58:03
Size: 1328
Editor: ChrisBush
Comment: Moving code example to code examples section
Deletions are marked like this. Additions are marked like this.
Line 16: Line 16:
You can add your code example here
}}}

== Remarks ==
You should call this function even if you have already shutdown each initialized subsystem with [[SDL_QuitSubSystem]]().

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]](), then you must use that subsystem's quit function ([[SDL_VideoQuit]]()) to shut it down before calling SDL_Quit().

You can use this function with atexit() to ensure that it is run when your application is shutdown, but it is not wise to do this from a library or other dynamically loaded code.

== Examples ==
{{{#!highlight cpp
Line 30: Line 18:
#include <stdlib.h>
Line 44: Line 33:
== Remarks ==
You should call this function even if you have already shutdown each initialized subsystem with [[SDL_QuitSubSystem]]().

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]](), then you must use that subsystem's quit function ([[SDL_VideoQuit]]()) to shut it down before calling SDL_Quit().

You can use this function with atexit() to ensure that it is run when your application is shutdown, but it is not wise to do this from a library or other dynamically loaded code.

SDL_Quit

Use this function to clean up all initialized subsystems. You should call it upon all exit conditions.

Syntax

void SDL_Quit(void)

Code Examples

#include "SDL.h"
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char** argv) {
    if (SDL_Init(SDL_INIT_EVERYTHING) != 0) {
        fprintf(stderr, "Unable to initialize SDL:  %s\n", SDL_GetError());
        return 1;
    }
    atexit(SDL_Quit);

    /* ... */

    return 0;
}

Remarks

You should call this function even if you have already shutdown each initialized subsystem with SDL_QuitSubSystem().

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(), then you must use that subsystem's quit function (SDL_VideoQuit()) to shut it down before calling SDL_Quit().

You can use this function with atexit() to ensure that it is run when your application is shutdown, but it is not wise to do this from a library or other dynamically loaded code.


CategoryAPI, CategoryInit

None: SDL_Quit (last edited 2015-01-07 02:59:53 by Joseph Carter)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit