Add --help and --windowed CLI options.

This commit is contained in:
IvanDSM 2020-05-16 21:39:48 -03:00
parent 60f6743306
commit 2c8382e60e
2 changed files with 18 additions and 4 deletions

View File

@ -23,7 +23,20 @@ void parse_cli_opts(int argc, char* argv[])
gCLIOpts.SkipIntro = 1;
if (strcmp(argv[i], "--fullscreen") == 0) // Open game in fullscreen
gCLIOpts.FullScreen = 1;
gCLIOpts.FullScreen = 1;
if (strcmp(argv[i], "--windowed") == 0) // Open game in windowed mode
gCLIOpts.FullScreen = 2;
if (strcmp(argv[i], "--help") == 0) // Print help
{
printf("Super Mario 64 PC Port\n");
printf("%-20s\tSkips the Peach and Castle intro when starting a new game.\n", "--skip-intro");
printf("%-20s\tStarts the game in full screen mode.\n", "--fullscreen");
printf("%-20s\tStarts the game in windowed mode.\n", "--windowed");
printf("%-20s\tSaves the configuration file as CONFIGNAME.\n", "--configfile CONFIGNAME");
exit(0);
}
if (strncmp(argv[i], "--configfile", strlen("--configfile")) == 0)
{
@ -36,7 +49,7 @@ void parse_cli_opts(int argc, char* argv[])
strncpy(gCLIOpts.ConfigFile, argv[i+1], strlen(argv[i+1]));
}
}
}
}
}
}
}

View File

@ -114,9 +114,10 @@ static void gfx_sdl_init(void) {
window_flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE;
if (gCLIOpts.FullScreen) {
if (gCLIOpts.FullScreen == 1)
configFullscreen = true;
}
else if (gCLIOpts.FullScreen == 2)
configFullscreen = false;
if (configFullscreen) {
window_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;