diff options
author | Aki <please@ignore.pl> | 2024-03-02 01:15:13 +0100 |
---|---|---|
committer | Aki <please@ignore.pl> | 2024-03-02 01:18:45 +0100 |
commit | e70158ea57302e2fa2d588b67fc8dc18265192eb (patch) | |
tree | ec1d90159f147a9aa896cb654cda905c2f3ee357 /StarsEx | |
parent | 8b21a7027491d7e69bb165c0c50b0a23d1c8755e (diff) | |
download | starshatter-e70158ea57302e2fa2d588b67fc8dc18265192eb.zip starshatter-e70158ea57302e2fa2d588b67fc8dc18265192eb.tar.gz starshatter-e70158ea57302e2fa2d588b67fc8dc18265192eb.tar.bz2 |
You can now toggle Full Screen in Video settings
Full screen setting is preserved after game is restarted. Switching
in and out of full screen repetitively causes some mode
inconsistencies, but this should be enough for now. You can still force
window mode with -win CLI option.
Diffstat (limited to 'StarsEx')
-rw-r--r-- | StarsEx/Starshatter.cpp | 13 | ||||
-rw-r--r-- | StarsEx/VidDlg.cpp | 18 | ||||
-rw-r--r-- | StarsEx/VidDlg.h | 1 |
3 files changed, 23 insertions, 9 deletions
diff --git a/StarsEx/Starshatter.cpp b/StarsEx/Starshatter.cpp index b0f7910..808e682 100644 --- a/StarsEx/Starshatter.cpp +++ b/StarsEx/Starshatter.cpp @@ -2255,6 +2255,7 @@ void Starshatter::LoadVideoConfig(const char* filename) { // set up defaults: + bool full_screen = true; int screen_width = 1280; int screen_height = 720; int screen_depth = 32; @@ -2314,6 +2315,10 @@ Starshatter::LoadVideoConfig(const char* filename) if (term) { TermDef* def = term->isDef(); if (def) { + if (def->name()->value() == "full_screen") { + GetDefBool(full_screen, def, filename); + } + if (def->name()->value() == "width") { int w; GetDefNumber(w, def, filename); @@ -2471,6 +2476,7 @@ Starshatter::LoadVideoConfig(const char* filename) loader->ReleaseBuffer(block); if (video_settings) { + video_settings->is_windowed = !full_screen; video_settings->fullscreen_mode.width = screen_width; video_settings->fullscreen_mode.height = screen_height; @@ -2507,9 +2513,10 @@ Starshatter::SaveVideoConfig(const char* filename) FILE* f = fopen(filename, "wb"); if (f) { fprintf(f, "VIDEO\n\n"); - fprintf(f, "width: %4d\n", video_settings->fullscreen_mode.width); - fprintf(f, "height: %4d\n", video_settings->fullscreen_mode.height); - fprintf(f, "depth: %4d\n", video_settings->fullscreen_mode.format == VideoMode::FMT_R5G6B5 ? 16 : 32); + fprintf(f, "full_screen: %s\n", video_settings->is_windowed ? "false" : "true"); + fprintf(f, "width: %4d\n", video_settings->fullscreen_mode.width); + fprintf(f, "height: %4d\n", video_settings->fullscreen_mode.height); + fprintf(f, "depth: %4d\n", video_settings->fullscreen_mode.format == VideoMode::FMT_R5G6B5 ? 16 : 32); fprintf(f, "\n"); fprintf(f, "max_tex: %4d\n", video_settings->tex_size); fprintf(f, "primary3D: %s\n", "true"); diff --git a/StarsEx/VidDlg.cpp b/StarsEx/VidDlg.cpp index 7447349..36253ae 100644 --- a/StarsEx/VidDlg.cpp +++ b/StarsEx/VidDlg.cpp @@ -92,6 +92,7 @@ VidDlg::RegisterControls() REGISTER_CLIENT(EID_CLICK, gamma, VidDlg, OnGamma); } + full_screen = (ComboBox*) FindControl(202); lens_flare = (ComboBox*) FindControl(211); corona = (ComboBox*) FindControl(212); nebula = (ComboBox*) FindControl(213); @@ -131,7 +132,7 @@ VidDlg::Show() FormWindow::Show(); if (closed) { - bool fullscreen = true; + bool is_fullscreen = false; if (stars) { selected_render = 9; @@ -158,7 +159,10 @@ VidDlg::Show() if (bump_maps) bump_maps->SetSelection(video->IsBumpMapEnabled()); - fullscreen = video->IsFullScreen(); + if (full_screen) { + is_fullscreen = video->IsFullScreen(); + full_screen->SetSelection(is_fullscreen); + } } if (lens_flare) @@ -180,7 +184,7 @@ VidDlg::Show() if (mode) { BuildModeList(); mode->SetSelection(selected_mode); - mode->SetEnabled(fullscreen); + mode->SetEnabled(is_fullscreen); } if (tex_size) @@ -362,6 +366,7 @@ VidDlg::Apply() Video* video = Video::GetInstance(); if (video) { const VideoSettings* vs = video->GetVideoSettings(); + video_change = static_cast<bool>(full_screen->GetSelectedIndex()) != video->IsFullScreen(); if (vs) bias = vs->depth_bias; @@ -404,9 +409,10 @@ VidDlg::Apply() if (f) { fprintf(f, "VIDEO\n\n"); - fprintf(f, "width: %4d\n", w); - fprintf(f, "height: %4d\n", h); - fprintf(f, "depth: %4d\n", d); + fprintf(f, "full_screen: %s\n", full_screen->GetSelectedIndex() ? "true" : "false"); + fprintf(f, "width: %4d\n", w); + fprintf(f, "height: %4d\n", h); + fprintf(f, "depth: %4d\n", d); fprintf(f, "\n"); fprintf(f, "max_tex: %d\n", (int) pow(2.0f, 6 + selected_tex_size)); fprintf(f, "primary3D: %s\n", (a>0)?"true":"false"); diff --git a/StarsEx/VidDlg.h b/StarsEx/VidDlg.h index 0b6e918..884428d 100644 --- a/StarsEx/VidDlg.h +++ b/StarsEx/VidDlg.h @@ -65,6 +65,7 @@ protected: BaseScreen* manager; Starshatter* stars; + ComboBox* full_screen; ComboBox* mode; ComboBox* tex_size; ComboBox* detail; |