diff options
author | taw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5> | 2008-07-05 16:00:40 +0000 |
---|---|---|
committer | taw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5> | 2008-07-05 16:00:40 +0000 |
commit | ffa1f448097091bf185d66d18188fdc5e9923566 (patch) | |
tree | 18b83556c4668012af1cfa5f0a18375b779c42a3 /src/main.c | |
parent | 7e60489479958946be4f34c9fb8bb257dcc703b4 (diff) |
Option to disable music
Neater handling of game options
git-svn-id: svn://cook.msm.cam.ac.uk:745/thrust3d/thrust3d@130 84d2e878-0bd5-11dd-ad15-13eda11d74c5
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 30 |
1 files changed, 20 insertions, 10 deletions
@@ -51,19 +51,23 @@ int main(int argc, char *argv[]) { Uint32 video_flags; ScreenResolution res; Uint32 t = 0; + GameOptions gameopts; + + gameopts.disable_vbos = 0; + gameopts.disable_fbos = 0; + gameopts.disable_shaders = 0; + gameopts.audio_debug = 0; + gameopts.no_music = 0; - int disable_vbos = 0; - int disable_fbos = 0; - int disable_shaders = 0; - int audio_debug = 0; const struct option longopts[] = { {"fullscreen", 0, NULL, 'f'}, {"resolution", 1, NULL, 'r'}, {"help", 0, NULL, 'h'}, {"version", 0, NULL, 'v'}, - {"disable-vbos", 0, &disable_vbos, 1}, - {"disable-fbos", 0, &disable_fbos, 1}, - {"disable-shaders", 0, &disable_shaders, 1}, - {"audio-debug", 0, &audio_debug, 1}, + {"disable-vbos", 0, &gameopts.disable_vbos, 1}, + {"disable-fbos", 0, &gameopts.disable_fbos, 1}, + {"disable-shaders", 0, &gameopts.disable_shaders, 1}, + {"audio-debug", 0, &gameopts.audio_debug, 1}, + {"no-music", 0, NULL, 'n'}, {0, 0, NULL, 0} }; @@ -71,7 +75,7 @@ int main(int argc, char *argv[]) { width = 800; height = 600; video_flags = SDL_OPENGL; - while ((c = getopt_long(argc, argv, "hvr:f", longopts, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "hvr:fn", longopts, NULL)) != -1) { switch ( c ) { @@ -99,6 +103,11 @@ int main(int argc, char *argv[]) { main_version(); return 0; } + + case 'n' : { + gameopts.no_music = 1; + break; + } case 'h' : { printf("Syntax: %s [options]\n\n", argv[0]); @@ -107,6 +116,7 @@ int main(int argc, char *argv[]) { printf(" -v, --version Display version number and exit.\n"); printf(" -r, --resolution <res> Set display resolution. See below for possible values for <res>.\n"); printf(" -f, --fullscreen Use the full screen.\n"); + printf(" -n, --no-music Don't play any background music.\n"); printf("\nAdvanced options:\n\n"); printf(" --disable-vbos Disable the use of vertex buffer objects.\n"); printf(" --disable-fbos Disable the use of framebuffer objects.\n"); @@ -168,7 +178,7 @@ int main(int argc, char *argv[]) { /* World setup */ Game *game; - game = game_new(width, height, disable_vbos, disable_fbos, disable_shaders, audio_debug); + game = game_new(width, height, gameopts); /* Main loop */ finished = 0; |