mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
run SDL_Quit() at exit
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1125 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
42def503ff
commit
ce78a2ea51
1 changed files with 15 additions and 4 deletions
|
@ -54,7 +54,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void Sys_CheckSDL (void)
|
static void Sys_AtExit (void)
|
||||||
|
{
|
||||||
|
SDL_Quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Sys_InitSDL (void)
|
||||||
{
|
{
|
||||||
#if defined(USE_SDL2)
|
#if defined(USE_SDL2)
|
||||||
SDL_version v;
|
SDL_version v;
|
||||||
|
@ -74,6 +79,12 @@ static void Sys_CheckSDL (void)
|
||||||
Sys_Error("Your version of SDL library is incompatible with me.\n"
|
Sys_Error("Your version of SDL library is incompatible with me.\n"
|
||||||
"You need a library version in the line of %d.%d.%d\n", SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z);
|
"You need a library version in the line of %d.%d.%d\n", SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SDL_Init(0) < 0)
|
||||||
|
{
|
||||||
|
Sys_Error("SDL failed to initialize.");
|
||||||
|
}
|
||||||
|
atexit(Sys_AtExit);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_LP64) || defined(__LP64__) || defined(_WIN64)
|
#if defined(_LP64) || defined(__LP64__) || defined(_WIN64)
|
||||||
|
@ -105,7 +116,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
isDedicated = (COM_CheckParm("-dedicated") != 0);
|
isDedicated = (COM_CheckParm("-dedicated") != 0);
|
||||||
|
|
||||||
Sys_CheckSDL ();
|
Sys_InitSDL ();
|
||||||
|
|
||||||
Sys_Init();
|
Sys_Init();
|
||||||
|
|
||||||
|
@ -158,12 +169,12 @@ int main(int argc, char *argv[])
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
/* If we have no input focus at all, sleep a bit */
|
/* If we have no input focus at all, sleep a bit */
|
||||||
if ( !VID_HasMouseOrInputFocus() || cl.paused)
|
if (!VID_HasMouseOrInputFocus() || cl.paused)
|
||||||
{
|
{
|
||||||
SDL_Delay(16);
|
SDL_Delay(16);
|
||||||
}
|
}
|
||||||
/* If we're minimised, sleep a bit more */
|
/* If we're minimised, sleep a bit more */
|
||||||
if ( VID_IsMinimized() )
|
if (VID_IsMinimized())
|
||||||
{
|
{
|
||||||
scr_skipupdate = 1;
|
scr_skipupdate = 1;
|
||||||
SDL_Delay(32);
|
SDL_Delay(32);
|
||||||
|
|
Loading…
Reference in a new issue