diff --git a/core/cfg/option.cpp b/core/cfg/option.cpp index 095f97f48..474973bc5 100644 --- a/core/cfg/option.cpp +++ b/core/cfg/option.cpp @@ -40,6 +40,7 @@ Option SavestateSlot("Dreamcast.SavestateSlot"); Option ForceFreePlay("ForceFreePlay", true); Option FetchBoxart("FetchBoxart", true); Option BoxartDisplayMode("BoxartDisplayMode", true); +Option UIScaling("UIScaling", 100); // Sound diff --git a/core/cfg/option.h b/core/cfg/option.h index 037fceff7..02ef6cc34 100644 --- a/core/cfg/option.h +++ b/core/cfg/option.h @@ -373,6 +373,7 @@ extern Option SavestateSlot; extern Option ForceFreePlay; extern Option FetchBoxart; extern Option BoxartDisplayMode; +extern Option UIScaling; // Sound diff --git a/core/rend/gui.cpp b/core/rend/gui.cpp index 3dbd34c7c..9f4753ee1 100644 --- a/core/rend/gui.cpp +++ b/core/rend/gui.cpp @@ -77,6 +77,7 @@ static double osd_message_end; static std::mutex osd_message_mutex; static void (*showOnScreenKeyboard)(bool show); static bool keysUpNextFrame[512]; +static bool uiUserScaleUpdated; static int map_system = 0; static void reset_vmus(); @@ -184,6 +185,7 @@ void gui_initFonts() if (settings.display.width <= 640 || settings.display.height <= 480) settings.display.uiScale = std::min(1.4f, settings.display.uiScale); #endif + settings.display.uiScale *= config::UIScaling / 100.f; if (settings.display.uiScale == uiScale && ImGui::GetIO().Fonts->IsBuilt()) return; uiScale = settings.display.uiScale; @@ -1423,6 +1425,11 @@ static void gui_display_settings() if (ImGui::Button("Done", ScaledVec2(100, 30))) { + if (uiUserScaleUpdated) + { + uiUserScaleUpdated = false; + mainui_reinit(); + } if (game_started) gui_setState(GuiState::Commands); else @@ -1544,6 +1551,9 @@ static void gui_display_settings() return true; }); #endif + ImGui::SameLine(); + if (ImGui::Button("Rescan Content")) + scanner.refresh(); ImGui::PopStyleVar(); scrollWhenDraggingOnVoid(); @@ -1599,6 +1609,17 @@ static void gui_display_settings() "Display game cover art in the game list."); OptionCheckbox("Fetch Box Art", config::FetchBoxart, "Fetch cover images from TheGamesDB.net."); + if (OptionSlider("UI Scaling", config::UIScaling, 50, 200, "Adjust the size of UI elements and fonts.", "%d%%")) + uiUserScaleUpdated = true; + if (uiUserScaleUpdated) + { + ImGui::SameLine(); + if (ImGui::Button("Apply")) { + mainui_reinit(); + uiUserScaleUpdated = false; + } + } + if (OptionCheckbox("Hide Legacy Naomi Roms", config::HideLegacyNaomiRoms, "Hide .bin, .dat and .lst files from the content browser")) scanner.refresh(); diff --git a/core/rend/gui_util.cpp b/core/rend/gui_util.cpp index 2d894642e..14264062c 100644 --- a/core/rend/gui_util.cpp +++ b/core/rend/gui_util.cpp @@ -495,7 +495,8 @@ bool OptionCheckbox(const char *name, config::Option& optio template bool OptionCheckbox(const char *name, config::Option& option, const char *help); template bool OptionCheckbox(const char *name, config::Option& option, const char *help); -bool OptionSlider(const char *name, config::Option& option, int min, int max, const char *help, const char *format) +template +bool OptionSlider(const char *name, config::Option& option, int min, int max, const char *help, const char *format) { bool valueChanged; { @@ -513,6 +514,8 @@ bool OptionSlider(const char *name, config::Option& option, int min, int ma } return valueChanged; } +template bool OptionSlider(const char *name, config::Option& option, int min, int max, const char *help, const char *format); +template bool OptionSlider(const char *name, config::Option& option, int min, int max, const char *help, const char *format); bool OptionArrowButtons(const char *name, config::Option& option, int min, int max, const char *help) { diff --git a/core/rend/gui_util.h b/core/rend/gui_util.h index a3f9403f7..290efba93 100644 --- a/core/rend/gui_util.h +++ b/core/rend/gui_util.h @@ -44,7 +44,8 @@ IMGUI_API const ImWchar* GetGlyphRangesChineseTraditionalOfficial();// Defaul void ShowHelpMarker(const char* desc); template bool OptionCheckbox(const char *name, config::Option& option, const char *help = nullptr); -bool OptionSlider(const char *name, config::Option& option, int min, int max, const char *help = nullptr, const char *format = nullptr); +template +bool OptionSlider(const char *name, config::Option& option, int min, int max, const char *help = nullptr, const char *format = nullptr); template bool OptionRadioButton(const char *name, config::Option& option, T value, const char *help = nullptr); void OptionComboBox(const char *name, config::Option& option, const char *values[], int count,