comparison src/SDL_compat.c @ 1733:0b1070f2f94d SDL-1.3

Implemented gamma correction on Windows. Added general code to restore the video mode and gamma when windows lose focus.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 09 Jul 2006 09:02:26 +0000
parents 875c3cf1a12c
children f7c667ded87d
comparison
equal deleted inserted replaced
1732:fd65f12b6de6 1733:0b1070f2f94d
358 window_flags |= SDL_WINDOW_RESIZABLE; 358 window_flags |= SDL_WINDOW_RESIZABLE;
359 } 359 }
360 if (flags & SDL_NOFRAME) { 360 if (flags & SDL_NOFRAME) {
361 window_flags |= SDL_WINDOW_BORDERLESS; 361 window_flags |= SDL_WINDOW_BORDERLESS;
362 } 362 }
363 if (SDL_getenv("SDL_WINDOW_POS")) {
364 }
365 GetEnvironmentWindowPosition(width, height, &window_x, &window_y); 363 GetEnvironmentWindowPosition(width, height, &window_x, &window_y);
364 SDL_SetFullscreenDisplayMode(NULL);
366 SDL_VideoWindow = 365 SDL_VideoWindow =
367 SDL_CreateWindow(wm_title, window_x, window_y, width, height, 366 SDL_CreateWindow(wm_title, window_x, window_y, width, height,
368 window_flags); 367 window_flags);
369 if (!SDL_VideoWindow) { 368 if (!SDL_VideoWindow) {
370 return NULL; 369 return NULL;
425 mode.h = height; 424 mode.h = height;
426 mode.refresh_rate = 0; 425 mode.refresh_rate = 0;
427 426
428 /* Set the desired display mode */ 427 /* Set the desired display mode */
429 if (flags & SDL_FULLSCREEN) { 428 if (flags & SDL_FULLSCREEN) {
430 if (!SDL_GetClosestDisplayMode(&mode, &mode)) { 429 if (SDL_SetFullscreenDisplayMode(&mode) < 0) {
431 return NULL; 430 return NULL;
432 } 431 }
433 } else {
434 if (desktop_format) {
435 mode.format = desktop_format;
436 }
437 if (desktop_mode->w && desktop_mode->h) {
438 mode.w = desktop_mode->w;
439 mode.h = desktop_mode->h;
440 }
441 mode.refresh_rate = desktop_mode->refresh_rate;
442 }
443 if (SDL_SetDisplayMode(&mode) < 0) {
444 return NULL;
445 } 432 }
446 433
447 /* If we're in OpenGL mode, just create a stub surface and we're done! */ 434 /* If we're in OpenGL mode, just create a stub surface and we're done! */
448 if (flags & SDL_OPENGL) { 435 if (flags & SDL_OPENGL) {
449 SDL_VideoSurface = 436 SDL_VideoSurface =