Add a `--fullscreen` CLI option

This commit is contained in:
Vinícius R. Miguel 2020-05-15 12:51:06 -03:00
parent f39d9ad096
commit fd74e20373
3 changed files with 12 additions and 2 deletions

View File

@ -6,7 +6,8 @@ struct PCCLIOptions gCLIOpts;
void parse_cli_opts(int argc, char* argv[])
{
// Initialize options with false values.
gCLIOpts.SkipIntro = 0;
gCLIOpts.SkipIntro = 0;
gCLIOpts.FullScreen = 0;
// Scan arguments for options
if (argc > 1)
@ -16,6 +17,9 @@ void parse_cli_opts(int argc, char* argv[])
{
if (strcmp(argv[i], "--skip-intro") == 0) // Skip Peach Intro
gCLIOpts.SkipIntro = 1;
if (strcmp(argv[i], "--fullscreen") == 0) // Open game in fullscreen
gCLIOpts.FullScreen = 1;
}
}
}

View File

@ -3,8 +3,9 @@
struct PCCLIOptions
{
u8 SkipIntro;
u8 FullScreen;
};
extern struct PCCLIOptions gCLIOpts;
void parse_cli_opts(int argc, char* argv[]);
void parse_cli_opts(int argc, char* argv[]);

View File

@ -19,6 +19,7 @@
#include "gfx_window_manager_api.h"
#include "gfx_screen_config.h"
#include "../configfile.h"
#include "../cliopts.h"
#include "src/pc/controller/controller_keyboard.h"
@ -113,6 +114,10 @@ static void gfx_sdl_init(void) {
window_flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE;
if (gCLIOpts.FullScreen) {
configFullscreen = true;
}
if (configFullscreen) {
window_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
}