diff 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
line wrap: on
line diff
--- a/src/video/SDL_video.c	Wed Mar 15 15:47:49 2006 +0000
+++ b/src/video/SDL_video.c	Wed Mar 15 17:46:41 2006 +0000
@@ -587,6 +587,13 @@
 	}
 	this = video = current_video;
 
+	/* Default to the current width and height */
+	if ( width == 0 ) {
+		width = video->info.current_w;
+	}
+	if ( height == 0 ) {
+		height = video->info.current_h;
+	}
 	/* Default to the current video bpp */
 	if ( bpp == 0 ) {
 		flags |= SDL_ANYFORMAT;
@@ -889,6 +896,8 @@
 		SDL_PublicSurface = SDL_VideoSurface;
 	}
 	video->info.vfmt = SDL_VideoSurface->format;
+	video->info.current_w = SDL_VideoSurface->w;
+	video->info.current_h = SDL_VideoSurface->h;
 
 	/* We're done! */
 	return(SDL_PublicSurface);