diff --git a/README.md b/README.md index 124c4bf..2d82978 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,9 @@ track. By default, system3-sdl2 uses MIDI sound if available. This option forces FM tone generator emulation. +#### `-fullscreen` +Starts the game in fullscreen mode. + #### `-mididevice` _number_ Specifies the MIDI device number to use. If not specified, the first available device is used. diff --git a/src/config.cpp b/src/config.cpp index 6be2a5a..257cfb0 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -154,6 +154,8 @@ Config::Config(int argc, char *argv[]) title = argv[++i]; else if (strcmp(argv[i], "-scanline") == 0) scanline = true; + else if (strcmp(argv[i], "-fullscreen") == 0) + fullscreen = true; #ifdef ENABLE_DEBUGGER else if (strcmp(argv[i], "-debugger") == 0) debugger_mode = parse_debugger_mode(argv[++i]); @@ -224,6 +226,8 @@ void Config::load_ini() title = val; else if (!strcasecmp(key, "scanline")) scanline = to_bool(val, lineno); + else if (!strcasecmp(key, "fullscreen")) + fullscreen = to_bool(val, lineno); #ifdef ENABLE_DEBUGGER else if (!strcasecmp(key, "debugger")) debugger_mode = parse_debugger_mode(val, lineno); diff --git a/src/config.h b/src/config.h index 0947742..f7bdb0d 100644 --- a/src/config.h +++ b/src/config.h @@ -47,6 +47,7 @@ struct Config { bool use_fm = false; bool no_antialias = false; bool scanline = false; + bool fullscreen = false; TexthookMode texthook_mode = TexthookMode::NONE; DebuggerMode debugger_mode = DebuggerMode::DISABLED; std::string texthook_suppressions; diff --git a/src/sdlmain.cpp b/src/sdlmain.cpp index 9d30558..6f71979 100644 --- a/src/sdlmain.cpp +++ b/src/sdlmain.cpp @@ -25,7 +25,7 @@ std::unique_ptr g_nact; namespace { -SDL_Window* create_window(const GameId& game_id) +SDL_Window* create_window(const Config& config, const GameId& game_id) { std::string title = "System3-sdl2 " SYSTEM3_VERSION; if (game_id.title) { @@ -48,7 +48,7 @@ SDL_Window* create_window(const GameId& game_id) SDL_SetHint(SDL_HINT_ORIENTATIONS, "LandscapeLeft LandscapeRight"); Uint32 flags = SDL_WINDOW_FULLSCREEN; #else - Uint32 flags = SDL_WINDOW_RESIZABLE; + Uint32 flags = config.fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : SDL_WINDOW_RESIZABLE; #endif #ifdef __EMSCRIPTEN__ @@ -76,7 +76,7 @@ int main(int argc, char *argv[]) } GameId game_id(config); - g_window = create_window(game_id); + g_window = create_window(config, game_id); g_renderer = SDL_CreateRenderer(g_window, -1, 0); sdl_custom_event_type = SDL_RegisterEvents(1); diff --git a/system3.ini.example b/system3.ini.example index 531f753..ec7748b 100644 --- a/system3.ini.example +++ b/system3.ini.example @@ -21,6 +21,9 @@ playlist = bgm/playlist.txt ; Force FM tone generator emulation even if MIDI is available. fm = true +; If set to true, the game starts in fullscreen mode. +;fullscreen = true + ; MIDI device number to use for music playback. mididevice = 0