changeset 87:3ef4bc90c388

Added -width and -height command line options
author Sam Lantinga <slouken@lokigames.com>
date Sat, 07 Jul 2001 06:33:33 +0000
parents 13e4c612098d
children 71774090f286
files test/testwm.c
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/test/testwm.c	Mon Jul 02 00:20:29 2001 +0000
+++ b/test/testwm.c	Sat Jul 07 06:33:33 2001 +0000
@@ -254,6 +254,7 @@
 	SDL_Surface *icon;
 	Uint8 *icon_mask;
 	int parsed;
+	int w, h;
 
 	if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
 		fprintf(stderr,
@@ -263,6 +264,8 @@
 	atexit(SDL_Quit);
 
 	/* Check command line arguments */
+	w = 640;
+	h = 480;
 	video_bpp = 8;
 	video_flags = SDL_SWSURFACE;
 	parsed = 1;
@@ -282,6 +285,16 @@
 			argc -= 1;
 			argv += 1;
 		} else
+		if ( (argc >= 3) && (strcmp(argv[1], "-width") == 0) ) {
+			w = atoi(argv[2]);
+			argc -= 2;
+			argv += 2;
+		} else
+		if ( (argc >= 3) && (strcmp(argv[1], "-height") == 0) ) {
+			h = atoi(argv[2]);
+			argc -= 2;
+			argv += 2;
+		} else
 		if ( (argc >= 3) && (strcmp(argv[1], "-bpp") == 0) ) {
 			video_bpp = atoi(argv[2]);
 			argc -= 2;
@@ -314,7 +327,7 @@
 		printf("No window title was set!\n");
 
 	/* Initialize the display */
-	if ( SetVideoMode(640, 480) < 0 ) {
+	if ( SetVideoMode(w, h) < 0 ) {
 		return(1);
 	}