Added -width and -height command line options
authorSam Lantinga <slouken@lokigames.com>
Sat, 07 Jul 2001 06:33:33 +0000
changeset 873ef4bc90c388
parent 86 13e4c612098d
child 88 71774090f286
Added -width and -height command line options
test/testwm.c
     1.1 --- a/test/testwm.c	Mon Jul 02 00:20:29 2001 +0000
     1.2 +++ b/test/testwm.c	Sat Jul 07 06:33:33 2001 +0000
     1.3 @@ -254,6 +254,7 @@
     1.4  	SDL_Surface *icon;
     1.5  	Uint8 *icon_mask;
     1.6  	int parsed;
     1.7 +	int w, h;
     1.8  
     1.9  	if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
    1.10  		fprintf(stderr,
    1.11 @@ -263,6 +264,8 @@
    1.12  	atexit(SDL_Quit);
    1.13  
    1.14  	/* Check command line arguments */
    1.15 +	w = 640;
    1.16 +	h = 480;
    1.17  	video_bpp = 8;
    1.18  	video_flags = SDL_SWSURFACE;
    1.19  	parsed = 1;
    1.20 @@ -282,6 +285,16 @@
    1.21  			argc -= 1;
    1.22  			argv += 1;
    1.23  		} else
    1.24 +		if ( (argc >= 3) && (strcmp(argv[1], "-width") == 0) ) {
    1.25 +			w = atoi(argv[2]);
    1.26 +			argc -= 2;
    1.27 +			argv += 2;
    1.28 +		} else
    1.29 +		if ( (argc >= 3) && (strcmp(argv[1], "-height") == 0) ) {
    1.30 +			h = atoi(argv[2]);
    1.31 +			argc -= 2;
    1.32 +			argv += 2;
    1.33 +		} else
    1.34  		if ( (argc >= 3) && (strcmp(argv[1], "-bpp") == 0) ) {
    1.35  			video_bpp = atoi(argv[2]);
    1.36  			argc -= 2;
    1.37 @@ -314,7 +327,7 @@
    1.38  		printf("No window title was set!\n");
    1.39  
    1.40  	/* Initialize the display */
    1.41 -	if ( SetVideoMode(640, 480) < 0 ) {
    1.42 +	if ( SetVideoMode(w, h) < 0 ) {
    1.43  		return(1);
    1.44  	}
    1.45