diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2022-12-13 18:13:34 -0800 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2022-12-13 18:30:00 -0800 |
commit | fd2f60fc3ae64408a82259f5bd8351fc53f27bb0 (patch) | |
tree | 22cf5655376e853fd5216ff647fb70284fa1df32 /src/sars.c | |
parent | 6a1c41149ad50d975b6ed5d7a5ef248c1ccba4cf (diff) |
sars: add --delay [seconds] flag
Defaults to 10 seconds when bare --delay is used
This is primarily intended for video capture purposes
Diffstat (limited to 'src/sars.c')
-rw-r--r-- | src/sars.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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? */ |