From fd2f60fc3ae64408a82259f5bd8351fc53f27bb0 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Tue, 13 Dec 2022 18:13:34 -0800 Subject: sars: add --delay [seconds] flag Defaults to 10 seconds when bare --delay is used This is primarily intended for video capture purposes --- src/sars.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/sars.c') diff --git a/src/sars.c b/src/sars.c index 0e1d387..0c6295e 100644 --- a/src/sars.c +++ b/src/sars.c @@ -38,6 +38,8 @@ #define SARS_DEFAULT_WINMODE SARS_WINMODE_WINDOW #endif +#define SARS_DEFAULT_DELAY_SECS 10 + #define SARS_WINDOW_FLAGS (SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL | SDL_WINDOW_ALLOW_HIGHDPI) @@ -254,6 +256,14 @@ static int sars_parse_argv(sars_t *sars, int argc, char *argv[]) } } else if (!strcmp(flag, "--cheat")) { sars->cheat = 1; + } else if (!strcmp(flag, "--delay")) { + sars->delay_seconds = SARS_DEFAULT_DELAY_SECS; + + if (i + 1 < argc && argv[i + 1][0] != '-' && argv[i + 1][1] != '-') { + /* --wait SECONDS is optionally supported */ + sscanf(argv[i + 1], "%u", &sars->delay_seconds); /* FIXME: parse errors */ + i++; + } } else { warn_if(1, "Unsupported flag \"%s\", ignoring", argv[i]); } /* TODO: add --fullscreen? */ -- cgit v1.2.3