better error checking when initing the SDL video driver

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2327 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria
2008-10-06 00:39:10 +00:00
parent 43d092c26c
commit 6a9a943292

View File

@@ -58,8 +58,11 @@ SDLDriver::SDLDriver()
: sensedInput(0), actionMap(0), mainSurface(0), flags(0), stickInfos(0),
mode(BOOTSTRAP), mouseValX(0), mouseValY(0)
{
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_TIMER);
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_TIMER) < 0)
{
fprintf(stderr, "SDL_Init failed: %s\n", SDL_GetError());
exit(1);
}
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
@@ -249,6 +252,13 @@ SDLDriver::setVideoMode(bool resetTextures)
SDL_FreeSurface(mainSurface);
mainSurface = SDL_SetVideoMode(user_config->m_width, user_config->m_height, 0, flags);
if (!mainSurface)
{
fprintf(stderr, "SDL_SetVideoMode (%dx%d) failed: %s\n",
user_config->m_width, user_config->m_height, SDL_GetError());
exit(1);
}
#if defined(WIN32) || defined(__APPLE__)
if(resetTextures)
{