Ensure SDL_image and SDL_ttf initialize correctly

This commit is contained in:
Jonas Kulla 2013-10-02 13:50:58 +02:00
parent 0f58852e2b
commit bb70c39811
1 changed files with 15 additions and 2 deletions

View File

@ -127,8 +127,21 @@ int main(int, char *argv[])
return 0; return 0;
} }
IMG_Init(IMG_INIT_PNG | IMG_INIT_JPG); int imgFlags = IMG_INIT_PNG | IMG_INIT_JPG;
TTF_Init(); if (IMG_Init(imgFlags) != imgFlags)
{
qDebug() << "Error initializing SDL_image:" << SDL_GetError();
SDL_Quit();
return 0;
}
if (TTF_Init() < 0)
{
qDebug() << "Error initializing SDL_ttf:" << SDL_GetError();
IMG_Quit();
SDL_Quit();
return 0;
}
SDL_SetHint("SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS", "0"); SDL_SetHint("SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS", "0");