- added libdrawtext
[demo_prior] / src / opt.c
index 796722c..01be1a6 100644 (file)
--- a/src/opt.c
+++ b/src/opt.c
@@ -11,7 +11,8 @@ struct options opt = {
        1,                      /* fullscreen */
        1,                      /* music */
        1,                      /* sRGB */
-       1                       /* anti-aliasing */
+       1,                      /* anti-aliasing */
+       1                       /* vsync */
 };
 
 int parse_args(int argc, char **argv)
@@ -40,6 +41,10 @@ int parse_args(int argc, char **argv)
                        opt.music = 1;
                } else if(strcmp(argv[i], "-nomusic") == 0) {
                        opt.music = 0;
+               } else if(strcmp(argv[i], "-vsync") == 0) {
+                       opt.vsync = 1;
+               } else if(strcmp(argv[i], "-novsync") == 0) {
+                       opt.vsync = 0;
                } else if(strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "-help") == 0) {
                        print_usage(argv[0]);
                        exit(0);
@@ -61,6 +66,7 @@ static void print_usage(const char *argv0)
        printf("  -srgb/-nosrgb: enable/disable sRGB framebuffer\n");
        printf("  -aa/-noaa: enable/disable multisample anti-aliasing\n");
        printf("  -music/-nomusic: enable/disable music playback\n");
+       printf("  -vsync/-novsync: enable/disable vertical sync\n");
        printf("  -h,-help: print usage and exit\n");
 }
 
@@ -77,6 +83,7 @@ int read_cfg(const char *fname)
        opt.music = ts_lookup_int(ts, "demo.music", opt.music);
        opt.srgb = ts_lookup_int(ts, "demo.srgb", opt.srgb);
        opt.msaa = ts_lookup_int(ts, "demo.aa", opt.msaa);
+       opt.vsync = ts_lookup_int(ts, "demo.vsync", opt.vsync);
 
        ts_free_tree(ts);
        return 0;