Skip to content

Commit 51a742b

Browse files
committed
driver: Add --no-sdl flag to disable SDL window
Overrides the option found in JSON.
1 parent 764bc8f commit 51a742b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/driver/args.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#include <common/textbuffer.h>
2525
#include <common/cr_string.h>
2626

27+
// FIXME: Replace this whole thing with getopt
28+
2729
static void printUsage(const char *progname) {
2830
printf("Usage: %s [-hjsdtocv] [input_json...]\n", progname);
2931
printf(" Available options are:\n");
@@ -41,6 +43,7 @@ static void printUsage(const char *progname) {
4143
printf(" [--nodes <list>] -> Use worker nodes in comma-separated ip:port list for a faster render (Experimental)\n");
4244
printf(" [--shutdown] -> Use in conjunction with a node list to send a shutdown command to a list of clients\n");
4345
printf(" [--asset-path] -> Specify an asset path to load assets from, useful in scripts\n");
46+
printf(" [--no-sdl] -> Disable render preview window\n");
4447
// printf(" [--test] -> Run the test suite\n"); // FIXME
4548
term_restore();
4649
exit(0);
@@ -229,6 +232,10 @@ struct driver_args *args_parse(int argc, char **argv) {
229232
setDatabaseInt(args, "worker_port", port);
230233
}
231234
}
235+
236+
if (stringEquals(argv[i], "--no-sdl")) {
237+
setDatabaseTag(args, "no_sdl");
238+
}
232239

233240
if (strncmp(argv[i], "-", 1) == 0) {
234241
int vees = 0;

src/driver/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ int main(int argc, char *argv[]) {
245245
.should_save = true,
246246
.win_mutex = mutex_create(),
247247
};
248-
cr_renderer_set_callback(renderer, cr_cb_on_start, on_start, &usrdata);
248+
if (!args_is_set(opts, "no_sdl"))
249+
cr_renderer_set_callback(renderer, cr_cb_on_start, on_start, &usrdata);
249250
cr_renderer_set_callback(renderer, cr_cb_on_stop, on_stop, &usrdata);
250251
cr_renderer_set_callback(renderer, cr_cb_status_update, status, &usrdata);
251252

0 commit comments

Comments
 (0)