comparison src/video/SDL_video.c @ 1545:8d9bb0cf2c2a

Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set. SDL_SetVideoMode() now accepts 0 for width or height and will use the current video mode (or the desktop mode if no mode has been set.)
author Sam Lantinga <slouken@libsdl.org>
date Wed, 15 Mar 2006 17:46:41 +0000
parents cf23b92602aa
children 0a53c90a37f9 3b2a92126f4d
comparison
equal deleted inserted replaced
1544:ab1e4c41ab71 1545:8d9bb0cf2c2a
585 return(NULL); 585 return(NULL);
586 } 586 }
587 } 587 }
588 this = video = current_video; 588 this = video = current_video;
589 589
590 /* Default to the current width and height */
591 if ( width == 0 ) {
592 width = video->info.current_w;
593 }
594 if ( height == 0 ) {
595 height = video->info.current_h;
596 }
590 /* Default to the current video bpp */ 597 /* Default to the current video bpp */
591 if ( bpp == 0 ) { 598 if ( bpp == 0 ) {
592 flags |= SDL_ANYFORMAT; 599 flags |= SDL_ANYFORMAT;
593 bpp = SDL_VideoSurface->format->BitsPerPixel; 600 bpp = SDL_VideoSurface->format->BitsPerPixel;
594 } 601 }
887 SDL_PublicSurface = SDL_ShadowSurface; 894 SDL_PublicSurface = SDL_ShadowSurface;
888 } else { 895 } else {
889 SDL_PublicSurface = SDL_VideoSurface; 896 SDL_PublicSurface = SDL_VideoSurface;
890 } 897 }
891 video->info.vfmt = SDL_VideoSurface->format; 898 video->info.vfmt = SDL_VideoSurface->format;
899 video->info.current_w = SDL_VideoSurface->w;
900 video->info.current_h = SDL_VideoSurface->h;
892 901
893 /* We're done! */ 902 /* We're done! */
894 return(SDL_PublicSurface); 903 return(SDL_PublicSurface);
895 } 904 }
896 905