From d6700ebd1f938d6d9b89a56b969ebfed64799192 Mon Sep 17 00:00:00 2001 From: tmator Date: Tue, 12 Aug 2008 23:51:00 +0000 Subject: [PATCH] better sdl code git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@184 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp index b086c7cdec..d0c915ba5e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLInit.cpp @@ -392,15 +392,23 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight } #else //SDL fo other OS (osx, bsd, ...) - int videoFlags; + int videoFlags = SDL_OPENGL; SDL_Surface *screen; const SDL_VideoInfo *videoInfo; //init sdl video - SDL_Init(SDL_INIT_VIDEO); + if (SDL_Init(SDL_INIT_VIDEO) < 0) { + //TODO : Display an error message + SDL_Quit(); + return false; + } //fetch video info videoInfo = SDL_GetVideoInfo(); - + if (!videoInfo) { + //TODO : Display an error message + SDL_Quit(); + return false; + } //hw o sw ogl ? if (videoInfo->hw_available) videoFlags |= SDL_HWSURFACE; @@ -416,6 +424,13 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); screen = SDL_SetVideoMode(_twidth, _theight, 24, SDL_OPENGL|SDL_RESIZABLE); + if (!screen) { + //TODO : Display an error message + SDL_Quit(); + return false; + } + + #endif return true; }