1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
From: Bart Martens <bartm@debian.org>
Date: Sat, 11 Jun 2016 10:52:04 +0200
Subject: 01 resolutions
---
src/Main.c | 54 +++++++++++++++---------------------------------------
1 file changed, 15 insertions(+), 39 deletions(-)
diff --git a/src/Main.c b/src/Main.c
index 2520856..894c519 100644
--- a/src/Main.c
+++ b/src/Main.c
@@ -84,7 +84,9 @@ int
main(int argc, char *argv[])
{
Uint32 flags = SDL_DOUBLEBUF;
- int i;
+ int i, j;
+ static int available_resolution_width [] = { 320, 320, 640, 640, 800, 1024, 1280, 1600, 1280, 1280, 1440, 1400, 0 };
+ static int available_resolution_height[] = { 200, 240, 400, 480, 600, 768, 1024, 1200, 768, 800, 900, 1050, 0 };
int w, h, bpp, n;
int hw_mem = 1;
int intro = 0;
@@ -129,43 +131,13 @@ main(int argc, char *argv[])
runmode = RUNMODE_GAME;
} else if(!strcmp(argv[i], "--size") && i < argc - 1) {
n = atoi(argv[i + 1]);
- switch (n) {
- case 0:
- w = 320;
- h = 200;
- break;
- case 1:
- w = 320;
- h = 240;
- break;
- case 2:
- w = 640;
- h = 400;
- break;
- case 3:
- w = 640;
- h = 480;
- break;
- case 4:
- w = 800;
- h = 600;
- break;
- case 5:
- w = 1024;
- h = 768;
- break;
- case 6:
- w = 1280;
- h = 1024;
- break;
- case 7:
- w = 1600;
- h = 1200;
- break;
- default:
- w = 640;
- h = 480;
- }
+ for( j = 0 ; available_resolution_width[j] != 0 ; j++ )
+ if( j == n )
+ {
+ w = available_resolution_width[j];
+ h = available_resolution_height[j];
+ break;
+ }
} else if((!strcmp(argv[i], "--bpp") || !strcmp(argv[i], "-b"))
&& i < argc - 1) {
n = atoi(argv[i + 1]);
@@ -191,7 +163,11 @@ main(int argc, char *argv[])
printf
("--size # Use this width/height for the video mode.\n");
printf
- ("\tModes: 0-320/200 1-320/240 2-640/400 3-640/480 4-800/600 5-1024/768 6-1280/1024 7-1600/1200\n");
+ ("\tModes:\n");
+ for( j = 0 ; available_resolution_width[j] != 0 ; j++ )
+ printf( "\t %2d: %4d/%4d (%1.2f)\n", j,
+ available_resolution_width[j], available_resolution_height[j],
+ (float)available_resolution_width[j] / (float)available_resolution_height[j] );
printf("-b --bpp # Use this bpp for the video mode.\n");
printf("--nosound Don't use sound.\n");
printf("-? -h --help Show this help message.\n");
|