From 7f0169be0db0f16a91d859a54b22535f26fdcb38 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 8 Mar 2020 18:40:13 +0100 Subject: Add vsync command line options to demos --- test/test_utils.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'test/test_utils.h') diff --git a/test/test_utils.h b/test/test_utils.h index 6a2a644..b79c0b9 100644 --- a/test/test_utils.h +++ b/test/test_utils.h @@ -25,6 +25,7 @@ typedef struct { int samples; int doubleBuffer; + int sync; bool continuous; bool help; bool ignoreKeyRepeat; @@ -165,17 +166,29 @@ puglPrintTestUsage(const char* prog, const char* posHelp) " -c Continuously animate and draw\n" " -d Enable double-buffering\n" " -e Enable platform error-checking\n" + " -f Fast drawing, explicitly disable vertical sync\n" " -h Display this help\n" " -i Ignore key repeat\n" " -v Print verbose output\n" - " -r Resizable window\n", + " -r Resizable window\n" + " -s Explicitly enable vertical sync\n", prog, posHelp); } static inline PuglTestOptions puglParseTestOptions(int* pargc, char*** pargv) { - PuglTestOptions opts = { 0, 0, false, false, false, false, false, false }; + PuglTestOptions opts = { + 0, + 0, + PUGL_DONT_CARE, + false, + false, + false, + false, + false, + false, + }; char** const argv = *pargv; int i = 1; @@ -188,6 +201,8 @@ puglParseTestOptions(int* pargc, char*** pargv) opts.doubleBuffer = PUGL_TRUE; } else if (!strcmp(argv[i], "-e")) { opts.errorChecking = PUGL_TRUE; + } else if (!strcmp(argv[i], "-f")) { + opts.sync = PUGL_FALSE; } else if (!strcmp(argv[i], "-h")) { opts.help = true; return opts; @@ -195,6 +210,8 @@ puglParseTestOptions(int* pargc, char*** pargv) opts.ignoreKeyRepeat = true; } else if (!strcmp(argv[i], "-r")) { opts.resizable = true; + } else if (!strcmp(argv[i], "-s")) { + opts.sync = PUGL_TRUE; } else if (!strcmp(argv[i], "-v")) { opts.verbose = true; } else if (argv[i][0] != '-') { -- cgit v1.2.1