From 54cd8f90a1d86910732ef4a70253c2c55ad2e73b Mon Sep 17 00:00:00 2001 From: Allanis <allanis@saracraft.net> Date: Thu, 16 May 2013 15:44:25 +0100 Subject: [PATCH] [Add] Change dimensions from commandline. --- src/conf.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/conf.c b/src/conf.c index c54cd6e..8a334d0 100644 --- a/src/conf.c +++ b/src/conf.c @@ -63,6 +63,8 @@ static void print_usage(char** argv) { LOG(" -f, --fullscreen - Fullscreen"); LOG(" -F, --fps - Limit frames per second"); LOG(" -d s, --data s - Set the data file to be s"); + LOG(" -x n - Set width to n"); + LOG(" -y n - Set height to n"); LOG(" -j n, --joystick n - Use joystick (n)"); LOG(" -J s, --joystick s - Use joystick whose name contains (s)"); LOG(" -S, --Sound - Forces sound."); @@ -208,6 +210,8 @@ void conf_parseCLI(int argc, char** argv) { { "data", required_argument, 0, 'd' }, { "joystick", required_argument, 0, 'j' }, { "Joystick", required_argument, 0, 'J' }, + { "width", required_argument, 0, 'W' }, + { "width", required_argument, 0, 'H' }, { "sound", no_argument, 0, 'S' }, { "mvol", required_argument, 0, 'm' }, { "svol", required_argument, 0, 's' }, @@ -218,7 +222,7 @@ void conf_parseCLI(int argc, char** argv) { int option_index = 0; int c = 0; - while((c = getopt_long(argc, argv, "fF:d:J:MSm:s:hv", + while((c = getopt_long(argc, argv, "fF:d:j:J:W:H:MSm:s:hv", long_options, &option_index)) != -1) { switch(c) { case 'f': @@ -236,6 +240,12 @@ void conf_parseCLI(int argc, char** argv) { case 'J': namjoystick = strdup(optarg); break; + case 'W': + gl_screen.w = atoi(optarg); + break; + case 'H': + gl_screen.h = atoi(optarg); + break; case 'M': nosound = 1; break;