X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=vid_sdl.c;h=e751030db90594cec9ec21100bccf92f9111e8c8;hb=7a98ba933dc5de54c8ae6556ac48c3ff067f33ee;hp=d18b5a42506c640b52b5c23275cfbd4c3b3c8a6c;hpb=a26b4a77c05fcb30bab5e089c228e931ef76fa65;p=xonotic%2Fdarkplaces.git diff --git a/vid_sdl.c b/vid_sdl.c index d18b5a42..e751030d 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -388,7 +388,7 @@ void Sys_SendKeyEvents( void ) break; case SDL_KEYDOWN: case SDL_KEYUP: - Key_Event( MapKey( event.key.keysym.sym ), (char)event.key.keysym.unicode, (event.key.state == SDL_PRESSED) ); + Key_Event( MapKey( event.key.keysym.sym ), event.key.keysym.unicode, (event.key.state == SDL_PRESSED) ); break; case SDL_ACTIVEEVENT: if( event.active.state & SDL_APPACTIVE ) @@ -488,7 +488,7 @@ void VID_Init (void) //Cvar_RegisterVariable(&joy_sensitivityroll); #ifdef SDL_R_RESTART - R_RegisterModule("SDL", sdl_start, sdl_shutdown, sdl_newmap); + R_RegisterModule("SDL", sdl_start, sdl_shutdown, sdl_newmap, NULL, NULL); #endif if (SDL_Init(SDL_INIT_VIDEO) < 0) @@ -549,9 +549,19 @@ static void VID_SetIcon(void) int thenone = -1; static SDL_Color palette[256]; unsigned short palenc[256]; // store color id by char + char *xpm; + char **idata, *data; - char **idata = ENGINE_ICON; - char *data = idata[0]; + xpm = (char *) FS_LoadFile("darkplaces-icon.xpm", tempmempool, false, NULL); + idata = NULL; + if(xpm) + idata = XPM_DecodeString(xpm); + if(!idata) + idata = ENGINE_ICON; + if(xpm) + Mem_Free(xpm); + + data = idata[0]; if(sscanf(data, "%i %i %i %i", &width, &height, &colors, &isize) != 4) { @@ -656,15 +666,15 @@ static void VID_OutputVersion(void) version->major, version->minor, version->patch ); } -int VID_InitMode(int fullscreen, int *width, int *height, int bpp, int refreshrate, int stereobuffer, int samples) +qboolean VID_InitMode(viddef_mode_t *mode) { int i; static int notfirstvideomode = false; int flags = SDL_OPENGL; const char *drivername; - win_half_width = *width>>1; - win_half_height = *height>>1; + win_half_width = mode->width>>1; + win_half_height = mode->height>>1; if(vid_resizable.integer) flags |= SDL_RESIZABLE; @@ -703,14 +713,14 @@ int VID_InitMode(int fullscreen, int *width, int *height, int bpp, int refreshra // Knghtbrd: should do platform-specific extension string function here vid_isfullscreen = false; - if (fullscreen) { + if (mode->fullscreen) { flags |= SDL_FULLSCREEN; vid_isfullscreen = true; } //flags |= SDL_HWSURFACE; SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); - if (bpp >= 32) + if (mode->bitsperpixel >= 32) { SDL_GL_SetAttribute (SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, 8); @@ -726,26 +736,26 @@ int VID_InitMode(int fullscreen, int *width, int *height, int bpp, int refreshra SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, 5); SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 16); } - if (stereobuffer) + if (mode->stereobuffer) SDL_GL_SetAttribute (SDL_GL_STEREO, 1); if (vid_vsync.integer) SDL_GL_SetAttribute (SDL_GL_SWAP_CONTROL, 1); else SDL_GL_SetAttribute (SDL_GL_SWAP_CONTROL, 0); - if (samples > 1) + if (mode->samples > 1) { SDL_GL_SetAttribute (SDL_GL_MULTISAMPLEBUFFERS, 1); - SDL_GL_SetAttribute (SDL_GL_MULTISAMPLESAMPLES, samples); + SDL_GL_SetAttribute (SDL_GL_MULTISAMPLESAMPLES, mode->samples); } - video_bpp = bpp; + video_bpp = mode->bitsperpixel; video_flags = flags; VID_SetIcon(); - screen = SDL_SetVideoMode(*width, *height, bpp, flags); + screen = SDL_SetVideoMode(mode->width, mode->height, mode->bitsperpixel, flags); if (screen == NULL) { - Con_Printf("Failed to set video mode to %ix%i: %s\n", *width, *height, SDL_GetError()); + Con_Printf("Failed to set video mode to %ix%i: %s\n", mode->width, mode->height, SDL_GetError()); VID_Shutdown(); return false; } @@ -761,7 +771,6 @@ int VID_InitMode(int fullscreen, int *width, int *height, int bpp, int refreshra gl_platform = "SDL"; gl_platformextensions = ""; - gl_videosyncavailable = true; GL_Init();