init: add --fullscreen and --windowed command line options

This commit is contained in:
Sebastian Krzyszkowiak 2019-10-17 03:51:11 +02:00
parent 1ff0d6ddac
commit 63d1ae8bf7
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF

View file

@ -136,15 +136,27 @@ SYMBOL_EXPORT struct Game* libsuperderpy_init(int argc, char** argv, const char*
static struct option long_options[] =
{
{"debug", no_argument, NULL, 'd'},
{"fullscreen", no_argument, NULL, 'f'},
{"windowed", no_argument, NULL, 'w'},
{NULL, 0, NULL, 0},
};
int opt;
while ((opt = getopt_long(argc, argv, "d", long_options, NULL)) != -1) {
while ((opt = getopt_long(argc, argv, "dfw", long_options, NULL)) != -1) {
switch (opt) {
case 'd':
game->config.debug.enabled = true;
break;
case 'f':
if (!game->config.fullscreen) {
game->config.fullscreen = true;
}
break;
case 'w':
if (game->config.fullscreen) {
game->config.fullscreen = false;
}
break;
}
}