From edf4f6f6883b8bf54a7839987044842684e5a66e Mon Sep 17 00:00:00 2001 From: relnev Date: Wed, 8 Jan 2003 06:49:24 +0000 Subject: added sdl init git-svn-id: svn://svn.icculus.org/blackshades/trunk@42 5198baeb-e213-0410-be47-fc2ff85ca46f --- Source/GameInitDispose.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'Source/GameInitDispose.cpp') diff --git a/Source/GameInitDispose.cpp b/Source/GameInitDispose.cpp index f6e642c..76b0f32 100644 --- a/Source/GameInitDispose.cpp +++ b/Source/GameInitDispose.cpp @@ -3774,7 +3774,32 @@ int Game::InitGL(GLvoid) return; #else - STUB_FUNCTION; + if (SDL_Init(SDL_INIT_VIDEO) == -1) { + fprintf(stderr, "SDL Init Video failed: %s\n", SDL_GetError()); + exit(EXIT_FAILURE); + } + + atexit(SDL_Quit); + + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + + if(screenwidth<640||screenheight<480) { + if (SDL_SetVideoMode(640, 480, 0, SDL_OPENGL) == NULL) { + fprintf(stderr, "(OpenGL) SDL SetVideoMode failed: %s\n", SDL_GetError()); + exit(EXIT_FAILURE); + } + } else { + if (SDL_SetVideoMode(screenwidth, screenheight, 0, SDL_OPENGL) == NULL) { + fprintf(stderr, "(OpenGL) SDL SetVideoMode failed: %s\n", SDL_GetError()); + exit(EXIT_FAILURE); + } + } + + SDL_WM_SetCaption("Black Shades", "Black Shades"); #endif -- cgit v1.2.3